org.alfresco.repo.dictionary.constraint
Class ListOfValuesConstraint

java.lang.Object
  extended by org.alfresco.repo.dictionary.constraint.AbstractConstraint
      extended by org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint
All Implemented Interfaces:
Constraint

public class ListOfValuesConstraint
extends AbstractConstraint

Constraint implementation that ensures the value is one of a constrained list of values. By default, this constraint is case-sensitive.

See Also:
ListOfValuesConstraint.setAllowedValues(List), ListOfValuesConstraint.setCaseSensitive(boolean)

Field Summary
 
Fields inherited from class org.alfresco.repo.dictionary.constraint.AbstractConstraint
ERR_EVALUATE_EXCEPTION, ERR_PROP_NOT_SET
 
Constructor Summary
ListOfValuesConstraint()
           
 
Method Summary
protected  void evaluateSingleValue(java.lang.Object value)
          Support for evaluation of properties.
 java.util.List getAllowedValues()
          Get the allowed values.
 java.util.Map getParameters()
          Returns the parameters passed to the instance of the constraint.
 java.lang.String getType()
          Returns the 'type' of the constraint, this is the identifier given to constraint in the configuration.
 void initialize()
          Initializes the constraint with appropriate values, which will depend on the implementation itself.
 boolean isCaseSensitive()
           
 void setAllowedValues(java.util.List allowedValues)
          Set the values that are allowed by the constraint.
 void setCaseSensitive(boolean caseSensitive)
          Set the handling of case checking.
 java.lang.String toString()
           
 
Methods inherited from class org.alfresco.repo.dictionary.constraint.AbstractConstraint
checkPropertyNotNull, evaluate, evaluateCollection, getShortName, getTitle, set_shortName, setRegistry, setShortName, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListOfValuesConstraint

public ListOfValuesConstraint()
Method Detail

getType

public java.lang.String getType()
Returns the 'type' of the constraint, this is the identifier given to constraint in the configuration.

Specified by:
getType in interface Constraint
Overrides:
getType in class AbstractConstraint
Returns:
The type

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAllowedValues

public java.util.List getAllowedValues()
Get the allowed values. Note that these are String instances, but may represent non-String values. It is up to the caller to distinguish.

Returns:
Returns the values allowed

setAllowedValues

public void setAllowedValues(java.util.List allowedValues)
Set the values that are allowed by the constraint.

Parameters:
values - a list of allowed values

isCaseSensitive

public boolean isCaseSensitive()
Returns:
Returns true if this constraint is case-sensitive (default)

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Set the handling of case checking.

Parameters:
caseSensitive - true if the constraint is case-sensitive (default), or false for case-insensitive.

initialize

public void initialize()
Description copied from class: AbstractConstraint
Initializes the constraint with appropriate values, which will depend on the implementation itself. This method can be implemented as a once-off, i.e. reinitialization does not have to be supported.

Registers the constraint with the registry, if present. Call this method if you want the constraint to be auto-registered.

Specified by:
initialize in interface Constraint
Overrides:
initialize in class AbstractConstraint

getParameters

public java.util.Map getParameters()
Description copied from interface: Constraint
Returns the parameters passed to the instance of the constraint.

Specified by:
getParameters in interface Constraint
Overrides:
getParameters in class AbstractConstraint
Returns:
Map of parameters or an empty Map if none exist

evaluateSingleValue

protected void evaluateSingleValue(java.lang.Object value)
Description copied from class: AbstractConstraint
Support for evaluation of properties. The value passed in will never be a Collection and will never be null.

Specified by:
evaluateSingleValue in class AbstractConstraint


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