Class RuleEngineTemplate

java.lang.Object
com.aquima.interactions.test.templates.AbstractReportingTemplate
com.aquima.interactions.test.templates.rules.RuleEngineTemplate

public class RuleEngineTemplate extends AbstractReportingTemplate
Template that may be used to initialize a rule engine.
Since:
6.0
Author:
O. Kerpershoek
  • Constructor Details

    • RuleEngineTemplate

      public RuleEngineTemplate()
      Default constructor that generates a new initialization report.
    • RuleEngineTemplate

      public RuleEngineTemplate(com.aquima.interactions.foundation.report.IInitializationReport report, ConfigurationTemplate config)
      Constructs the template with the required parameters.
      Parameters:
      report - The initialization report that should be used to add errors and warnings to.
      config - Object containing configurable settings for the rule engine.
  • Method Details

    • doesAllowDowncast

      protected boolean doesAllowDowncast()
    • setAllowDowncast

      public void setAllowDowncast(boolean allowDowncast)
      This method may be used to specify if the rule engine should allow down-casting of rules.
      Parameters:
      allowDowncast - Boolean indicating if the rule engine should allow down-casting of rules.
    • getParserVersion

      protected String getParserVersion()
    • addConstraint

      public void addConstraint(com.aquima.interactions.rule.IConstraint rule)
      This method may be used to add a custom rule to the rule engine.
      Parameters:
      rule - The custom rule that should be added.
    • constraintRules

      protected Iterator<com.aquima.interactions.rule.IConstraint> constraintRules()
    • addValidationRule

      public void addValidationRule(com.aquima.interactions.rule.IValidationRule rule)
      This method may be used to add a custom rule to the rule engine.
      Parameters:
      rule - The custom rule that should be added.
    • addValidation

      public ValidationTemplate addValidation(String attribute, com.aquima.interactions.framework.validator.ValidatorType validationType, String message, boolean isWarning)
      Add a validation rule for an attribute.
      Parameters:
      attribute - The attribute's full name
      validationType - The validation type
      message - The validation message
      isWarning - Indicator if the validation message is a warning
      Returns:
      The created validation template.
    • addValidation

      public ValidationTemplate addValidation(String attribute, com.aquima.interactions.framework.validator.ValidatorType validationType, com.aquima.interactions.foundation.text.IMultilingualText message, boolean isWarning)
      Add a validation rule for an attribute.
      Parameters:
      attribute - The attribute's full name
      validationType - The validation type
      message - The validation message
      isWarning - Indicator if the validation message is a warning
      Returns:
      The created validation template.
      Since:
      8.4
    • addExpressionValidation

      public ValidationTemplate addExpressionValidation(String attribute, String expression, String message, boolean isWarning)
      Add an expression validation rule for an attribute.
      Parameters:
      attribute - The attribute's full name
      expression - The expression
      message - The validation message
      isWarning - Indicator if the validation message is a warning
      Returns:
      The created validation template.
    • addExpressionValidation

      public ValidationTemplate addExpressionValidation(String attribute, String expression, com.aquima.interactions.foundation.text.IMultilingualText message, boolean isWarning)
      Add an expression validation rule for an attribute.
      Parameters:
      attribute - The attribute's full name
      expression - The expression
      message - The validation message
      isWarning - Indicator if the validation message is a warning
      Returns:
      The created validation template.
      Since:
      8.4
    • getValidationRules

      protected Iterator<Object> getValidationRules()
    • addInferenceRule

      public void addInferenceRule(com.aquima.interactions.rule.IInferenceRule rule)
      This method may be used to add a custom rule to the rule engine.
      Parameters:
      rule - The custom rule that should be added.
    • addDecisionTable

      public DecisionTableTemplate addDecisionTable(String name)
      This method may be used to add a decision table to the rule engine.
      Parameters:
      name - The name of the decision table that should be added.
      Returns:
      A decision table template representing the table that was added.
    • addBusinessRule

      public void addBusinessRule(BusinessRuleTemplate businessRule)
      This method may be used to add a business rule to the rule engine.
      Parameters:
      businessRule - The decision table that should be added.
    • getInferenceRules

      protected Iterator<Object> getInferenceRules()
    • addAttributeDefault

      public DefaultRuleTemplate addAttributeDefault(String attributeName, com.aquima.interactions.foundation.IValue defaultValue)
      Add a default value for an attribute.
      Parameters:
      attributeName - Attribute full name: EntityName.AttributeName
      defaultValue - Value used as default.
      Returns:
      Template representing the default rule.
    • addAttributeDefault

      public DefaultRuleTemplate addAttributeDefault(String attributeName, String defaultExpression)
      Add a default expression for an attribute.
      Parameters:
      attributeName - Attribute full name: EntityName.AttributeName
      defaultExpression - Expression to be used as default.
      Returns:
      Template representing the default rule.
    • addAttributeDefault

      public DefaultRuleTemplate addAttributeDefault(String attributeName, DecisionTableTemplate defRule)
      Add a default decision table for an attribute.
      Parameters:
      attributeName - Attribute full name: EntityName.AttributeName
      defRule - The decision table to be used as default.
      Returns:
      Template representing the default rule.
    • getDefaults

      protected Iterator<DefaultRuleTemplate> getDefaults()
    • addRuleGroup

      public RuleGroupTemplate addRuleGroup(String name)
      This method may be used to add a rule group.
      Parameters:
      name - The name of the rule group that should be added.
      Returns:
      Template representing the newly added rule group.
    • getRuleGroups

      protected List<RuleGroupTemplate> getRuleGroups()
    • toDataSource

      public com.aquima.interactions.rule.ds.IRuleEngineDS toDataSource()
      This method converts the template to a data source that can be used to initialize a rule engine.
      Returns:
      a data source that can be used to initialize a rule engine.
    • getExpressionEngine

      public ExpressionEngineTemplate getExpressionEngine()
      This method returns the expression engine template which can be used to specify custom reusable expressions.
      Returns:
      the expression engine template which can be used to specify custom reusable expressions.
    • addCsvDataRule

      public DataRuleTemplate addCsvDataRule(String name, String csvConnectionName)
      This method adds a csv datarule to the rule engine.
      Parameters:
      name - The name of the rule.
      csvConnectionName - The name of the resource connection that should be used to get csv data.
      Returns:
      The added data rule template.
    • addDataRule

      public DataRuleTemplate addDataRule(String name)
      This method adds a datarule to the rule engine.
      Parameters:
      name - The name of the rule.
      Returns:
      The added data rule template.
    • getExternalSources

      protected Iterator<ExternalRuleTemplate> getExternalSources()
    • getExternalConstraints

      protected Iterator<ExternalRuleTemplate> getExternalConstraints()
    • addExternalSource

      public ExternalRuleTemplate addExternalSource(String attributeName)
    • addExternalConstaint

      public ExternalRuleTemplate addExternalConstaint(String attributeName)