Class CmsOrganizationalUnit

java.lang.Object
org.opencms.security.CmsOrganizationalUnit

public class CmsOrganizationalUnit extends Object
An organizational unit in OpenCms.

Be sure the flags does not conflict with the flags defined in CmsResource.

Since:
6.5.6
  • Field Details

  • Constructor Details

    • CmsOrganizationalUnit

      public CmsOrganizationalUnit(CmsUUID id, String fqn, String description, int flags, CmsUUID projectId)
      Creates a new OpenCms organizational unit principal.
      Parameters:
      id - the unique id of the organizational unit
      fqn - the fully qualified name of the this organizational unit (should end with slash)
      description - the description of the organizational unit
      flags - the flags of the organizational unit
      projectId - the id of the related default project
  • Method Details

    • getParentFqn

      public static final String getParentFqn(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 String getSimpleName(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 String prefixWithOu(String ou, String principal)
      Prefixes a simple name with an OU.

      Parameters:
      ou - the OU to use as a prefix
      principal - the simple name to which the OU should be prepended
      Returns:
      the FQN
    • removeLeadingSeparator

      public static String removeLeadingSeparator(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 Object clone()
      Overrides:
      clone in class Object
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • 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 String getDescription(Locale locale)
      Returns the description of this organizational unit.

      Parameters:
      locale - the locale
      Returns:
      the description of this organizational unit
    • getDisplayName

      public String getDisplayName(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 String getName()
      Returns the fully qualified name of this organizational unit.

      Returns:
      the fully qualified name of this organizational unit
    • getParentFqn

      public 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

      Returns the id of the related default project.

      Returns:
      the id of the related default project
    • 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 class Object
      See Also:
    • setDescription

      public void setDescription(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 String toString()
      Overrides:
      toString in class Object
      See Also: