Rule Info Annotation
Author:
Fluent Commerce
Changed on:
22 Sept 2023
Overview
The
`@RuleInfo`
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 workflow 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 Annotation describes the Event specific metadata for incoming/outgoing action events (rule info
`@EventInfo`
/`accepts`
property respectively).`produces`
The information in the Rule 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 Rule Info includes the following properties:
- - this is the Rule name. Make sure your Rule Names are descriptive and specific to the intended logic and behavior of the rule.
`name`
- - 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.
`description`
- - this is a list of
`accepts`
Annotations (see below) to describe the`@EventInfo`
s for which this Rule will work on.`entityType`
- - this uses an
`produces`
Annotation (see below) to describe the Event that the rule outputs.`@EventInfo`
- - this is a list of
`exceptions`
classes that this rule might throw. Make sure you read up on Exception Management for more info.`RuleExecutionException`
The description Property and the Modeller
The
`description`
`@Param<Type>`
The syntax here is important. Wrap parameter names in curly braces
`{`
`}`
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}
Language: java
Name: Syntax
Description:
[Warning: empty required content area]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}
Language: java
Name: Example
Description:
[Warning: empty required content area]This will render a form field for use within the Modeller:
The @EventInfo Annotation
The
`@EventInfo`
`accepts`
`produces`
The Event Info includes the following properties:
- - the Name of the Event produced by this Rule.
`eventName`
- - the Entity Type of the Events accepted by this Rule, or the Entity Type of the Event produced by this Rule.
`entityType`
- - the Sub Type of the Entity of the Event produced by this Rule.
`entitySubType`
- - the Status of the Entity of the Event produced by this Rule.
`status`
1 produces = {
2 @EventInfo(eventName = "{eventName}"
3 , entityType = EventInfoVariables.EVENT_TYPE
4 , entitySubtype = EventInfoVariables.EVENT_SUBTYPE
5 , status = EventInfoVariables.EVENT_STATUS
6 )
Language: java
Name: Example
Description:
[Warning: empty required content area]