org.openpermis.policy.bean.basic
Class BasicTargetAccessRule

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.BasicTargetAccessRule
All Implemented Interfaces:
Serializable, PartBean, TargetAccessRuleBean, Part, TargetAccessRule

public class BasicTargetAccessRule
extends BasicPartBean
implements TargetAccessRuleBean

A target access rule defines a set of roles that are allowed to access a target.

See Also:
Serialized Form
Since:
0.1.0

Constructor Summary
protected BasicTargetAccessRule(SerialNumber serialNumber, TargetBeanCollection targets, Collection<Role> roles)
          Creates a target access rule.
protected BasicTargetAccessRule(SerialNumber serialNumber, TargetBeanCollection targets, Collection<Role> roles, Predicate condition, ObligationBeanCollection obligations)
          Creates a target access 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.
 AuthorizedRoles findAuthorizedRoleSet(URI resourceUri, String actionName, List<?> arguments, TimeStamp timeStamp)
          Returns an authorized role set containing the set of roles that are needed to execute an action on a target by this rule using the clock, and the obligations for this set of 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.
 Predicate getCondition()
          Returns the condition of this access rule.
 ObligationBeanCollection getObligations()
          Returns the obligations of this rule.
 RoleCollection getRoles()
          Returns the roles to which this rule grants access.
protected  String getSimpleClassName()
          Returns the simple implementation class name of this class.
 TargetBeanCollection getTargets()
          Returns the targets of this access rule.
 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 removeObligation(ObligationBean part)
          Removes a obligation child element.
 void removeTarget(TargetBean part)
          Removes a target child element.
 void setCondition(Predicate condition)
          Sets the condition of this access rule.
 void setObligations(ObligationBeanCollection obligations)
          Sets the obligations of this rule.
 void setRoles(RoleCollection roles)
          Sets the roles to which this rule grants access.
 void setTargets(TargetBeanCollection targets)
          Sets the targets of this access rule.
 
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

BasicTargetAccessRule

protected BasicTargetAccessRule(SerialNumber serialNumber,
                                TargetBeanCollection targets,
                                Collection<Role> roles)
Creates a target access rule.

Parameters:
serialNumber - the serial number of this part.
targets - a TargetBeanCollection to which this rule grants access.
roles - a Collection of Roles that are granted access.
Since:
0.1.0

BasicTargetAccessRule

protected BasicTargetAccessRule(SerialNumber serialNumber,
                                TargetBeanCollection targets,
                                Collection<Role> roles,
                                Predicate condition,
                                ObligationBeanCollection obligations)
Creates a target access rule.

Parameters:
serialNumber - the serial number of this part.
targets - a TargetBeanCollection to which this rule grants access.
roles - a Collection of Roles that are granted access.
condition - a Predicate of this rule.
obligations - an ObligationBeanCollection.
Since:
0.3.0
Method Detail

findAuthorizedRoleSet

public AuthorizedRoles findAuthorizedRoleSet(URI resourceUri,
                                             String actionName,
                                             List<?> arguments,
                                             TimeStamp timeStamp)
Description copied from interface: TargetAccessRule
Returns an authorized role set containing the set of roles that are needed to execute an action on a target by this rule using the clock, and the obligations for this set of roles.

Specified by:
findAuthorizedRoleSet in interface TargetAccessRule
Parameters:
resourceUri - an URI to identify a resource.
actionName - the name of an action.
arguments - an optional list of arguments for the action.
timeStamp - a TimeStamp to determine the temporal time context.
Returns:
an AuthorizedRoles containing the set of authorized roles and the set of obligations if exists, null otherwise.
Since:
0.3.0

getTargets

public TargetBeanCollection getTargets()
Description copied from interface: TargetAccessRuleBean
Returns the targets of this access rule.

Specified by:
getTargets in interface TargetAccessRuleBean
Returns:
the targets of this access rule.
Since:
0.3.0

setTargets

public void setTargets(TargetBeanCollection targets)
Description copied from interface: TargetAccessRuleBean
Sets the targets of this access rule.

Specified by:
setTargets in interface TargetAccessRuleBean
Parameters:
targets - the new targets of this access rule.
Since:
0.3.0

getCondition

public Predicate getCondition()
Description copied from interface: TargetAccessRuleBean
Returns the condition of this access rule.

Specified by:
getCondition in interface TargetAccessRuleBean
Returns:
a Predicate the condition of this access rule.
Since:
0.1.0

setCondition

public void setCondition(Predicate condition)
Description copied from interface: TargetAccessRuleBean
Sets the condition of this access rule.

Specified by:
setCondition in interface TargetAccessRuleBean
Parameters:
condition - a Predicate.
Since:
0.1.0

getRoles

public RoleCollection getRoles()
Description copied from interface: TargetAccessRuleBean
Returns the roles to which this rule grants access.

Specified by:
getRoles in interface TargetAccessRuleBean
Returns:
the roles to which this rule grants access.
Since:
0.1.0

setRoles

public void setRoles(RoleCollection roles)
Description copied from interface: TargetAccessRuleBean
Sets the roles to which this rule grants access.

Specified by:
setRoles in interface TargetAccessRuleBean
Parameters:
roles - the new roles to which this rule grants access.
Since:
0.1.0

getObligations

public ObligationBeanCollection getObligations()
Description copied from interface: TargetAccessRuleBean
Returns the obligations of this rule.

Specified by:
getObligations in interface TargetAccessRuleBean
Returns:
the obligations of this rule.
Since:
0.3.0

setObligations

public void setObligations(ObligationBeanCollection obligations)
Description copied from interface: TargetAccessRuleBean
Sets the obligations of this rule.

Specified by:
setObligations in interface TargetAccessRuleBean
Parameters:
obligations - the new obligations of this rule.
Since:
0.3.0

removeTarget

public void removeTarget(TargetBean part)
Removes a target child element.

Specified by:
removeTarget in interface TargetAccessRuleBean
Parameters:
part - a TargetBean.
Since:
0.1.0

removeObligation

public void removeObligation(ObligationBean part)
Removes a obligation child element.

Specified by:
removeObligation in interface TargetAccessRuleBean
Parameters:
part - a ObligationBean.
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