Interface IInferenceRule

All Superinterfaces:
IBusinessRule, Serializable
All Known Implementing Classes:
BusinessRule, ConstraintDefault, ConversionRule, CsvDataRule, DecisionTableRule, DefaultExpression, DefaultValue, FailedRule, ReverseRelationRule

public interface IInferenceRule extends IBusinessRule
An inference rule is an object which can source values for the inference engine. In turn it can request for values which will be evaluated using the inferencecontext.
Since:
5.0
Author:
O. Kerpershoek, F. van der Meer
  • Method Details

    • getSourceType

      SourceType getSourceType()
      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.
      Returns:
      The source type of the inference rule.
    • evaluateUsing

      SourcedValue[] evaluateUsing(InferenceContext context, IRuleListener listener)
      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.
      Parameters:
      context - Mandatory inference context
      listener - the listener
      Returns:
      A sourced-value array which is never null but can be zero-length.
      Throws:
      RuleEngineException - This exception is thrown when the rule could not be evaluated.
    • getValueType

      ValueType getValueType(String attribute)
      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.
      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.
    • getJustificationTextId

      String getJustificationTextId(String attribute, String justificationId)
      This method returns the justification text id for the specified ID and format combination.
      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.