org.openpermis.policy.bean.basic
Class BasicRoleAssignmentRule

java.lang.Object
  extended by org.openpermis.policy.bean.basic.BasicPart
      extended by org.openpermis.policy.bean.basic.BasicPartBean
          extended by org.openpermis.policy.bean.basic.BasicRoleAssignmentRule
All Implemented Interfaces:
Serializable, PartBean, RoleAssignmentRuleBean, Part, RoleAssignmentRule

public class BasicRoleAssignmentRule
extends BasicPartBean
implements RoleAssignmentRuleBean

A rule for assigning roles to subjects.

See Also:
Serialized Form
Since:
0.1.0

Constructor Summary
protected BasicRoleAssignmentRule(SerialNumber serialNumber, AuthorityBean authority, DomainBean subjectDomain, Collection<Role> roles, TimePeriodConstraint constraint, int delegationDepth)
          Creates a role assignment rule.
 
Method Summary
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.
protected  boolean equalPart(BasicPart part)
          Compares another part to this part.
 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.
 AuthorityBean getAuthority()
          Returns the authorising subject of this rule.
 TimePeriodConstraint getConstraint()
          Returns the time constraint of this rule.
 int getDelegationDepth()
          Returns the delegation depth of this rule.
 RoleCollection getRoles()
          Returns the set of roles of this rule.
protected  String getSimpleClassName()
          Returns the simple implementation class name of this class.
 DomainBean getSubjectDomain()
          Returns the subject domain to which this rule applies.
 boolean isPartValid(PartProblemReporter reporter)
          Checks if the extended state of this part is valid.
protected  int partHashCode()
          Returns the hash code of the extended part state.
 void setAuthority(AuthorityBean authority)
          Sets the authorising subject of this rule.
 void setConstraint(TimePeriodConstraint constraint)
          Sets the time constraint of this rule.
 void setDelegationDepth(int delegationDepth)
          Sets the delegation depth of this rule.
 void setRoles(RoleCollection roles)
          Sets the roles of this rule.
 void setSubjectDomain(DomainBean subjectDomain)
          Sets the subject domain to which this rule applies.
 Set<Role> verifyRoleAssignment(Subject subject, Set<Role> assertedRoles, TimeStamp timeStamp)
          Verifies the assignment of the given roles to the given subject according to this rule, using the clock.
 
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, equals, getIdentity, getName, hashCode, hasPartIdentity, hasPartName, isChildCollectionValid, isChildNotNull, isChildNullOrValid, isChildValid, isIdentityValid, isNameValid, isValid, 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.bean.PartBean
addPropertyChangeListener, equalSerialNumber, getPartBeanType, getSerialNumber, removePropertyChangeListener, toShortString
 
Methods inherited from interface org.openpermis.policy.Part
equals, hashCode, isValid, toString
 

Constructor Detail

BasicRoleAssignmentRule

protected BasicRoleAssignmentRule(SerialNumber serialNumber,
                                  AuthorityBean authority,
                                  DomainBean subjectDomain,
                                  Collection<Role> roles,
                                  TimePeriodConstraint constraint,
                                  int delegationDepth)
Creates a role assignment rule.

Parameters:
serialNumber - the serial number of this part.
authority - the AuthorityBean authorizing the role assignment.
subjectDomain - the Domain to which the rule applies.
roles - the roles that subjects are allowed to assign.
delegationDepth - the delegation depth that applies.
Since:
0.1.0
Method Detail

verifyRoleAssignment

public Set<Role> verifyRoleAssignment(Subject subject,
                                      Set<Role> assertedRoles,
                                      TimeStamp timeStamp)
Description copied from interface: RoleAssignmentRule
Verifies the assignment of the given roles to the given subject according to this rule, using the clock.

Specified by:
verifyRoleAssignment in interface RoleAssignmentRule
Parameters:
subject - a Subject.
assertedRoles - a set of Roles.
timeStamp - a TimeStamp.
Returns:
the roles which are correctly assigned.
Since:
0.1.0

getAuthority

public AuthorityBean getAuthority()
Description copied from interface: RoleAssignmentRuleBean
Returns the authorising subject of this rule.

Specified by:
getAuthority in interface RoleAssignmentRuleBean
Returns:
the authorising AuthorityBean of this rule.
Since:
0.1.0

setAuthority

public void setAuthority(AuthorityBean authority)
Description copied from interface: RoleAssignmentRuleBean
Sets the authorising subject of this rule.

Specified by:
setAuthority in interface RoleAssignmentRuleBean
Parameters:
authority - the new authorising AuthorityBean of this rule.
Since:
0.1.0

getSubjectDomain

public DomainBean getSubjectDomain()
Description copied from interface: RoleAssignmentRuleBean
Returns the subject domain to which this rule applies.

Specified by:
getSubjectDomain in interface RoleAssignmentRuleBean
Returns:
the rule's DomainBean.
Since:
0.1.0

setSubjectDomain

public void setSubjectDomain(DomainBean subjectDomain)
Description copied from interface: RoleAssignmentRuleBean
Sets the subject domain to which this rule applies.

Specified by:
setSubjectDomain in interface RoleAssignmentRuleBean
Parameters:
subjectDomain - the rule's new DomainBean.
Since:
0.1.0

getDelegationDepth

public int getDelegationDepth()
Description copied from interface: RoleAssignmentRuleBean
Returns the delegation depth of this rule.

Specified by:
getDelegationDepth in interface RoleAssignmentRuleBean
Returns:
the rule's delegation depth, i.e. how far a subject is allowed to delegate its roles.
Since:
0.1.0

setDelegationDepth

public void setDelegationDepth(int delegationDepth)
Description copied from interface: RoleAssignmentRuleBean
Sets the delegation depth of this rule.

Specified by:
setDelegationDepth in interface RoleAssignmentRuleBean
Parameters:
delegationDepth - the rule's new depth.
Since:
0.1.0

getRoles

public RoleCollection getRoles()
Description copied from interface: RoleAssignmentRuleBean
Returns the set of roles of this rule.

Specified by:
getRoles in interface RoleAssignmentRuleBean
Returns:
the roles to which this rule applies.
Since:
0.1.0

setRoles

public void setRoles(RoleCollection roles)
Description copied from interface: RoleAssignmentRuleBean
Sets the roles of this rule.

Specified by:
setRoles in interface RoleAssignmentRuleBean
Parameters:
roles - the new roles of this rule.
Since:
0.1.0

getConstraint

public TimePeriodConstraint getConstraint()
Description copied from interface: RoleAssignmentRuleBean
Returns the time constraint of this rule.

Specified by:
getConstraint in interface RoleAssignmentRuleBean
Returns:
the time constraint of this rule.
Since:
0.3.0

setConstraint

public void setConstraint(TimePeriodConstraint constraint)
Description copied from interface: RoleAssignmentRuleBean
Sets the time constraint of this rule.

Specified by:
setConstraint in interface RoleAssignmentRuleBean
Parameters:
constraint - a TimePeriodConstraint.
Since:
0.3.0

isPartValid

public boolean isPartValid(PartProblemReporter reporter)
Description copied from class: BasicPart
Checks if the extended state of this part is valid.

Overrides:
isPartValid in class BasicPart
Parameters:
reporter - the problem reporter to use, may be null.
See Also:
BasicPart, Part.isValid(PartProblemReporter), BasicPart.reportProblem(org.openpermis.policy.PartProblemReporter, org.openpermis.policy.PartProblemReporter.ProblemMessage, java.lang.Object...)
Since:
0.1.0

comparablePart

protected boolean comparablePart(BasicPart part)
Description copied from class: BasicPart
Check if the part specified is comparable to this part.

Specified by:
comparablePart in class BasicPart
Parameters:
part - the part to check.
Returns:
true if the part supplied is comparable to this part.
See Also:
BasicPart
Since:
0.1.0

equalPart

protected boolean equalPart(BasicPart part)
Description copied from class: BasicPart
Compares another part to this part.

Overrides:
equalPart in class BasicPart
Parameters:
part - the part to compare to this part.
Returns:
true if the part supplied is considered equivalent to this part.
See Also:
BasicUtilities.equalObjects(Object, Object), BasicPart
Since:
0.1.0

partHashCode

protected int partHashCode()
Description copied from class: BasicPart
Returns the hash code of the extended part state.

Overrides:
partHashCode in class BasicPart
Returns:
the hash code of the extended part state.
See Also:
BasicPart, BasicUtilities.multiHashCode(int...)
Since:
0.1.0

getSimpleClassName

protected String getSimpleClassName()
Description copied from class: BasicPart
Returns the simple implementation class name of this class.

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).

Overrides:
getSimpleClassName in class BasicPart
Returns:
the simple implementation class name of this class.
Since:
0.1.0

appendPartDetails

protected void appendPartDetails(StringBuilder sb)
Description copied from class: BasicPart
Appends the details of this extended part for the string representation of this part.

Overrides:
appendPartDetails in class BasicPart
Parameters:
sb - the string builder to add the details to.
See Also:
BasicPart, BasicPart.appendDetails(StringBuilder, String, Object)
Since:
0.1.0

findBySerialNumber

public PartBean findBySerialNumber(SerialNumber partSerialNumber)
Description copied from class: BasicPartBean
Returns the part bean corresponding to the specified serial number.

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.

Specified by:
findBySerialNumber in interface PartBean
Overrides:
findBySerialNumber in class BasicPartBean
Parameters:
partSerialNumber - the SerialNumber of the part bean to return.
Returns:
the matching PartBean or null if no matching part bean is found.
Since:
0.1.0


PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:14:49
Copyright (c) 2002-2007 Ergon Informatik AG