Class AbstractEntityConstraint

All Implemented Interfaces:
Constraint, EntityConstraint, EntityValue, Serializable
Direct Known Subclasses:
AndEntityConstraint, AttributeExistsConstraint, AttributeNameContainsConstraint, AttributeNameEqualsConstraint, AttributeStringMatchConstraint, BaseExistsConstraint, DateValueRangeConstraint, EntityEqualsConstraint, NameContainsConstraint, NameEqualsConstraint, NameEqualsIgnoringCaseConstraint, NotEntityConstraint, OrEntityConstraint, RecursiveOrEntityConstraint, StringValueContainsConstraint, StringValueMatchesConstraint, ValueClassIsConstraint, ValueEqualsConstraint, ValueInRangeConstraint

public abstract class AbstractEntityConstraint
extends Object
implements EntityConstraint

This class is an abstract EntityConstraint. It implements the EntityConstraint interface located in org.datamanager.constraint, and provides a public abstract describes() methods, which is exactly the same as the public abstract accepts() method in EntityConstraint. Every EntityConstraint should ideally extend this class instead of implementing EntityConstraint themselves. By doing so the constraint will gain extra power while working with Entities in the kernel. For example, a when a constraint is working on an Entity, calling methods such as getValue() and getAttributes(), it should not cause DataManagerEvents to be fired. If the constraint is a subclass of AbstractEntityConstraint then no events will be fired, otherwise events will. If a constraint has already been written to implement EntityConstraint it can easily be modified to use this class instead simply by changing implements EntityConstraint to extends AbstractEntityConstraint and renaming the accepts() method to describes().

Matthew Farrellee
See Also:
EntityConstraint, Entity, Serialized Form

Field Summary
Fields inherited from interface org.datamanager.constraint.EntityConstraint
Constructor Summary
Method Summary
 boolean accepts(Entity entity)
          The accepts() method is required by the EntityConstraint interface.
protected abstract  boolean describes(Entity entity)
          The method required by this class.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final String DEBUG_ACCEPTS_MESSAGE
See Also:
Constant Field Values
Constructor Detail


public AbstractEntityConstraint()
Method Detail


public final boolean accepts(Entity entity)
                      throws DataManagerException
The accepts() method is required by the EntityConstraint interface. AbstractEntityConstraint creates a final implementation of this method (no subclasses may override). Eventually this accepts() method calls the abstract describes() method that should be implemented by subclasses. Makes the DataManagerWorker thread invoking the accepts non-event generating for the duration of the describes() call.

Specified by:
accepts in interface EntityConstraint
entity - An entity to check.
Whether the entity is acceptable or not.


protected abstract boolean describes(Entity entity)
                              throws DataManagerException
The method required by this class. This method has the exact same semantics as the interface EntityConstraint's accepts() method.

entity - An entity to check.
Whether the entity is acceptable or not.

See the Helium Website