org.openpermis.policy.bean.basic
Class BasicAbstractCollection<P extends PartBean>

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.BasicAbstractCollection<P>
Type Parameters:
P - generic type.
All Implemented Interfaces:
Serializable, Iterable<P>, BeanCollection<P>, PartBean, Part
Direct Known Subclasses:
BasicActionCollection, BasicObligationCollection, BasicRoleAssignmentRuleCollection, BasicRoleHierarchyCollection, BasicTargetAccessRuleCollection, BasicTargetCollection

public abstract class BasicAbstractCollection<P extends PartBean>
extends BasicPartBean
implements BeanCollection<P>

Abstract basic collection.

See Also:
Serialized Form
Since:
0.3.0

Constructor Summary
protected BasicAbstractCollection(SerialNumber serialNumber)
           
protected BasicAbstractCollection(SerialNumber serialNumber, Collection<P> collection)
           
 
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 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.
protected  Collection<P> getCollection()
          Returns the internal collection.
protected abstract  boolean isCollectionType(BasicPart part)
          Returns true if collection type of part is an instance of this collection.
 Iterator<P> iterator()
          Returns an iterator for this collection.
protected  int partHashCode()
          Returns the hash code of the extended part state.
 List<P> toList()
          Returns a modifiable list of part beans.
 
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, checkLocalConsistency, checkLocalPartConsistency, equals, getIdentity, getName, getSimpleClassName, 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.BeanCollection
create
 
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

BasicAbstractCollection

protected BasicAbstractCollection(SerialNumber serialNumber)
Since:
0.3.0

BasicAbstractCollection

protected BasicAbstractCollection(SerialNumber serialNumber,
                                  Collection<P> collection)
Since:
0.3.0
Method Detail

getCollection

protected Collection<P> getCollection()
Returns the internal collection.

Returns:
the internal collection.
Since:
0.3.0

iterator

public Iterator<P> iterator()
Returns an iterator for this collection.

Specified by:
iterator in interface Iterable<P extends PartBean>
Specified by:
iterator in interface BeanCollection<P extends PartBean>
Returns:
an iterator for this collection.
Since:
0.3.0

toList

public List<P> toList()
Description copied from interface: BeanCollection
Returns a modifiable list of part beans. Changes in this list are not reflected in this collection.

Specified by:
toList in interface BeanCollection<P extends PartBean>
Returns:
a modifiable list of part beans.
Since:
0.3.0

isCollectionType

protected abstract boolean isCollectionType(BasicPart part)
Returns true if collection type of part is an instance of this collection.

Parameters:
part - a BasicPart.
Returns:
true if collection type of part is an instance of this collection.
Since:
0.3.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

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.3.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.3.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.3.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.3.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.3.0


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