Package org.openwms.core.uaa.impl
Class Role
java.lang.Object
org.ameba.integration.jpa.BaseEntity
org.ameba.integration.jpa.ApplicationEntity
org.openwms.core.uaa.impl.SecurityObject
org.openwms.core.uaa.impl.Role
- All Implemented Interfaces:
- Serializable,- org.ameba.integration.TypedEntity<Long>
A Role is a group of 
Users. Basically more than one User belong to a Role. Security access policies are assigned to Roles
 instead of Users.- Author:
- Heiko Scherrer
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA builder class to construct Role instances.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate Set<SecurityObject> AllSecurityObjects assigned to the Role.private BooleanWhether or not this Role is immutable.static final Stringstatic final StringThe default prefix String for each created Role.AllUsers assigned to the Role.Fields inherited from class org.ameba.integration.jpa.ApplicationEntityC_ID
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddGrant(SecurityObject grant) Add an existingSecurityObjectto the Role.voidaddGrants(Set<SecurityObject> grants) Add existingSecurityObjects to the Role.booleanAdd an existingUserto the Role.voidAdd existingUsers to the Role.booleanCompare the name.Return a Set of allSecurityObjects belonging to the Role.Get the immutable.getUsers()Return a Set of allUsers assigned to the Role.inthashCode()normalizeName(String name) booleanremoveGrant(SecurityObject grant) Add an existingSecurityObjectto the Role.booleanremoveGrants(List<? extends SecurityObject> grants) Add an existingSecurityObjectto the Role.voidremoveUser(User user) Remove aUserfrom the Role.voidsetGrants(Set<SecurityObject> grants) Set allSecurityObjects assigned to the Role.voidsetImmutable(Boolean immutable) Set the Role as immutable.protected voidvoidsetPersistentKey(String pKey) voidSet allUsers belonging to this Role.Methods inherited from class org.openwms.core.uaa.impl.SecurityObjectgetDescription, getName, setDescription, toStringMethods inherited from class org.ameba.integration.jpa.ApplicationEntitygetPersistentKey, hasPersistentKey, onEntityPersist, onPersistMethods inherited from class org.ameba.integration.jpa.BaseEntitygetCreatedBy, getCreateDt, getLastModifiedBy, getLastModifiedDt, getOl, getPk, isNew, setCreatedBy, setCreateDt, setLastModifiedBy, setLastModifiedDt, setOl
- 
Field Details- 
NOT_ALLOWED_TO_CREATE_A_ROLE_WITH_AN_EMPTY_NAME- See Also:
 
- 
immutableWhether or not this Role is immutable. Immutable Roles can't be modified.
- 
usersAllUsers assigned to the Role.
- 
grantsAllSecurityObjects assigned to the Role.
- 
ROLE_PREFIXThe default prefix String for each created Role. Name is "ROLE_" .- See Also:
 
 
- 
- 
Constructor Details- 
Roleprotected Role()Dear JPA...
- 
RoleCreate a new Role with a name.- Parameters:
- name- The name of the Role
- Throws:
- IllegalArgumentException- when name is null or empty
 
- 
RoleCreate a new Role with a name and a description.- Parameters:
- name- The name of the Role
- description- The description text of the Role
- Throws:
- IllegalArgumentException- when name is null or empty
 
 
- 
- 
Method Details- 
normalizeName
- 
setPersistentKey- Overrides:
- setPersistentKeyin class- SecurityObject
 
- 
setName- Overrides:
- setNamein class- SecurityObject
 
- 
getImmutableGet the immutable.- Returns:
- the immutable.
 
- 
setImmutableSet the Role as immutable.- Parameters:
- immutable-- trueif so
 
- 
getUsersReturn a Set of allUsers assigned to the Role.- Returns:
- A Set of all Users assigned to the Role
 
- 
addUserAdd an existingUserto the Role.- Parameters:
- user- The- Userto be added
- Returns:
- true if the Userwas new in the collection ofUsers, otherwise false
- Throws:
- IllegalArgumentException- if user is null
 
- 
addUsersAdd existingUsers to the Role.- Parameters:
- users- A Set of- Users to be added to the Role
- Throws:
- IllegalArgumentException- if grants is null
 
- 
removeUserRemove aUserfrom the Role.- Parameters:
- user- The- Userto be removed
- Throws:
- IllegalArgumentException- if user is null
 
- 
setUsersSet allUsers belonging to this Role.- Parameters:
- users- A Set of- Users to be assigned to the Role
- Throws:
- IllegalArgumentException- if users is null
 
- 
getGrantsReturn a Set of allSecurityObjects belonging to the Role.- Returns:
- A Set of all SecurityObjects belonging to this Role
 
- 
addGrantAdd an existingSecurityObjectto the Role.- Parameters:
- grant- The- SecurityObjectto be added to the Role.
- Returns:
- true if the SecurityObjectwas new to the collection ofSecurityObjects, otherwise false
- Throws:
- IllegalArgumentException- if grant is null
 
- 
addGrantsAdd existingSecurityObjects to the Role.- Parameters:
- grants- A Set of- SecurityObjects to be added to the Role
- Throws:
- IllegalArgumentException- if grants is null
 
- 
removeGrantAdd an existingSecurityObjectto the Role.- Parameters:
- grant- The- SecurityObjectto be added to the Role
- Returns:
- true if the SecurityObjectwas successfully removed from the Set ofSecurityObjects, otherwise false
- Throws:
- IllegalArgumentException- if grant is null
 
- 
removeGrantsAdd an existingSecurityObjectto the Role.- Parameters:
- grants- A list of- SecurityObjects to be removed from the Role
- Returns:
- true if the SecurityObjectwas successfully removed from the Set ofSecurityObjects, otherwise false
- Throws:
- IllegalArgumentException- if- grantsis null
 
- 
setGrantsSet allSecurityObjects assigned to the Role. Already existingSecurityObjects will be removed.- Parameters:
- grants- A Set of- SecurityObjects to be assigned to the Role
- Throws:
- IllegalArgumentException- if grants is null
 
- 
hashCodepublic int hashCode()Delegates to the superclass and uses the hashCode of the String ROLE for calculation. - Overrides:
- hashCodein class- SecurityObject
- See Also:
 
- 
equalsCompare the name.Does not delegate to the SecurityObject.equals(Object)and uses the name for comparison.- Overrides:
- equalsin class- SecurityObject
- See Also:
 
 
-