Interface IValidationRule

All Superinterfaces:
IBusinessRule, Serializable
All Known Implementing Classes:
ExpressionValidator, FailedValidation, ValidationRuleBase, ValueValidator

public interface IValidationRule extends IBusinessRule
A validation is a business rule that can be used to determine whether an attribute value of an entity is valid.

The validation rules can be separated into two categories:

  • Simple validations
    These validations often perform some basic checking on the value to determine if the value could be valid, by for instance checking if the length of the value is within the specified range.
  • Business validations
    These validations often perform complex validation tasks using the context to determine if the value is valid.

An attribute containing a loan amount could for instance have a simple validation checking if the amount is grater then zero, and have a business validation checking if the amount is allowed given the customers income and assets.

Since:
5.0
Author:
O. Kerpershoek, F. v.d. Meer
  • Method Details

    • isWarning

      boolean isWarning()
      By default all validations are treated as an error when the validation does not succeed. This method may override that behavior by indicating that this validation should be treated as a warning when the validation fails.
      Returns:
      boolean indicating if a failure should be treated as warning.
    • getMessage

      IDynamicText getMessage()
      This method should return the message that explains why the validation fails. This message will be passed to the client after a validation action (in case the validation fails).
      Returns:
      Text object explaining the cause of the failure.
    • validateWith

      boolean validateWith(InferenceContext context)
      This method performs the actual validation, and returns a boolean indicating if the validation has succeeded. A return value of false means the object validated is not valid, where as a return value of true means that the object has passed the validation. This method is invoked after (all) the values have been updated in the profile.
      Parameters:
      context - InferenceContext
      Returns:
      boolean indicating if the validation was successful
      Throws:
      AppException - This exception is thrown when the validation could not be performed.
    • getPriority

      int getPriority()
      This method should return the priority of the validation rule. 0 is higher priority than 1 Rules with the highest priority will be evaluated first.
      Returns:
      The priority of the validation rule.