Package org.opencms.security
Class CmsOrganizationalUnit
- java.lang.Object
-
- org.opencms.security.CmsOrganizationalUnit
-
public class CmsOrganizationalUnit extends java.lang.Object
An organizational unit in OpenCms.Be sure the flags does not conflict with the flags defined in
CmsResource
.- Since:
- 6.5.6
-
-
Field Summary
Fields Modifier and Type Field Description static int
FLAG_HIDE_LOGIN
The flag constant to hide the organizational units from the login form.static int
FLAG_WEBUSERS
The flag constant to mark the organizational units as containing only webusers.static java.lang.String
SEPARATOR
The character used to separate each level in a fully qualified name.
-
Constructor Summary
Constructors Constructor Description CmsOrganizationalUnit(CmsUUID id, java.lang.String fqn, java.lang.String description, int flags, CmsUUID projectId)
Creates a new OpenCms organizational unit principal.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFlag(int flag)
Adds the given flag to the flags for this organizational unit.java.lang.Object
clone()
boolean
equals(java.lang.Object obj)
java.lang.String
getDescription()
Returns the description of this organizational unit.java.lang.String
getDescription(java.util.Locale locale)
Returns the description of this organizational unit.java.lang.String
getDisplayName(java.util.Locale locale)
Returns the display name for this organizational unit.int
getFlags()
Returns the flags of this organizational unit.CmsUUID
getId()
Returns the id of this organizational unit.java.lang.String
getName()
Returns the fully qualified name of this organizational unit.java.lang.String
getParentFqn()
Returns the full qualified name of the parent organizational unit of this organizational unit.static java.lang.String
getParentFqn(java.lang.String fqn)
Returns the parent fully qualified name.CmsUUID
getProjectId()
Returns the id of the related default project.java.lang.String
getSimpleName()
Returns the simple name of this organizational unit.static java.lang.String
getSimpleName(java.lang.String fqn)
Returns the last name of the given fully qualified name.boolean
hasFlag(int flag)
Checks if this organizational unit has the given flag set.boolean
hasFlagHideLogin()
Checks if this organizational unit has the "hide from login form" flag set.boolean
hasFlagWebuser()
Checks if this organizational unit has the "webusers" flag set.int
hashCode()
static java.lang.String
prefixWithOu(java.lang.String ou, java.lang.String principal)
Prefixes a simple name with an OU.static java.lang.String
removeLeadingSeparator(java.lang.String fqn)
Returns the given fully qualified name without leading separator.void
setDescription(java.lang.String description)
Sets the description of this organizational unit.void
setFlagHideLogin()
Sets the "hide from login form" flag.void
setFlags(int value)
Sets this organizational unit flags to the specified value.void
setFlagWebusers()
Sets the "webusers" flag.java.lang.String
toString()
-
-
-
Field Detail
-
FLAG_HIDE_LOGIN
public static final int FLAG_HIDE_LOGIN
The flag constant to hide the organizational units from the login form.- See Also:
- Constant Field Values
-
FLAG_WEBUSERS
public static final int FLAG_WEBUSERS
The flag constant to mark the organizational units as containing only webusers.- See Also:
- Constant Field Values
-
SEPARATOR
public static final java.lang.String SEPARATOR
The character used to separate each level in a fully qualified name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsOrganizationalUnit
public CmsOrganizationalUnit(CmsUUID id, java.lang.String fqn, java.lang.String description, int flags, CmsUUID projectId)
Creates a new OpenCms organizational unit principal.- Parameters:
id
- the unique id of the organizational unitfqn
- the fully qualified name of the this organizational unit (should end with slash)description
- the description of the organizational unitflags
- the flags of the organizational unitprojectId
- the id of the related default project
-
-
Method Detail
-
getParentFqn
public static final java.lang.String getParentFqn(java.lang.String fqn)
Returns the parent fully qualified name.This is
null
for the root ou, and the empty string for first level ous.- Parameters:
fqn
- the fully qualified name to get the parent from- Returns:
- the parent fully qualified name
-
getSimpleName
public static final java.lang.String getSimpleName(java.lang.String fqn)
Returns the last name of the given fully qualified name.- Parameters:
fqn
- the fully qualified name to get the last name from- Returns:
- the last name of the given fully qualified name
-
prefixWithOu
public static java.lang.String prefixWithOu(java.lang.String ou, java.lang.String principal)
Prefixes a simple name with an OU.- Parameters:
ou
- the OU to use as a prefixprincipal
- the simple name to which the OU should be prepended- Returns:
- the FQN
-
removeLeadingSeparator
public static java.lang.String removeLeadingSeparator(java.lang.String fqn)
Returns the given fully qualified name without leading separator.- Parameters:
fqn
- the fully qualified name to fix- Returns:
- the given fully qualified name without leading separator
-
addFlag
public void addFlag(int flag)
Adds the given flag to the flags for this organizational unit.- Parameters:
flag
- the flag to add
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
- See Also:
Object.clone()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getDescription
public java.lang.String getDescription()
Returns the description of this organizational unit.This could return also just a macro, so please use the
getDescription(Locale)
method.- Returns:
- the description of this organizational unit
-
getDescription
public java.lang.String getDescription(java.util.Locale locale)
Returns the description of this organizational unit.- Parameters:
locale
- the locale- Returns:
- the description of this organizational unit
-
getDisplayName
public java.lang.String getDisplayName(java.util.Locale locale)
Returns the display name for this organizational unit.- Parameters:
locale
- the locale- Returns:
- the display name for this organizational unit
-
getFlags
public int getFlags()
Returns the flags of this organizational unit.The organizational unit flags are used to store special information about the organizational unit state encoded bitwise. Usually the flags int value should not be directly accessed.
- Returns:
- the flags of this organizational unit
-
getId
public CmsUUID getId()
Returns the id of this organizational unit.- Returns:
- the id of this organizational unit.
-
getName
public java.lang.String getName()
Returns the fully qualified name of this organizational unit.- Returns:
- the fully qualified name of this organizational unit
-
getParentFqn
public java.lang.String getParentFqn()
Returns the full qualified name of the parent organizational unit of this organizational unit.This is
null
for the root ou, and the empty string for first level ous.- Returns:
- the full qualified name of the parent organizational unit of this organizational unit
-
getProjectId
public CmsUUID getProjectId()
Returns the id of the related default project.- Returns:
- the id of the related default project
-
getSimpleName
public java.lang.String getSimpleName()
Returns the simple name of this organizational unit.- Returns:
- the simple name of this organizational unit.
-
hasFlag
public boolean hasFlag(int flag)
Checks if this organizational unit has the given flag set.- Parameters:
flag
- the flag to check- Returns:
true
if this organizational unit has the given flag set
-
hasFlagHideLogin
public boolean hasFlagHideLogin()
Checks if this organizational unit has the "hide from login form" flag set.- Returns:
true
if this organizational unit has the "hide from login form" flag set
-
hasFlagWebuser
public boolean hasFlagWebuser()
Checks if this organizational unit has the "webusers" flag set.- Returns:
true
if this organizational unit has the "webusers" flag set
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
setDescription
public void setDescription(java.lang.String description)
Sets the description of this organizational unit.- Parameters:
description
- the principal organizational unit to set
-
setFlagHideLogin
public void setFlagHideLogin()
Sets the "hide from login form" flag.
-
setFlags
public void setFlags(int value)
Sets this organizational unit flags to the specified value.The organizational unit flags are used to store special information about the organizational units state encoded bitwise. Usually the flags int value should not be directly accessed.
- Parameters:
value
- the value to set this organizational units flags to
-
setFlagWebusers
public void setFlagWebusers()
Sets the "webusers" flag.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-