This commit is contained in:
nheron 2025-05-30 11:39:57 +02:00
commit f592787ab7
29 changed files with 173 additions and 451 deletions

View file

@ -15,11 +15,15 @@
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<artifactId>drools-engine-classic</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
@ -45,11 +49,8 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<version>${maven.compiler.version}</version>
</plugin>
<plugin>
<groupId>org.kie</groupId>
@ -58,5 +59,6 @@
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="RuleFlow1" id="RF1" package-name="lesson4" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="62" y="79" width="80" height="40" />
<ruleSet id="2" name="Verify" x="162" y="77" width="80" height="40" ruleFlowGroup="Group1" />
<ruleSet id="3" name="Calculation" x="267" y="77" width="80" height="40" ruleFlowGroup="Group2" />
<end id="4" name="End" x="372" y="77" width="80" height="40" />
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="2" to="3" />
<connection from="3" to="4" />
</connections>
</process>

View file

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="RuleFlow3" id="RF3" package-name="lesson4a" >
<header>
<imports>
<import name="droolscours.Account" />
</imports>
</header>
<nodes>
<start id="1" name="Start" x="27" y="78" width="80" height="40" />
<ruleSet id="2" name="Calculate2" x="264" y="135" width="80" height="40" ruleFlowGroup="Group2" />
<ruleSet id="3" name="Calculate1" x="266" y="28" width="80" height="40" ruleFlowGroup="Group1" />
<end id="4" name="End" x="487" y="85" width="80" height="40" />
<join id="6" name="Join" x="357" y="91" width="80" height="40" type="2" />
<split id="7" name="Split" x="131" y="93" width="80" height="40" type="3" >
<constraints>
<constraint toNodeId="2" toType="DROOLS_DEFAULT" name="constraint" priority="1" type="rule" dialect="mvel" >Account(balance &lt;= 1000 )</constraint>
<constraint toNodeId="3" toType="DROOLS_DEFAULT" name="constraint" priority="1" type="rule" dialect="mvel" >Account(balance &gt; 1000 )</constraint>
</constraints>
</split>
</nodes>
<connections>
<connection from="7" to="2" />
<connection from="7" to="3" />
<connection from="6" to="4" />
<connection from="3" to="6" />
<connection from="2" to="6" />
<connection from="1" to="7" />
</connections>
</process>

View file

@ -12,11 +12,7 @@ import droolscours.util.OutputDisplay;
global OutputDisplay showResult;
rule "start process"
when
then
kcontext.getKieRuntime().startProcess("RF3");
end
rule "Account group1 4a"
ruleflow-group "Group1"

View file

@ -40,18 +40,8 @@ public class Testlesson4 {
Account a = new Account();
sessionStatefull.insert(a);
sessionStatefull.startProcess("RF1");
sessionStatefull.fireAllRules();
}
@Test
public void testRuleFlow2() {
sessionStatefull = KnowledgeSessionHelper
.getStatefulKnowledgeSessionForJBPM(kieContainer, "lesson4-session");
OutputDisplay display = new OutputDisplay();
sessionStatefull.setGlobal("showResult", display);
Account a = new Account();
sessionStatefull.insert(a);
sessionStatefull.fireAllRules();
}
@Test
public void testRuleFlow3() {
sessionStatefull = KnowledgeSessionHelper
@ -64,7 +54,7 @@ public class Testlesson4 {
AccountingPeriod period = new AccountingPeriod();
sessionStatefull.insert(period);
sessionStatefull.fireAllRules();
sessionStatefull.startProcess("RF3");
}