Class FailedValidation
java.lang.Object
com.aquima.interactions.rule.report.FailedValidation
- All Implemented Interfaces:
IBusinessRule
,IValidationRule
,Serializable
The failed validation is a validation implementation that can be used to replace validations that were unable to
load. See ims issue AQU-2915 for more info.
- Since:
- 6.5
- Author:
- Jon van Leuven
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThis method should return the message that explains why the validation fails.getName()
This method returns the unique name for the business rule.int
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.String[]
This method returns an array containing the names of the rule groups this rule belongs to.String[]
This method should return a list of objects that are required to be in scope in order for the rule to operate successfully.String[]
This method should return an array of attribute names that the rule applies on.boolean
By default all validations are treated as an error when the validation does not succeed.boolean
validateWith
(InferenceContext context) This method performs the actual validation, and returns a boolean indicating if the validation has succeeded.static FailedValidation
validationFor
(IValidationDS source, String englishMessage) This method creates a FailedValidation rule for the provided data-source.static FailedValidation[]
validationsFor
(IValidationRule rule, String englishMessage) This method creates a FailedValidation rule for the provided rule.
-
Method Details
-
validationFor
This method creates a FailedValidation rule for the provided data-source. The FailedValidation rule is used instead of the original rule when the original rule could not be correctly initialized.- Parameters:
source
- The data-source providing the data of the failed rule.englishMessage
- The error message containing the cause of the rules rejection.- Returns:
- A rule representing the failed business rule.
-
validationsFor
This method creates a FailedValidation rule for the provided rule. The FailedValidation rule is used instead of the original rule when the original rule could not be correctly initialized.- Parameters:
rule
- The original rule providing the data of the failed rule.englishMessage
- The error message containing the cause of the rules rejection.- Returns:
- A rule representing the failed business rule.
-
getMessage
Description copied from interface:IValidationRule
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).- Specified by:
getMessage
in interfaceIValidationRule
- Returns:
- Text object explaining the cause of the failure.
-
getPriority
public int getPriority()Description copied from interface:IValidationRule
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.- Specified by:
getPriority
in interfaceIValidationRule
- Returns:
- The priority of the validation rule.
-
isWarning
public boolean isWarning()Description copied from interface:IValidationRule
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.- Specified by:
isWarning
in interfaceIValidationRule
- Returns:
- boolean indicating if a failure should be treated as warning.
-
validateWith
Description copied from interface:IValidationRule
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.- Specified by:
validateWith
in interfaceIValidationRule
- Parameters:
context
- InferenceContext- Returns:
- boolean indicating if the validation was successful
-
getName
Description copied from interface:IBusinessRule
This method returns the unique name for the business rule.- Specified by:
getName
in interfaceIBusinessRule
- Returns:
- the unique name for the business rule.
-
getSourceScopeObjects
Description copied from interface:IBusinessRule
This method should return a list of objects that are required to be in scope in order for the rule to operate successfully. There are three kinds of object references that a rule may require to be in scope:- Type reference
A type reference is declared by an entity name followed by an asterisk (*), for example Product*. Type references can be used when the rule uses information about the existence of instances of that type, for example when a rule contains COUNT( ALL Product ). - Named reference
A named reference is declared by an entity name followed by square brackets containing the name of the instance that is referred. Named references usually refer to static instances that are declared in the metamodel, for example Product[Unica] - Direct reference
A direct reference is declared by the entity name of the object that is referred to. A direct reference is a reference to an active object of the specified type. When a rule declares a direct reference, the object referred to must be of the same type of the object that the rule applies on. A business rule will be evaluated within its own context, and may thus not depend on active instances from other contexts like the current page. Only the object that triggered the rule will be available in the context. For example a rule calculating the age of a person by using the person.birth_date will declare a direct reference Person indicating that it depends on an instance of Person to be active.
- Specified by:
getSourceScopeObjects
in interfaceIBusinessRule
- Returns:
- An array which is never null but can be zero-length.
- Type reference
-
getTargetAttributes
Description copied from interface:IBusinessRule
This method should return an array of attribute names that the rule applies on. When this method returns multiple attribute names, all attributes in the array should belong to the same entity type.- Specified by:
getTargetAttributes
in interfaceIBusinessRule
- Returns:
- An array which is never null or zero-length.
-
getRuleGroupNames
Description copied from interface:IBusinessRule
This method returns an array containing the names of the rule groups this rule belongs to. If the rule does not belong to a specific rule group, the returned value may either be null or an empty array. Rules that belong to a rule group will only be evaluated when one (or more) of the rule groups are active. Rule groups are sometimes referred to as rule clusters.- Specified by:
getRuleGroupNames
in interfaceIBusinessRule
- Returns:
- an array containing the names of the rule groups this rule belongs to.
-