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
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from interface com.appiancorp.suiteapi.common.XMLable
DEFAULT_BUFFER_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addActorsToRole
(String role_, String type_, Long[] id_) Adds groups to the specified role.void
addActorsToRole
(String role_, String type_, String[] id_) Adds users to the specified role.void
clear()
Removes all roles and actors.boolean
Returns true if there are actors in any role of the role map.boolean
containsKey
(Object key_) Returns whether this role map contains the role specified.boolean
containsValue
(Object value_) Not implemented.entrySet()
Returns all of the entries in the role map.boolean
Compares 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 Role
protected 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.int
hashCode()
Returns a hash code for the role map.protected void
boolean
isEmpty()
Returns whether this role map contains no roles.keySet()
Returns all of the roles in the role map.void
Merges this role map with the given new role map.Returns the users and groups in the given role.void
Not supported.Remove all users and groups at the role.void
removeActorsFromRole
(String role_, String type_, Long[] id_) Removes groups from the specified role.void
removeActorsFromRole
(String role_, String type_, String[] id_) Removes users from the specified role.protected void
void
setActorsInRole
(String role_, String type_, Long[] id_) Sets the actors in the given role at the given type.void
setActorsInRole
(String role_, String type_, String[] id_) Sets the actors in the specified role.void
setAggregateSecurity
(Integer aggregateSecurity_) Sets the aggregate security bitmap for the object.protected void
void
Removes any roles that are currently set and sets the roles to the given data.void
setRoles
(Collection<? extends Role> rolesSet) Removes any roles that are currently set and sets the roles to the given data.void
setSecurity
(Integer security_) Sets the security bitmap for the object.int
size()
Returns the number of roles in the role map.toString()
toXML()
Converts this role map to xml and returns it as a string.void
toXML
(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, wait
Methods 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:
containsKey
in interfaceMap
- Parameters:
key_
- the role to check for- Returns:
true
if the map contains the specified role;false
otherwise
-
containsValue
Not implemented.- Specified by:
containsValue
in 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:
remove
in interfaceMap
- Parameters:
key_
- The key of the object to remove from the role map.- Returns:
- a
Map
with the previous users and groups in the role, where the keys are the types (TYPE_USER
orTYPE_GROUP
) and the values areArray
objects of usernames (String
s) and group IDs (Long
s) respectively.
-
putAll
Not supported.- Specified by:
putAll
in 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_USER
orTYPE_GROUP
- Returns:
- an
Array
of the actor IDs (String
for users,Long
for 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_GROUP
id_
- 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_USER
id_
- 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_GROUP
id_
- 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_USER
id_
- 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_GROUP
id_
- the group ids to remove
-
removeActorsFromRole
Removes users from the specified role.- Parameters:
role_
- the roletype_
- should always beTYPE_USER
id_
- 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_USER
andTYPE_GROUP
are 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
-