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

public class BaseConstraint extends DictionaryBeanBase 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:
  • Field Details

    • 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 Details

    • BaseConstraint

      public BaseConstraint()
  • Method Details

    • 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:

      • if NO states are defined for this constraint, this constraint is applied for ALL states
      • if a state is defined with a + symbol, example "state+", then this constraint will be applied for that state and ALL following states
      • if a state is defined as a range with ">", example "state1>state6", then this constraint will be applied for all states from state1 to state6

      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