Rule Info Annotation
Author:
Fluent Commerce
Changed on:
22 Sept 2023
Overview
The `@RuleInfo`
Annotation describes the metadata for the . It is important to annotate the as accurately as possible.
The information in the Rule Info
Author:
Fluent Commerce
Changed on:
22 Sept 2023
Overview
The following steps breakdown how the rules should be annotated to make sure that the functions properly.
Key points
- The rule’s properties are used in the workflow, the WF orchestration modeller, and the rule library.
- The syntax in the previous entities needs to follow the methodology explained below.
- The
`@EventInfo`
Annotation describes the Event specific metadata for incoming/outgoing action events (rule info`accepts`
/`produces`
property respectively).
The information in the Info is used in the following ways:
- To validate the Rule for Workflow Execution.
- To provide data to display in the Workflow Orchestration Modeller and Rule Library.
The Info includes the following properties:
`name`
- this is the Rule name. Make sure your Rule Names are descriptive and specific to the intended logic and behavior of the rule.`description`
- this is a parameterized string used to describe the behavior of the Rule, as well as indicate what and how the Rule Parameters are used.`accepts`
- this is a list of`@EventInfo`
Annotations (see below) to describe the`entityType`
s for which this Rule will work on.`produces`
- this uses an`@EventInfo`
Annotation (see below) to describe the Event that the rule outputs.`exceptions`
- this is a list of`RuleExecutionException`
classes that this rule might throw. Make sure you read up on Exception Management for more info.
The description Property and the Modeller
The `description`
property is also used by the Modeller to display form fields for Parameter values. It is important that all parameters defined for the via the `@Param<Type>`
annotations are reflected in the description.
The syntax here is important. Wrap parameter names in curly braces `{`
and `}`
as shown below:
1@RuleInfo(
2 name = "ExampleRule"
3 , description = "This is the description of the Example Rule using parameter {ParamString1}"
4)
5@ParamString(name = "ParamString1", description = "Parameter String 1", defaultValue = "PS1")
6public class ExampleRule implements Rule {
7
8 // ...
9}
1@RuleInfo(
2 name = "ExampleRule"
3 , description = "This is the description of the Example Rule using parameter {" + MyRuleConstants.PARAM_STRING_1_NAME + "}"
4)
5@ParamString(name = MyRuleConstants.PARAM_STRING_1_NAME, description = "Parameter String 1", defaultValue = "PS1")
6public class ExampleRule implements Rule {
7
8 // ...
9}
This will render a form field for use within the Modeller:

The @EventInfo Annotation
The `@EventInfo`
Annotation describes the specific metadata applicable to either the incoming ( Info `accepts`
property) or the outgoing ( Info `produces`
property).
The Info includes the following properties:
`eventName`
- the Name of the Event produced by this Rule.`entityType`
- the Entity Type of the Events accepted by this Rule, or the Entity Type of the Event produced by this Rule.`entitySubType`
- the Sub Type of the Entity of the Event produced by this Rule.`status`
- the Status of the Entity of the Event produced by this Rule.
1 produces = {
2 @EventInfo(eventName = "{eventName}"
3 , entityType = EventInfoVariables.EVENT_TYPE
4 , entitySubtype = EventInfoVariables.EVENT_SUBTYPE
5 , status = EventInfoVariables.EVENT_STATUS
6 )