|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.BaseOpenmrsObject org.openmrs.BaseOpenmrsMetadata org.openmrs.Role
public class Role
A Role is just an aggregater of Privilege
s. User
s contain a number of roles
(Users DO NOT contain any privileges directly) Roles can be grouped by inheriting other roles. If
a user is given Role A that inherits from Role B, the user has all rights/abilities for both Role
A's privileges and for Role B's privileges.
Privilege
,
Serialized FormField Summary | |
---|---|
static long |
serialVersionUID
|
Constructor Summary | |
---|---|
Role()
default constructor |
|
Role(java.lang.String role)
constructor with id |
|
Role(java.lang.String role,
java.lang.String description)
constructor with all database required properties |
Method Summary | |
---|---|
void |
addPrivilege(Privilege privilege)
Adds the given Privilege to the list of privileges |
boolean |
equals(java.lang.Object obj)
|
java.util.Set<Role> |
getAllParentRoles()
Recursive (if need be) method to return all parent roles of this role |
java.lang.Integer |
getId()
|
java.util.Set<Role> |
getInheritedRoles()
|
java.util.Set<Privilege> |
getPrivileges()
|
java.lang.String |
getRole()
|
int |
hashCode()
|
boolean |
hasPrivilege(java.lang.String privilegeName)
Looks for the given privilegeName privilege name in this roles privileges. |
boolean |
inheritsRoles()
Convenience method to test whether or not this role extends/ inherits from any other roles |
java.util.Set<Role> |
recurseOverParents(java.util.Set<Role> children)
Returns the full set of roles be looping over inherited roles. |
void |
removePrivilege(Privilege privilege)
Removes the given Privilege from the list of privileges |
void |
setId(java.lang.Integer id)
|
void |
setInheritedRoles(java.util.Set<Role> inheritedRoles)
|
void |
setPrivileges(java.util.Set<Privilege> privileges)
|
void |
setRole(java.lang.String role)
|
java.lang.String |
toString()
|
Methods inherited from class org.openmrs.BaseOpenmrsMetadata |
---|
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateRetired, getDescription, getName, getRetired, getRetiredBy, getRetireReason, isRetired, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateRetired, setDescription, setName, setRetired, setRetiredBy, setRetireReason |
Methods inherited from class org.openmrs.BaseOpenmrsObject |
---|
getUuid, setUuid |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.openmrs.OpenmrsObject |
---|
getUuid, setUuid |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public Role()
public Role(java.lang.String role)
public Role(java.lang.String role, java.lang.String description)
Method Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.util.Set<Privilege> getPrivileges()
public void setPrivileges(java.util.Set<Privilege> privileges)
privileges
- The privileges to set.public void addPrivilege(Privilege privilege)
privilege
- Privilege to addpublic void removePrivilege(Privilege privilege)
privilege
- Privilege to removepublic java.lang.String getRole()
public void setRole(java.lang.String role)
role
- The role to set.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean hasPrivilege(java.lang.String privilegeName)
privilegeName
privilege name in this roles privileges. This
method does not recurse through the inherited roles
privilegeName
- String name of a privilege
public java.util.Set<Role> getInheritedRoles()
public void setInheritedRoles(java.util.Set<Role> inheritedRoles)
inheritedRoles
- The inheritedRoles to set.public boolean inheritsRoles()
public java.util.Set<Role> getAllParentRoles()
public java.util.Set<Role> recurseOverParents(java.util.Set<Role> children)
children
- Roles already looped over
public java.lang.Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(java.lang.Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |