Conditions and Actions in Rule Compiler

Compilation is one of the most important parts in the process of creating rules. Once the user has created a rule in the Rule Builder, it is then compiled to the intermediate representation (IR). The compilation process relies on specific condition and action interfaces.

Condition Interfaces

RuleConditionsTranslator

The RuleConditionsTranslator is a helper interface that takes the list of RuleConditionData and validates or translates all of the items on the list.

RuleConditionTranslator

The RuleConditionTranslator interface is being called by the RuleConditionsTranslator. Different types of conditions have different implementations of the RuleConditionTranslator interface. The implementation of the interface translates a single condition to its intermediate representation by collecting and processing all the parameters provided by the user in the Rule Builder.

Action Interfaces

RuleActionsTranslator

The RuleActionsTranslator interface is a helper interface that takes the list of RuleActionData and validates or translates all of the items on the list.

RuleActionTranslator

The implementation of the RuleActionsTranslator interface translates a single action to its intermediate representation. The RuleExecutableActionTranslator, which is being used by all actions, is the only implementation of this interface. It creates a RuleIrExecutableAction and sets the <actionId> attribute and all the necessary parameters. The <actionId> parameter is a <beanId> of the specific action to be executed, for example, ruleTargetBundlePriceAction and rulePartnerOrderEntryFixedDiscountAction.