Package com.appiancorp.suiteapi.common
Class RoleMap
java.lang.Object
com.appiancorp.suiteapi.common.RoleMap
- All Implemented Interfaces:
XMLable,Serializable,Map
- Direct Known Subclasses:
AdminConsoleRoleMap,CollaborationRoleMap,ContentRoleMap,ProcessApplicationRoleMap,ProcessRoleMap,PublicRoleMap,ThreadRoleMap
A mapping of roles and the users and groups that fill those roles.
N.B. The ComplexForeignKey.requiredByIxSpec() for groups is set true in
RoleBinder.getRefMd(Role, ReferenceContext, boolean) in order to
prevent the import of objects referencing missing security groups.
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface com.appiancorp.suiteapi.common.XMLable
DEFAULT_BUFFER_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActorsToRole(String role_, String type_, Long[] id_) Adds groups to the specified role.voidaddActorsToRole(String role_, String type_, String[] id_) Adds users to the specified role.voidclear()Removes all roles and actors.booleanReturns true if there are actors in any role of the role map.booleancontainsKey(Object key_) Returns whether this role map contains the role specified.booleancontainsValue(Object value_) Not implemented.entrySet()Returns all of the entries in the role map.booleanCompares this role map with another, and returns whether this role map contains exactly the same data as the other.Returns the actors at the particular role.Object[]getActorsInRole(String role_, String type_) Returns all of the actors at the given role and of the given type.Gets the aggregate security bitmap for the object.Returns all the group ids in this role map.Returns all the usernames in this role map.protected Roleprotected String[]Role[]getRoles()Returns an array of Role objects for all the roles stored in this role map.Gets the security bitmap for the object.inthashCode()Returns a hash code for the role map.protected voidbooleanisEmpty()Returns whether this role map contains no roles.keySet()Returns all of the roles in the role map.voidMerges this role map with the given new role map.Returns the users and groups in the given role.voidNot supported.Remove all users and groups at the role.voidremoveActorsFromRole(String role_, String type_, Long[] id_) Removes groups from the specified role.voidremoveActorsFromRole(String role_, String type_, String[] id_) Removes users from the specified role.protected voidvoidsetActorsInRole(String role_, String type_, Long[] id_) Sets the actors in the given role at the given type.voidsetActorsInRole(String role_, String type_, String[] id_) Sets the actors in the specified role.voidsetAggregateSecurity(Integer aggregateSecurity_) Sets the aggregate security bitmap for the object.protected voidvoidRemoves any roles that are currently set and sets the roles to the given data.voidsetRoles(Collection<? extends Role> rolesSet) Removes any roles that are currently set and sets the roles to the given data.voidsetSecurity(Integer security_) Sets the security bitmap for the object.intsize()Returns the number of roles in the role map.toString()toXML()Converts this role map to xml and returns it as a string.voidtoXML(StringBuilder buffer_) Converts this role map node to XML and stores it in aStringBuilder.values()Returns all of the users and groups at any roles.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
TYPE_USER
- See Also:
-
TYPE_USER_UUIDS
- See Also:
-
TYPE_AGGREGATE_USER
- See Also:
-
TYPE_GROUP
- See Also:
-
TYPE_GROUP_UUIDS
- See Also:
-
TYPE_AGGREGATE_GROUP
- See Also:
-
SECURITY_KEY
- See Also:
-
AGGREGATE_SECURITY_KEY
- See Also:
-
-
Constructor Details
-
RoleMap
public RoleMap()
-
-
Method Details
-
init
-
toString
-
toXML
Converts this role map to xml and returns it as a string. -
toXML
Converts this role map node to XML and stores it in aStringBuilder. -
size
public int size()Returns the number of roles in the role map. -
isEmpty
public boolean isEmpty()Returns whether this role map contains no roles. -
containsKey
Returns whether this role map contains the role specified.- Specified by:
containsKeyin interfaceMap- Parameters:
key_- the role to check for- Returns:
trueif the map contains the specified role;falseotherwise
-
containsValue
Not implemented.- Specified by:
containsValuein interfaceMap- Parameters:
value_- The object to look for.- Returns:
false
-
get
Returns the actors at the particular role. -
put
Returns the users and groups in the given role. -
remove
Remove all users and groups at the role.- Specified by:
removein interfaceMap- Parameters:
key_- The key of the object to remove from the role map.- Returns:
- a
Mapwith the previous users and groups in the role, where the keys are the types (TYPE_USERorTYPE_GROUP) and the values areArrayobjects of usernames (Strings) and group IDs (Longs) respectively.
-
putAll
Not supported.- Specified by:
putAllin interfaceMap- Parameters:
t_- value does not matter- Throws:
UnsupportedOperatorException- always
-
clear
public void clear()Removes all roles and actors. -
keySet
Returns all of the roles in the role map. -
values
Returns all of the users and groups at any roles. -
entrySet
Returns all of the entries in the role map. -
equals
Compares this role map with another, and returns whether this role map contains exactly the same data as the other. -
hashCode
public int hashCode()Returns a hash code for the role map. -
getActorsInRole
Returns all of the actors at the given role and of the given type.- Parameters:
role_- the role to get users fortype_-TYPE_USERorTYPE_GROUP- Returns:
- an
Arrayof the actor IDs (Stringfor users,Longfor groups) - See Also:
-
containsActors
public boolean containsActors()Returns true if there are actors in any role of the role map.- Returns:
- true if there are actors in any role of the role map
-
setActorsInRole
Sets the actors in the given role at the given type.- Parameters:
role_- the role. This parameter is required.type_- should always beTYPE_GROUPid_- the group ids- Throws:
NullPointerException- if the role is not specified.- See Also:
-
setActorsInRole
Sets the actors in the specified role.- Parameters:
role_- the role. This parameter is required.type_- should always beTYPE_USERid_- the usernames of the users- Throws:
NullPointerException- if the role is not specified.- See Also:
-
addActorsToRole
Adds groups to the specified role.- Parameters:
role_- the role. This parameter is required. Example: ContentRoleMap.AUTHOR, ContentRoleMap.VIEWER...type_- should always beRoleMap.TYPE_GROUPid_- the group ids- Throws:
NullPointerException- if the role is not specified.
-
addActorsToRole
Adds users to the specified role.- Parameters:
role_- the role. This parameter is required. Example: ContentRoleMap.AUTHOR, ContentRoleMap.VIEWER...type_- should always beRoleMap.TYPE_USERid_- the usernames of the users to add- Throws:
NullPointerException- if the role is not specified.
-
removeActorsFromRole
Removes groups from the specified role.- Parameters:
role_- the roletype_- should always beTYPE_GROUPid_- the group ids to remove
-
removeActorsFromRole
Removes users from the specified role.- Parameters:
role_- the roletype_- should always beTYPE_USERid_- the usernames to remove
-
setSecurity
Sets the security bitmap for the object. Only currently exists for Content. For possible values for Content, see ContentConstants.SEC_XXX. May benull- Parameters:
security_- the security map- See Also:
-
getSecurity
Gets the security bitmap for the object. Only currently exists for Content. For possible values for Content, see ContentConstants.SEC_XXX. May benull- Returns:
- the security map
- See Also:
-
setAggregateSecurity
Sets the aggregate security bitmap for the object. Only currently exists for Content. For possible values for Content, see ContentConstants.SEC_XXX. May benull- Parameters:
aggregateSecurity_- the aggregate security map- See Also:
-
getAggregateSecurity
Gets the aggregate security bitmap for the object. Only currently exists for Content. For possible values for Content, see ContentConstants.SEC_XXX. May benull- Returns:
- the aggregate security map
- See Also:
-
mergeWith
Merges this role map with the given new role map. Only the fieldsTYPE_USERandTYPE_GROUPare merged. All other fields are left unchanged. The following rules are used to merge the users and groups:- The merged role map should be the union of the existing and new role maps.
- When the same user/group is present in both the existing and new role maps, the role from the NEW role map should be used for the user/group.
- Parameters:
newRM- The new role map to merge with this (existing/old) role map.
-
getAllGroupIds
Returns all the group ids in this role map. -
getAllUsernames
Returns all the usernames in this role map. -
getRoles
Returns an array of Role objects for all the roles stored in this role map. -
setRoles
Removes any roles that are currently set and sets the roles to the given data. If the given array is null or empty the existing roles are cleared. The security vector (SECURITY_KEY) is not affected by this call.- Parameters:
roles- The roles data to set in the role map.
-
setRoles
Removes any roles that are currently set and sets the roles to the given data. If the given array is null or empty the existing roles are cleared. mimic the call with input as an array of Roles The security vector (SECURITY_KEY) is not affected by this call.- Parameters:
rolesSet- The set of roles data to set in the role map.
-
getRoleNames
-
removeAllRoles
protected void removeAllRoles() -
getRole
-
setRole
-