Creating a Source Rule Type

In this step of the Rule Engine trail, create a new source rule subtype.

Context

When you create condition and action definitions, you map them to a specific source rule type. The source rule type controls which conditions and actions you can use in a certain type of rule. In the Backoffice, when you create a new rule, the Rule Builder only displays the conditions and actions associated with that selected source rule type. This ensures that the correct conditions and actions are used to create that type of source rule.

Here, we define a new source rule type called CustomSourceRule.

Procedure

  1. Define the new source rule type in the ruleenginetrail-items.xml file, as shown:
    <itemtype code="CustomSourceRule"
       extends="SourceRule"
       jaloclass="de.hybris.platform.ruleenginetrail.jalo.PromotionSourceRule"
       autocreate="true" generate="true">
    </itemtype>
  2. Run ant clean all and confirm that the CustomSourceRuleModel class is generated.