public abstract class CmsPrincipal extends java.lang.Object implements I_CmsPrincipal, java.lang.Comparable<I_CmsPrincipal>
限定符和类型 | 字段和说明 |
---|---|
protected java.lang.String |
m_description
The description of this principal.
|
protected int |
m_flags
The flags of this principal.
|
protected CmsUUID |
m_id
The unique id of this principal.
|
protected java.lang.String |
m_name
The fully qualified name of this principal.
|
FLAG_CORE_LIMIT, FLAG_DISABLED, FLAG_ENABLED, FLAG_GROUP_PROJECT_MANAGER, FLAG_GROUP_PROJECT_USER, FLAG_GROUP_ROLE, FLAG_GROUP_VIRTUAL, FLAG_USER_MANAGED, FLAG_USER_WEBUSER, PRINCIPAL_GROUP, PRINCIPAL_USER
限定符 | 构造器和说明 |
---|---|
protected |
CmsPrincipal()
Empty constructor for subclassing.
|
限定符和类型 | 方法和说明 |
---|---|
int |
compareTo(I_CmsPrincipal obj) |
boolean |
equals(java.lang.Object obj)
Compares the given object with this principal.
|
static java.util.List<? extends CmsPrincipal> |
filterCoreFlag(java.util.List<? extends CmsPrincipal> principals,
int flag)
Filters out all principals that do not have the given flag set,
but leaving principals with flags less than
untouched. |
static java.util.List<CmsGroup> |
filterCoreGroups(java.util.List<CmsGroup> groups)
Filters out all groups with flags greater than
. |
static java.util.List<CmsUser> |
filterCoreUsers(java.util.List<CmsUser> users)
Filters out all users with flags greater than
. |
static java.util.List<? extends CmsPrincipal> |
filterFlag(java.util.List<? extends CmsPrincipal> principals,
int flag)
Filters out all principals that do not have the given flag set.
|
java.lang.String |
getDescription()
Returns the description of this principal.
|
java.lang.String |
getDisplayName(CmsObject cms,
java.util.Locale locale)
Returns the display name of this principal including the organizational unit.
|
java.lang.String |
getDisplayName(CmsObject cms,
java.util.Locale locale,
I_CmsGroupNameTranslation translation)
Returns the translated display name of this principal if it is a group and the display name otherwise.
|
int |
getFlags()
Returns the flags of this principal.
|
CmsUUID |
getId()
Returns the unique id of this principal.
|
java.lang.String |
getName()
Returns the fully qualified name of this principal.
|
java.lang.String |
getOuFqn()
Returns the fully qualified name of the associated organizational unit.
|
static java.lang.String |
getPrefixedGroup(java.lang.String name)
Returns the provided group name prefixed with
|
java.lang.String |
getPrefixedName()
Returns this principals unique name prefixed with it's type.
|
static java.lang.String |
getPrefixedUser(java.lang.String name)
Returns the provided user name prefixed with
|
java.lang.String |
getSimpleName()
Returns the simple name of this organizational unit.
|
int |
hashCode()
Returns the hash code of this object.
|
boolean |
isEnabled()
Returns
true if this principal is enabled. |
boolean |
isGroup()
Returns
true if this principal is of type . |
boolean |
isUser()
Returns
true if this principal is of type . |
static I_CmsPrincipal |
readPrefixedPrincipal(CmsObject cms,
java.lang.String name)
Utility function to read a prefixed principal from the OpenCms database using the
provided OpenCms user context.
|
static I_CmsPrincipal |
readPrincipal(CmsObject cms,
CmsUUID id)
Utility function to read a principal by its id from the OpenCms database using the
provided OpenCms user context.
|
static I_CmsPrincipal |
readPrincipal(CmsObject cms,
java.lang.String type,
java.lang.String name)
Utility function to read a principal of the given type from the OpenCms database using the
provided OpenCms user context.
|
static I_CmsPrincipal |
readPrincipalIncludingHistory(CmsObject cms,
CmsUUID id)
Utility function to read a principal by its id from the OpenCms database using the
provided OpenCms user context.
|
void |
setDescription(java.lang.String description)
Sets the description of this principal.
|
void |
setEnabled(boolean enabled)
Enables (or disables) this principal, depending on the given status.
|
void |
setFlags(int value)
Sets this principals flags to the specified value.
|
void |
setName(java.lang.String name)
Sets the unique name of this principal.
|
checkName
protected java.lang.String m_description
protected int m_flags
protected CmsUUID m_id
protected java.lang.String m_name
public static java.util.List<? extends CmsPrincipal> filterCoreFlag(java.util.List<? extends CmsPrincipal> principals, int flag)
I_CmsPrincipal.FLAG_CORE_LIMIT
untouched.The given parameter list is directly modified, so the returned list is the same object as the input list.
principals
- a list of CmsPrincipal
objectsflag
- the flag for filteringpublic static java.util.List<CmsGroup> filterCoreGroups(java.util.List<CmsGroup> groups)
I_CmsPrincipal.FLAG_CORE_LIMIT
.The given parameter list is directly modified, so the returned list is the same object as the input list.
groups
- a list of CmsGroup
objectspublic static java.util.List<CmsUser> filterCoreUsers(java.util.List<CmsUser> users)
I_CmsPrincipal.FLAG_CORE_LIMIT
.The given parameter list is directly modified, so the returned list is the same object as the input list.
users
- a list of CmsUser
objectspublic static java.util.List<? extends CmsPrincipal> filterFlag(java.util.List<? extends CmsPrincipal> principals, int flag)
The given parameter list is directly modified, so the returned list is the same object as the input list.
principals
- the list of CmsPrincipal
objectsflag
- the flag for filteringpublic static java.lang.String getPrefixedGroup(java.lang.String name)
I_CmsPrincipal.PRINCIPAL_GROUP
.
.name
- the name to add the prefix toI_CmsPrincipal.PRINCIPAL_GROUP
.
public static java.lang.String getPrefixedUser(java.lang.String name)
I_CmsPrincipal.PRINCIPAL_USER
.
.name
- the name to add the prefix toI_CmsPrincipal.PRINCIPAL_USER
.
public static I_CmsPrincipal readPrefixedPrincipal(CmsObject cms, java.lang.String name) throws CmsException
The principal must be either prefixed with
or
I_CmsPrincipal.PRINCIPAL_GROUP
.
.I_CmsPrincipal.PRINCIPAL_USER
.
cms
- the OpenCms user context to use when reading the principalname
- the prefixed principal nameCmsException
- in case the principal could not be readpublic static I_CmsPrincipal readPrincipal(CmsObject cms, CmsUUID id) throws CmsException
cms
- the OpenCms user context to use when reading the principalid
- the id of the principal to readCmsException
- in case the principal could not be readpublic static I_CmsPrincipal readPrincipal(CmsObject cms, java.lang.String type, java.lang.String name) throws CmsException
The type must either be
or
I_CmsPrincipal.PRINCIPAL_GROUP
.I_CmsPrincipal.PRINCIPAL_USER
cms
- the OpenCms user context to use when reading the principaltype
- the principal typename
- the principal nameCmsException
- in case the principal could not be readpublic static I_CmsPrincipal readPrincipalIncludingHistory(CmsObject cms, CmsUUID id) throws CmsException
cms
- the OpenCms user context to use when reading the principalid
- the id of the principal to readCmsException
- in case the principal could not be readpublic int compareTo(I_CmsPrincipal obj)
compareTo
在接口中 java.lang.Comparable<I_CmsPrincipal>
Comparable.compareTo(java.lang.Object)
public boolean equals(java.lang.Object obj)
I_CmsPrincipal
equals
在接口中 java.security.Principal
equals
在接口中 I_CmsPrincipal
equals
在类中 java.lang.Object
obj
- object to compareObject.equals(java.lang.Object)
public java.lang.String getDescription()
I_CmsPrincipal
getDescription
在接口中 I_CmsPrincipal
I_CmsPrincipal.getDescription()
public java.lang.String getDisplayName(CmsObject cms, java.util.Locale locale) throws CmsException
cms
- the cms contextlocale
- the localeCmsException
- if the organizational unit could not be readpublic java.lang.String getDisplayName(CmsObject cms, java.util.Locale locale, I_CmsGroupNameTranslation translation) throws CmsException
cms
- the current CMS contextlocale
- the localetranslation
- the group name translation to useCmsException
- if something goes wrongpublic int getFlags()
I_CmsPrincipal
The principal flags are used to store special information about the
principals state encoded bitwise. Usually the flags int value should not
be directly accessed. Utility methods like
provide a much easier way to access the information contained in the flags.I_CmsPrincipal.isEnabled()
getFlags
在接口中 I_CmsPrincipal
I_CmsPrincipal.getFlags()
public CmsUUID getId()
I_CmsPrincipal
getId
在接口中 I_CmsPrincipal
I_CmsPrincipal.getId()
public java.lang.String getName()
getName
在接口中 java.security.Principal
getName
在接口中 I_CmsPrincipal
Principal.getName()
public java.lang.String getOuFqn()
getOuFqn
在接口中 I_CmsPrincipal
public java.lang.String getPrefixedName()
I_CmsPrincipal
The type prefix can either be
(for groups) or I_CmsPrincipal.PRINCIPAL_GROUP
.
(for users).I_CmsPrincipal.PRINCIPAL_USER
.
getPrefixedName
在接口中 I_CmsPrincipal
I_CmsPrincipal.getPrefixedName()
public java.lang.String getSimpleName()
getSimpleName
在接口中 I_CmsPrincipal
public int hashCode()
I_CmsPrincipal
hashCode
在接口中 java.security.Principal
hashCode
在接口中 I_CmsPrincipal
hashCode
在类中 java.lang.Object
Object.hashCode()
public boolean isEnabled()
I_CmsPrincipal
true
if this principal is enabled.A principal may be disabled in order to disable it, for example to prevent logins of a user. If a principal is just disabled but not deleted, the credentials of the principal in the VFS are still valid.
isEnabled
在接口中 I_CmsPrincipal
true
if this principal is enabledI_CmsPrincipal.isEnabled()
public boolean isGroup()
I_CmsPrincipal
true
if this principal is of type CmsGroup
.isGroup
在接口中 I_CmsPrincipal
true
if this principal is of type CmsGroup
I_CmsPrincipal.isGroup()
public boolean isUser()
I_CmsPrincipal
true
if this principal is of type CmsUser
.isUser
在接口中 I_CmsPrincipal
true
if this principal is of type CmsUser
I_CmsPrincipal.isUser()
public void setDescription(java.lang.String description)
I_CmsPrincipal
setDescription
在接口中 I_CmsPrincipal
description
- the principal description to setI_CmsPrincipal.setDescription(java.lang.String)
public void setEnabled(boolean enabled)
I_CmsPrincipal
setEnabled
在接口中 I_CmsPrincipal
enabled
- the principal status to setI_CmsPrincipal.setEnabled(boolean)
public void setFlags(int value)
I_CmsPrincipal
The principal flags are used to store special information about the
principals state encoded bitwise. Usually the flags integer value should not
be directly accessed. Utility methods like
provide a much easier way to manipulate the information contained in the flags.I_CmsPrincipal.setEnabled(boolean)
setFlags
在接口中 I_CmsPrincipal
value
- the value to set this principals flags toI_CmsPrincipal.setFlags(int)
public void setName(java.lang.String name)
I_CmsPrincipal
setName
在接口中 I_CmsPrincipal
name
- the unique name of this principal to setI_CmsPrincipal.setName(java.lang.String)