Class FailedRule

java.lang.Object
com.aquima.interactions.rule.report.FailedRule
All Implemented Interfaces:
IBusinessRule, IInferenceRule, Serializable

public final class FailedRule extends Object implements IInferenceRule
The failed rule is a inference rule implementation that can be used to replace rules that were unable to load. See ims issue AQU-2915 for more info.
Since:
6.5
Author:
Jon van Leuven
See Also:
  • Method Details

    • rulesFor

      public static FailedRule[] rulesFor(IInferenceRule source, String englishMessage, IMetaModel mm)
      Create failed rules object based on an inference rule.
      Parameters:
      source - The inference rule.
      englishMessage - The error message.
      mm - The metamodel
      Returns:
      The failed rules, cannot be null, but can be an empty array.
    • rulesFor

      public static FailedRule[] rulesFor(IDecisionTableDS source, String englishMessage, IMetaModel mm)
      Create failed rules object based on a decision table.
      Parameters:
      source - The decision table.
      englishMessage - The error message.
      mm - The metamodel
      Returns:
      The failed rules, cannot be null, but can be an empty array.
    • ruleFor

      public static FailedRule ruleFor(IBusinessRuleDS source, String englishMessage, IMetaModel mm)
      Create a failed rules object based on a business rule.
      Parameters:
      source - The business rule.
      englishMessage - The error message.
      mm - The metamodel
      Returns:
      The failed rule, can be null.
    • ruleFor

      public static FailedRule ruleFor(IDefaultRuleDS defaultDS, String englishMessage, IMetaModel mm)
      Create a failed rules object based on a default rule.
      Parameters:
      defaultDS - The default rule.
      englishMessage - The error message.
      mm - The metamodel
      Returns:
      The failed rule, can be null.
    • evaluateUsing

      public SourcedValue[] evaluateUsing(InferenceContext context, IRuleListener listener)
      Description copied from interface: IInferenceRule
      Evaluates a rule using an inference context. The delivered sourced values are checked against the #getTargetAttributes and the inference engine will place these values in the profile.
      Specified by:
      evaluateUsing in interface IInferenceRule
      Parameters:
      context - Mandatory inference context
      listener - the listener
      Returns:
      A sourced-value array which is never null but can be zero-length.
    • getJustificationTextId

      public String getJustificationTextId(String attribute, String justificationId)
      Description copied from interface: IInferenceRule
      This method returns the justification text id for the specified ID and format combination.
      Specified by:
      getJustificationTextId in interface IInferenceRule
      Parameters:
      attribute - The name of the attribute for which the justification text is requested.
      justificationId - The ID of the justification.
      Returns:
      the justification text for the specified ID and format combination.
    • getSourceType

      public SourceType getSourceType()
      Description copied from interface: IInferenceRule
      This method should return the type of the inference rule. The source type of a rule will determine the order in which the rule is invoked when The two most common source types of inference rules are:
      • System - A system inference rule is a normal rule which can safely be cleared and evaluated over and over again.
      • Default - A default inference rule is a rule that should be used when no other rules can determine a value. Rules of this type will be evaluated after all other rules have been processed.
      Specified by:
      getSourceType in interface IInferenceRule
      Returns:
      The source type of the inference rule.
    • getValueType

      public ValueType getValueType(String attribute)
      Description copied from interface: IInferenceRule
      This method should return the type of the value that will be returned by this rule for the specified attribute. The type information is used during initialization to validate if the result of the rule is actually assignable to the target attribute, and during runtime to convert the value if needed.
      Specified by:
      getValueType in interface IInferenceRule
      Parameters:
      attribute - The attribute (short name, without the entity type) for which the type is requested.
      Returns:
      The type of the value this rule will return for the specified target attribute.
    • getName

      public String getName()
      Description copied from interface: IBusinessRule
      This method returns the unique name for the business rule.
      Specified by:
      getName in interface IBusinessRule
      Returns:
      the unique name for the business rule.
    • getSourceScopeObjects

      public String[] 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 interface IBusinessRule
      Returns:
      An array which is never null but can be zero-length.
    • getTargetAttributes

      public String[] 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 interface IBusinessRule
      Returns:
      An array which is never null or zero-length.
    • getRuleGroupNames

      public String[] 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 interface IBusinessRule
      Returns:
      an array containing the names of the rule groups this rule belongs to.