If you are using Decision Manager in an embedded mode, you can transform a guided decision table into the DRL rules, for example:
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
import org.drools.workbench.models.guided.dtable.backend.GuidedDTDRLPersistence;
// imports unrelated to marshalling omitted
// class and methods omitted
GuidedDecisionTable52 unmarshal =
GuidedDTXMLPersistence.getInstance()
.unmarshal(new String(
Files.readAllBytes(Paths.get("src/main/resources/guidedTable.gdst"))
));
String drl = GuidedDTDRLPersistence.getInstance().marshal(unmarshal);
System.out.println(drl);
Input are placed in working memory and then remove Output are disregarded RuleSetNodeInstance
http://mswiderski.blogspot.it/2017/04/control-business-rules-execution-from.html
Using per process instance as runtime strategy, you will find the same kiesession through all the interaction with the process. This will ensure that the working memory follow the process instance life cycle. The working memory is saved and survive the server restart.
-
Define the Knowledge base
<kbase name="drlRules" equalsBehavior="equality" eventProcessingMode="cloud" default="true"> <ksession name="ksessionDrlRules" default="true" type="stateful" clockType="realtime" /> </kbase>
Some important dependencies:
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workbench-models-guided-dtable</artifactId>
</dependency>
It's a nice way to trigger process logic based on rule logic.
Unfortunately, there's no way to get the object that matched the rule:
Usual start node:
But for conditional start nodes, no input mappings are set, basically we're not calling addTriggerWithInputMapping here: