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

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.validation.constraint.BaseConstraint
All Implemented Interfaces:
Serializable, Constraint
Direct Known Subclasses:
CaseConstraint, MustOccurConstraint, PrerequisiteConstraint, SimpleConstraint, ValidCharactersConstraint

public class BaseConstraint
extends Object
implements Constraint

A class that implements the required accessor for label keys. This provides a convenient base class from which other constraints can be derived. Only BaseConstraints can have state validation. This class is a direct copy of one that was in Kuali Student.

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

Field Summary
protected  Boolean applyClientSide
           
protected  List<? extends BaseConstraint> constraintStateOverrides
           
protected  String messageComponentCode
           
protected  String messageKey
           
protected  String messageNamespaceCode
           
protected  List<String> states
           
protected  List<String> validationMessageParams
           
 
Constructor Summary
BaseConstraint()
           
 
Method Summary
 void completeValidation(ValidationTrace tracer)
          Validates different requirements of component compiling a series of reports detailing information on errors found in the component.
 Boolean getApplyClientSide()
          If this is true, the constraint should be applied on the client side when the user interacts with a field - if this constraint can be interpreted for client side use.
 List<? extends BaseConstraint> getConstraintStateOverrides()
          Get the list of constraintStateOverrides which represent constraints that will replace THIS constraint when their state is matched during validation.
 String getMessageComponentCode()
          A code within the namespace that identifies a component or group the constraint message is associated with
 String getMessageKey()
          A key that is used to retrieve the constraint message text (used with the namespace and component code if specified)
 String getMessageNamespaceCode()
          Namespace code (often an application or module code) the constraint failure message is associated with
 List<String> getStates()
          A list of states to apply this constraint for, this will effect when a constraint is applied.
 List<String> getValidationMessageParams()
          Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of the param
 String[] getValidationMessageParamsArray()
          Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of the param
 void setApplyClientSide(Boolean applyClientSide)
           
 void setConstraintStateOverrides(List<? extends BaseConstraint> constraintStateOverrides)
          Set the constraintStateOverrides to be used when a state is matched during validation
 void setMessageComponentCode(String messageComponentCode)
          Setter for the constraint message associated component code
 void setMessageKey(String messageKey)
          Setter for the constraint message key
 void setMessageNamespaceCode(String messageNamespaceCode)
          Setter for the constraint message associated namespace code
 void setStates(List<String> states)
          Set the states for this contraint to be applied on
 void setValidationMessageParams(List<String> validationMessageParams)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageNamespaceCode

protected String messageNamespaceCode

messageComponentCode

protected String messageComponentCode

messageKey

protected String messageKey

applyClientSide

protected Boolean applyClientSide

validationMessageParams

protected List<String> validationMessageParams

states

protected List<String> states

constraintStateOverrides

protected List<? extends BaseConstraint> constraintStateOverrides
Constructor Detail

BaseConstraint

public BaseConstraint()
Method Detail

getMessageNamespaceCode

public String getMessageNamespaceCode()
Namespace code (often an application or module code) the constraint failure message is associated with

Used with the component code and error key for retrieving the constraint. If null, the default namespace code will be used

Returns:
String constraint message namespace code

setMessageNamespaceCode

public void setMessageNamespaceCode(String messageNamespaceCode)
Setter for the constraint message associated namespace code

Parameters:
messageNamespaceCode -

getMessageComponentCode

public String getMessageComponentCode()
A code within the namespace that identifies a component or group the constraint message is associated with

Used with the namespace and error key for retrieving the constraint text. If null, the default component code will be used

Returns:
String message component code

setMessageComponentCode

public void setMessageComponentCode(String messageComponentCode)
Setter for the constraint message associated component code

Parameters:
messageComponentCode -

getMessageKey

public String getMessageKey()
A key that is used to retrieve the constraint message text (used with the namespace and component code if specified)

Returns:
String message key

setMessageKey

public void setMessageKey(String messageKey)
Setter for the constraint message key

Parameters:
messageKey -

getApplyClientSide

public Boolean getApplyClientSide()
If this is true, the constraint should be applied on the client side when the user interacts with a field - if this constraint can be interpreted for client side use. Default is true.

Returns:
the applyClientSide

setApplyClientSide

public void setApplyClientSide(Boolean applyClientSide)
Parameters:
applyClientSide - the applyClientSide to set

getValidationMessageParams

public List<String> getValidationMessageParams()
Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of the param

Returns:
the validationMessageParams

getValidationMessageParamsArray

public String[] getValidationMessageParamsArray()
Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of the param

Returns:
the validationMessageParams

setValidationMessageParams

public void setValidationMessageParams(List<String> validationMessageParams)
Parameters:
validationMessageParams - the validationMessageParams to set

getStates

public List<String> getStates()
A list of states to apply this constraint for, this will effect when a constraint is applied.

Each state this constraint is applied for needs to be declared with few additional options:

These can be mixed and matched, as appropriate, though states using a + symbol should always be the last item of a list (as they imply this state and everything else after).

Example state list may be: ["state1", "state3>state5", "state6+"]. In this example, note that this constraint is never applied to "state2" (assuming these example states represent a state order by number)

Returns:
the states to apply the constraint on, an empty list if the constraint is applied for all states

setStates

public void setStates(List<String> states)
Set the states for this contraint to be applied on

Parameters:
states -

getConstraintStateOverrides

public List<? extends BaseConstraint> getConstraintStateOverrides()
Get the list of constraintStateOverrides which represent constraints that will replace THIS constraint when their state is matched during validation. Because of this, constraints added to this list MUST have their states defined.

ConstraintStateOverrides always take precedence over this constraint if they apply to the state being evaluated during validation. These settings have no effect if there is no stateMapping represented on the entry/view being evaluated.

Returns:
List of constraint overrides for this constraint

setConstraintStateOverrides

public void setConstraintStateOverrides(List<? extends BaseConstraint> constraintStateOverrides)
Set the constraintStateOverrides to be used when a state is matched during validation

Parameters:
constraintStateOverrides -

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-2013 The Kuali Foundation. All Rights Reserved.