- Print
- DarkLight
Rule Design Guidelines Introduction
Introduction
This document contains instruction how to design java rules in Comflow.
General Rule design
Rules are the name for code that manages logic in the context of Comflow workflows and/or processes. They are supposed to manage the logic that is related to the context of the workflow or the process. Logic that relates to the data oriented logic shall be managed in services, which rules can call.
There are 3 different types of rules:
- Workflow - extends AbstractRuleExecute
- Process - extends AsynchRule
- Job scheduler - extends JobMonRule
Declare relations
All definitions or relations to other artifacts in Comflow shall be declared in the beginning in the Rule. This can be done as a local constant or, which is preferred, via an application constant class. For example you declare a datamodel as DM_1 = "DMItemList1" or a logical id as LI = "Status_10".
You shall do this for the following artifacts:
- Task
- Workflow
- Portlet
- Segment
- Tab
- Complex mode
- Simple model
- Logical id
The reason for this to simplify understanding of the relations for the rule, as well as supporting name changes of artifacts.
Workflow rule
Naming of rule and package
The package shall end with ".rule". The rule itself shall be named as the related portlet, possibly with some additional naming for the context, since a portlet can exist multiple times in one workflow or in multiple workflows.
Rule structure
The main methods shall extend the abstract one's, like protected boolean postDMProcOut() {...}.