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

Field Summary
private  List<P> collection
           
private static long serialVersionUID
           
 
Constructor Summary
protected BasicAbstractCollection(SerialNumber serialNumber)
           
protected BasicAbstractCollection(SerialNumber serialNumber, Collection<P> collection)
           
 
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.
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.
 boolean isPartValid(PartProblemReporter reporter)
          Checks if the extended state of this part is valid.
private  boolean isPartValid(PartProblemReporter reporter, boolean checkNotEmpty, boolean checkValid, boolean checkNameUniqueness, boolean checkObjectUniqueness, boolean checkIdentityUniqueness)
          Checks if a collection is set, elements are set and valid.
 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
addPropertyChangeListener, equalSerialNumber, firePropertyChange, getPartBeanType, getSerialNumber, getSerialNumberString, notifyIdentityChange, notifyNameChange, removePropertyChangeListener, toShortString
 
Methods inherited from class org.openpermis.policy.bean.basic.BasicPart
appendDetails, equals, getIdentity, getName, getSimpleClassName, 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.bean.BeanCollection
create
 
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
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Constant Field Value:
-5284544211072597574L
Since:
0.3.0

collection

private List<P extends PartBean> collection
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

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.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.
Returns:
true if the part supplied is considered equivalent to this part.
See Also:
BasicUtilities.equalObjects(Object, Object), BasicPart
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
Returns:
the hash code of the extended part state.
See Also:
BasicPart, BasicUtilities.multiHashCode(int...)
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

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

isPartValid

private boolean isPartValid(PartProblemReporter reporter,
                            boolean checkNotEmpty,
                            boolean checkValid,
                            boolean checkNameUniqueness,
                            boolean checkObjectUniqueness,
                            boolean checkIdentityUniqueness)
Checks if a collection is set, elements are set and valid.

Parameters:
reporter - reporter to use.
checkNotEmpty - check if collection is empty.
checkValid - check if collection's elements are valid.
checkNameUniqueness - check if collection's elements are name-unique.
Returns:
if all conditions are valid.
Since:
0.3.0


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