org.alfresco.repo.dictionary.constraint
Class AbstractConstraint

java.lang.Object
  extended by org.alfresco.repo.dictionary.constraint.AbstractConstraint
All Implemented Interfaces:
Constraint
Direct Known Subclasses:
AuthorityNameConstraint, ListOfValuesConstraint, NumericRangeConstraint, RegexConstraint, StringLengthConstraint, UserNameConstraint

public abstract class AbstractConstraint
extends java.lang.Object
implements Constraint

Base services for constraints.


Field Summary
static java.lang.String ERR_EVALUATE_EXCEPTION
           
static java.lang.String ERR_PROP_NOT_SET
           
 
Constructor Summary
AbstractConstraint()
           
 
Method Summary
protected  void checkPropertyNotNull(java.lang.String name, java.lang.Object value)
          Check that the given value is not null.
 void evaluate(java.lang.Object value)
          Evaluates a property value according to the implementation and initialization parameters provided.
protected  void evaluateCollection(java.util.Collection collection)
          Only override if there is some specific evaluation that needs to be performed on the collection as a whole.
protected abstract  void evaluateSingleValue(java.lang.Object value)
          Support for evaluation of properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.alfresco.service.cmr.dictionary.Constraint
initialize
 

Field Detail

ERR_PROP_NOT_SET

public static final java.lang.String ERR_PROP_NOT_SET
See Also:
Constant Field Values

ERR_EVALUATE_EXCEPTION

public static final java.lang.String ERR_EVALUATE_EXCEPTION
See Also:
Constant Field Values
Constructor Detail

AbstractConstraint

public AbstractConstraint()
Method Detail

checkPropertyNotNull

protected void checkPropertyNotNull(java.lang.String name,
                                    java.lang.Object value)
Check that the given value is not null.

Parameters:
name - the name of the property
value - the value to check for null
Throws:
DictionaryException - if the the property is null

evaluate

public final void evaluate(java.lang.Object value)
Description copied from interface: Constraint
Evaluates a property value according to the implementation and initialization parameters provided.

Specified by:
evaluate in interface Constraint
Parameters:
value - the property value to check
See Also:
AbstractConstraint.evaluateSingleValue(Object), AbstractConstraint.evaluateCollection(Collection)

evaluateCollection

protected void evaluateCollection(java.util.Collection collection)
Only override if there is some specific evaluation that needs to be performed on the collection as a whole.

Parameters:
collection - the collection of values to evaluate
See Also:
AbstractConstraint.evaluateSingleValue(Object)

evaluateSingleValue

protected abstract void evaluateSingleValue(java.lang.Object value)
Support for evaluation of properties. The value passed in will never be a Collection and will never be null.

Throws:
ConstraintException - throw this when the evaluation fails


Copyright © 2005 - 2008 Alfresco Software, Inc. All Rights Reserved.