|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.policy.bean.basic.BasicPart
org.openpermis.policy.bean.basic.BasicPartBean
org.openpermis.policy.bean.basic.BasicRoleHierarchy
public class BasicRoleHierarchy
A DAG of roles.
Nested Class Summary | |
---|---|
static class |
BasicRoleHierarchy.Direction
|
Constructor Summary | |
---|---|
protected |
BasicRoleHierarchy(SerialNumber serialNumber,
URI identity)
Creates a role hierarchy. |
Method Summary | |
---|---|
void |
addRole(String role)
Adds a new role in this role hierarchy, if not yet exists. |
void |
addRole(String role,
Set<String> parentRoles)
Adds a new role in this role hierarchy. |
void |
addRole(String role,
String parentRole)
Adds a new role in this role hierarchy. |
protected void |
appendPartDetails(StringBuilder sb)
Appends the details of this extended part for the string representation of this part. |
protected boolean |
comparablePart(BasicPart part)
Check if the part specified is comparable to this part. |
boolean |
connectRoles(String parentRole,
String childRole)
Convenience method: add an edge between two roles. |
boolean |
disconnectRoles(String parentRole,
String childRole)
Convenience method: remove an edge between two roles. |
PartBean |
findBySerialNumber(SerialNumber partSerialNumber)
Returns the part bean corresponding to the specified serial number. The basic implementation returns this bean if its serial number matches the one passed in or null if not. |
Set<String> |
getChildRoles(String role)
Returns a unmodifiable list of all children. |
Set<String> |
getLeafRoles()
Returns a list of all roles with no children. |
Set<String> |
getParentRoles(String role)
Returns a unmodifiable list of all parents. |
Set<String> |
getRoles()
Returns a unmodifiable list of all roles in this hierarchy. |
Set<String> |
getRootRoles()
Returns a list of all roles with no parents. |
protected String |
getSimpleClassName()
Returns the simple implementation class name of this class. |
Set<String> |
getSubRoles(String role)
Returns all sub roles of 'role' including 'role' itself. |
Set<String> |
getSuperRoles(String role)
Returns all superior roles of 'role' including 'role' itself. |
boolean |
isChildRole(String role,
String childRole)
Returns true if childRole is a child-role of role. |
boolean |
isLeafRole(String role)
Returns true if role is leaf, i.e. has no children. |
boolean |
isParentRole(String role,
String parentRole)
Returns true if parentRole is a parent-role of role. |
boolean |
isPartValid(PartProblemReporter reporter)
Checks if the extended state of this part is valid. |
boolean |
isRootRole(String role)
Returns true if role is root, i.e. has no parents. |
boolean |
isSubRole(String role,
String subRole)
Returns true if subRole is a sub-role of role. |
boolean |
isSuperRole(String role,
String superRole)
Returns true if superRole is a super-role of role. |
void |
removeRole(String role)
Removes a role from role hierarchy |
boolean |
renameRole(String role,
String newName)
Renames an existing role. |
boolean |
roleExists(String role)
Checks if a role exists in this role hierarchy. |
void |
setChildRoles(String role,
Set<String> childrenRoles)
Set new children roles of a role. |
void |
setParentRoles(String role,
Set<String> parentRoles)
Set new parent roles of a role. |
Methods inherited from class org.openpermis.policy.bean.basic.BasicPartBean |
---|
addPropertyChangeListener, equalSerialNumber, firePropertyChange, getPartBeanType, getSerialNumber, getSerialNumberString, notifyIdentityChange, notifyNameChange, removePropertyChangeListener, toShortString |
Methods inherited from class org.openpermis.policy.bean.basic.BasicPart |
---|
appendDetails, equalPart, equals, getIdentity, getName, hashCode, hasPartIdentity, hasPartName, isChildCollectionValid, isChildNotNull, isChildNullOrValid, isChildValid, isIdentityValid, isNameValid, isValid, partHashCode, reportProblem, setIdentity, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.openpermis.policy.Part |
---|
equals, hashCode, isValid, toString |
Methods inherited from interface org.openpermis.policy.Identifiable |
---|
getIdentity |
Methods inherited from interface org.openpermis.policy.bean.PartBean |
---|
addPropertyChangeListener, equalSerialNumber, getPartBeanType, getSerialNumber, removePropertyChangeListener, toShortString |
Methods inherited from interface org.openpermis.policy.Part |
---|
equals, hashCode, isValid, toString |
Methods inherited from interface org.openpermis.policy.bean.IdentifiableBean |
---|
setIdentity |
Methods inherited from interface org.openpermis.policy.Identifiable |
---|
getIdentity |
Constructor Detail |
---|
protected BasicRoleHierarchy(SerialNumber serialNumber, URI identity)
serialNumber
- the serial number of this part.Method Detail |
---|
public Set<String> getSuperRoles(String role)
getSuperRoles
in interface RoleHierarchy
role
- identifies a role in the hierarchy.
public Set<String> getSubRoles(String role)
getSubRoles
in interface RoleHierarchy
role
- identifies a role in the hierarchy.
public boolean roleExists(String role)
roleExists
in interface RoleHierarchyBean
role
- the role to search.
public Set<String> getRoles()
getRoles
in interface RoleHierarchyBean
public Set<String> getRootRoles()
getRootRoles
in interface RoleHierarchyBean
public Set<String> getLeafRoles()
getLeafRoles
in interface RoleHierarchyBean
public Set<String> getChildRoles(String role)
getChildRoles
in interface RoleHierarchyBean
public Set<String> getParentRoles(String role)
getParentRoles
in interface RoleHierarchyBean
public boolean isRootRole(String role)
isRootRole
in interface RoleHierarchyBean
role
- the role to check.
true
if found.public boolean isLeafRole(String role)
isLeafRole
in interface RoleHierarchyBean
role
- the role to check.
true
if found.public boolean isSubRole(String role, String subRole)
isSubRole
in interface RoleHierarchyBean
role
- the role to start search from.subRole
- the role to find.
true
if found.public boolean isSuperRole(String role, String superRole)
isSuperRole
in interface RoleHierarchyBean
role
- the role to start search from..superRole
- the role to find.
true
if found.public boolean isChildRole(String role, String childRole)
isChildRole
in interface RoleHierarchyBean
role
- the role to start search from..childRole
- the role to find.
true
if found.public boolean isParentRole(String role, String parentRole)
isParentRole
in interface RoleHierarchyBean
role
- the role to start search from..parentRole
- the role to find.
true
if found.public void setChildRoles(String role, Set<String> childrenRoles)
setChildRoles
in interface RoleHierarchyBean
role
- role to set children for.childrenRoles
- children roles to setpublic void setParentRoles(String role, Set<String> parentRoles)
setParentRoles
in interface RoleHierarchyBean
role
- role to set parents for.parentRoles
- parent roles to setpublic boolean connectRoles(String parentRole, String childRole)
connectRoles
in interface RoleHierarchyBean
parentRole
- parent role.childRole
- child role
true
if edge was addedpublic boolean disconnectRoles(String parentRole, String childRole)
disconnectRoles
in interface RoleHierarchyBean
parentRole
- parent role.childRole
- child role
true
if edge was removedpublic void addRole(String role)
addRole
in interface RoleHierarchyBean
role
- the new role to be added.public void addRole(String role, String parentRole)
addRole
in interface RoleHierarchyBean
role
- the new role to be added.parentRole
- the parent where the role is appended.public void addRole(String role, Set<String> parentRoles)
addRole
in interface RoleHierarchyBean
role
- the new role to be added.parentRoles
- the parents where the role is appended.public void removeRole(String role)
removeRole
in interface RoleHierarchyBean
role
- the role to be removed.public boolean renameRole(String role, String newName)
RoleHierarchyBean
The renamed role will keep its super and sub roles.
renameRole
in interface RoleHierarchyBean
role
- the role to be renamed.newName
- the new name for the role
true
if role was renamed.public PartBean findBySerialNumber(SerialNumber partSerialNumber)
BasicPartBean
If the part bean contains other part beans, it searches its child beans recursively.
The basic implementation returns this bean if its serial number matches
the one passed in or null
if not. Subclasses that contain other
parts must traverse their children.
findBySerialNumber
in interface PartBean
findBySerialNumber
in class BasicPartBean
partSerialNumber
- the SerialNumber
of the part bean to return.
PartBean
or null
if no
matching part bean is found.public boolean isPartValid(PartProblemReporter reporter)
BasicPart
isPartValid
in class BasicPart
reporter
- the problem reporter to use, may be null
.BasicPart
,
Part.isValid(PartProblemReporter)
,
BasicPart.reportProblem(org.openpermis.policy.PartProblemReporter, org.openpermis.policy.PartProblemReporter.ProblemMessage, java.lang.Object...)
protected boolean comparablePart(BasicPart part)
BasicPart
comparablePart
in class BasicPart
part
- the part to check.
true
if the part supplied is comparable to this part.BasicPart
protected String getSimpleClassName()
BasicPart
If your implementation represents an interface implementation return the interface
simple class name here. In short: return the instance you are checking against in
BasicPart.comparablePart(BasicPart)
.
getSimpleClassName
in class BasicPart
protected void appendPartDetails(StringBuilder sb)
BasicPart
appendPartDetails
in class BasicPart
sb
- the string builder to add the details to.BasicPart
,
BasicPart.appendDetails(StringBuilder, String, Object)
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:14:49
Copyright (c) 2002-2007 Ergon Informatik AG