Fluent Commerce Logo
Docs

Rule Info Annotation

Topic

Author:

Fluent Commerce

Changed on:

22 Sept 2023

Overview

The `@RuleInfo` Annotation describes the metadata for the Rule. It is important to annotate the Rule 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 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 `@EventInfo` Annotation describes the Event specific metadata for incoming/outgoing action events (rule info `accepts`/`produces` property respectively).
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:
  • `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 rule 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:This will render a form field for use within the Modeller:No alt provided

The @EventInfo Annotation

The `@EventInfo` Annotation describes the Event specific metadata applicable to either the incoming event (Rule Info `accepts` property) or the outgoing action event (Rule Info `produces` property).The Event 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.
Fluent Commerce

Fluent Commerce