org.kuali.rice.krad.datadictionary.validation.constraint
Class WhenConstraint

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.validation.constraint.WhenConstraint
All Implemented Interfaces:
Serializable, Constraint

public class WhenConstraint
extends Object
implements Constraint

WhenConstraint is a child of a CaseConstraint

It provides a specific additional constraint that should be processed when the condition itself is true.

So a case constraint on country, might have a when constraint with value='USA', and another with value='Canada'. Each of these WhenConstraint's would define a constraint of their own that would only be processed when the country was USA, or when the country was Canada.

A WhenConstraint either specifies an attribute path whose value it then provides or a constraint. The parent @{CaseConstraint} is defined on the field on which the constraints are desired to take effect.

Since:
1.1
Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Field Summary
protected  Constraint constraint
           
protected  String valuePath
           
protected  List<Object> values
           
 
Constructor Summary
WhenConstraint()
           
 
Method Summary
 void completeValidation(ValidationTrace tracer)
          Validates different requirements of component compiling a series of reports detailing information on errors found in the component.
 Constraint getConstraint()
          The constraint to apply to the field when the WhenConstraint value/values match
 Object getValue()
          The value to check for this when constraint.
 String getValuePath()
          Path that can retrieve an attributes value
 List<Object> getValues()
          List of values to check for this constraint
 void setConstraint(Constraint constraint)
          setter for constraint
 void setValue(Object value)
          Sets a single value to check for this constraint.
 void setValuePath(String valuePath)
          setter for the value path
 void setValues(List<Object> values)
          setter for values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

protected List<Object> values

valuePath

protected String valuePath

constraint

protected Constraint constraint
Constructor Detail

WhenConstraint

public WhenConstraint()
Method Detail

getValues

public List<Object> getValues()
List of values to check for this constraint

Returns:
a list of values for which to activate the associated constraint

setValues

public void setValues(List<Object> values)
setter for values

Parameters:
values - - the values to set

getValue

public Object getValue()
The value to check for this when constraint. This is a convenience method that is the first value of the values array.

Returns:
the first value checking on, otherwise null

setValue

public void setValue(Object value)
Sets a single value to check for this constraint. This is a convenience method.

Parameters:
value - - a values for which to activate the associated constraint

getValuePath

public String getValuePath()
Path that can retrieve an attributes value

Returns:
a string representation of specifically which attribute (at some depth) is being accessed

setValuePath

public void setValuePath(String valuePath)
setter for the value path

Parameters:
valuePath - - the value path to set

getConstraint

public Constraint getConstraint()
The constraint to apply to the field when the WhenConstraint value/values match

Returns:
the constraint

setConstraint

public void setConstraint(Constraint constraint)
setter for constraint

Parameters:
constraint - - the constraint to set

completeValidation

public void completeValidation(ValidationTrace tracer)
Validates different requirements of component compiling a series of reports detailing information on errors found in the component. Used by the RiceDictionaryValidator.

Parameters:
tracer - Record of component's location


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.