org.openpermis.policy.bean.basic
Class BasicTarget

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.BasicTarget
All Implemented Interfaces:
Serializable, PartBean, TargetBean, Part, Target

public class BasicTarget
extends BasicPartBean
implements TargetBean

A target combines a resource or a set of resources to be protected with a set of actions that are possible on these resources.

See Also:
Serialized Form
Since:
0.1.0

Constructor Summary
protected BasicTarget(SerialNumber serialNumber, DomainBean resourceDomain, ActionBeanCollection actions)
          Creates a new target.
 
Method Summary
 void accept(List<PartBean> parents, MultiPartBeanVisitor visitor)
          Allows traversing the model according to the visitor pattern.
protected  void appendPartDetails(StringBuilder sb)
          Appends the details of this extended part for the string representation of this part.
protected  boolean checkLocalConsistency(PartProblemReporter reporter)
          Checks if the extended state of this part is consistent.
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.
 Action findAction(URI resourceUri, String actionName, List<?> arguments)
          Returns the action which matches the given resource/action combination of this target, null if no such action exists.
 PartBean findBySerialNumber(SerialNumber partSerialNumber)
          Returns the part bean corresponding to the specified serial number.
 ActionBeanCollection getActions()
          Returns an ActionBeanCollection.
 DomainBean getResourceDomain()
          Returns the resource domain of the resources protected by this target.
protected  String getSimpleClassName()
          Returns the simple implementation class name of this class.
protected  int partHashCode()
          Returns the hash code of the extended part state.
 void removeChild(ActionBean part)
          Deprecated. 
 void setActions(ActionBeanCollection actions)
          Sets the action collection of actions which can be performed on this target.
 void setResourceDomain(DomainBean resourceDomain)
          Sets the resource domain of the resources protected by this target.
 
Methods inherited from class org.openpermis.policy.bean.basic.BasicPartBean
accept, addPropertyChangeListener, equalSerialNumber, firePropertyChange, getPartBeanType, getSerialNumber, getSerialNumberString, instanceOf, notifyIdentityChange, notifyNameChange, removePropertyChangeListener, toShortString
 
Methods inherited from class org.openpermis.policy.bean.basic.BasicPart
appendDetails, areIdentitiesUnique, areNamesUnique, checkLocalPartConsistency, equals, getIdentity, getName, hashCode, hasPartIdentity, hasPartName, isIdentityValid, isNameValid, 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.bean.PartBean
accept, addPropertyChangeListener, checkLocalPartConsistency, equalSerialNumber, getPartBeanType, getSerialNumber, instanceOf, removePropertyChangeListener, toShortString
 
Methods inherited from interface org.openpermis.policy.Part
equals, hashCode, toString
 

Constructor Detail

BasicTarget

protected BasicTarget(SerialNumber serialNumber,
                      DomainBean resourceDomain,
                      ActionBeanCollection actions)
Creates a new target.

Parameters:
serialNumber - the serial number of this part.
resourceDomain - the resource domain of the resources protected by this target.
actions - the action collection containing the actions which can be performed on the target.
Since:
0.3.0
Method Detail

findAction

public Action findAction(URI resourceUri,
                         String actionName,
                         List<?> arguments)
Description copied from interface: Target
Returns the action which matches the given resource/action combination of this target, null if no such action exists.

Specified by:
findAction in interface Target
Parameters:
resourceUri - the URI of the resource for which look in the resource domain.
actionName - the name of the action for which to look in this target.
arguments - an optional map of arguments to the action.
Returns:
the Action if exists, null otherwise.
Since:
0.1.0

getResourceDomain

public DomainBean getResourceDomain()
Description copied from interface: TargetBean
Returns the resource domain of the resources protected by this target.

Specified by:
getResourceDomain in interface TargetBean
Returns:
the resource domain of the resources protected by this target.
Since:
0.1.0

setResourceDomain

public void setResourceDomain(DomainBean resourceDomain)
Description copied from interface: TargetBean
Sets the resource domain of the resources protected by this target.

Specified by:
setResourceDomain in interface TargetBean
Parameters:
resourceDomain - the resource domain of the resources protected by this target.
Since:
0.1.0

getActions

public ActionBeanCollection getActions()
Description copied from interface: TargetBean
Returns an ActionBeanCollection.

Specified by:
getActions in interface TargetBean
Returns:
an ActionBeanCollection.
Since:
0.3.0

setActions

public void setActions(ActionBeanCollection actions)
Description copied from interface: TargetBean
Sets the action collection of actions which can be performed on this target.

Specified by:
setActions in interface TargetBean
Parameters:
actions - the action collection of actions which can be performed on this target.
Since:
0.3.0

removeChild

@Deprecated
public void removeChild(ActionBean part)
Deprecated. 

Remove a child element.

Specified by:
removeChild in interface TargetBean
Since:
0.1.0

accept

public void accept(List<PartBean> parents,
                   MultiPartBeanVisitor visitor)
Description copied from interface: PartBean
Allows traversing the model according to the visitor pattern. Visit may be called more than once on each part in the domain model, but it is called exactly once for each tuple (parent path, part).

Each part bean must call method visitor.visit(this)

Specified by:
accept in interface PartBean
Parameters:
parents - the path of parents of this part.
visitor - a PartBeanVisitor.
Since:
0.9.0

checkLocalConsistency

protected boolean checkLocalConsistency(PartProblemReporter reporter)
Description copied from class: BasicPart
Checks if the extended state of this part is consistent.

Overrides:
checkLocalConsistency in class BasicPart
Parameters:
reporter - the problem reporter to use, may be null.
Since:
0.9.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.
See Also:
BasicPart
Returns:
true if the part supplied is comparable to this part.
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.
See Also:
BasicUtilities.equalObjects(Object, Object), BasicPart
Returns:
true if the part supplied is considered equivalent to this part.
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
See Also:
BasicPart, BasicUtilities.multiHashCode(int...)
Returns:
the hash code of the extended part state.
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


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG