Compare commits

..

3 commits

Author SHA1 Message Date
65b9eb8c86 Add bpmn2 file 2025-05-30 12:07:10 +02:00
f592787ab7 Upgrade 2025-05-30 11:39:57 +02:00
2c0a9867b9 WIP upgrade to kie 10 #1 2024-12-16 08:23:12 +01:00
42 changed files with 498 additions and 475 deletions

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.drools:drools-compiler:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-core-reflective:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-core:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-core-dynamic:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-project-datamodel-commons:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-project-datamodel-api:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-commons:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" />
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.4.4.Final" level="project" />
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.11.1" level="project" />
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:4.4.2" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-bpmn2:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-api:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-feel:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-model:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.antlr:antlr4-runtime:4.7.2" level="project" />
<orderEntry type="library" name="Maven: com.github.javaparser:javaparser-core:3.13.10" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-mvel-parser:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: ch.obermuhlner:big-math:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-core:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-dmn-backend:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-ruleunit:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-canonical-model:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-model-compiler:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.drools:drools-mvel-compiler:7.32.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jpmml:pmml-model:1.4.11" level="project" />
<orderEntry type="library" name="Maven: org.jpmml:pmml-agent:1.4.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.5" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.32.0.Final" level="project" />
</component>
</module>

View file

@ -18,11 +18,11 @@
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -40,12 +40,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>
</plugins>
</build>
</project>
</project>

View file

@ -11,7 +11,7 @@ public class KnowledgeSessionHelper {
public static KieContainer createRuleBase() {
KieServices ks = KieServices.Factory.get();
KieServices ks = KieServices.get();
KieContainer kieContainer = ks.getKieClasspathContainer();
return kieContainer;
}

View file

@ -17,11 +17,19 @@
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<groupId>org.drools</groupId>
<artifactId>drools-engine-classic</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<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>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -44,11 +52,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,4 +63,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson1" packages="lesson1">
<ksession name="lesson1-session"/>
</kbase>

View file

@ -15,14 +15,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -45,11 +49,7 @@
<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>
@ -59,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson2" packages="lesson2">
<ksession name="lesson2-session"/>
</kbase>

View file

@ -14,14 +14,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -44,11 +48,7 @@
<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,4 +58,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson31" packages="lesson31">
<ksession name="lesson31-session"/>

View file

@ -15,14 +15,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -45,11 +49,7 @@
<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>
@ -59,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson32" packages="lesson32">
<ksession name="lesson32-session"/>

View file

@ -15,14 +15,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -45,11 +49,7 @@
<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>
@ -59,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson33" packages="lesson33">
<ksession name="lesson33-session"/>

View file

@ -15,14 +15,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -45,11 +49,7 @@
<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>
@ -59,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson34" packages="lesson34">
<ksession name="lesson34-session"/>

View file

@ -37,5 +37,5 @@ rule "Numbers of CashFlow Line"
from collect( CashFlow( mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ) )
then
showResult.showText("Found "+$number+" more than 2 CashFlow Lines");
showResult.showText("Found "+$number+" CashFlow Lines");
end

View file

@ -15,14 +15,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -45,11 +49,7 @@
<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>
@ -59,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson35" packages="lesson35">
<ksession name="lesson35-session"/>

View file

@ -19,20 +19,16 @@ rule "Credit and Debit Rule"
when
$c : Account( $acc : accountno )
$p : AccountingPeriod ($sDate : startDate ,$eDate : endDate )
$totalCredit : Number( doubleValue > 100 )
from accumulate( CashFlow( type ==CashFlow.CREDIT,$value : amount, mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value))
$totalDebit : Number( doubleValue > 100 )
from accumulate( CashFlow( type ==CashFlow.DEBIT,$value : amount, mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
then
showResult.showText(" Found "+$totalCredit+" as a credit");
showResult.showText(" Found "+$totalDebit+" as a debit");
end
end

View file

@ -15,14 +15,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -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,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="lesson4" packages="lesson4">
<ksession name="lesson4-session"/>

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

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" xmlns:xsi="xsi" id="_44hPABkGED6e088-Qgncjg" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">
<bpmn2:itemDefinition id="__A1EE53C3-465C-4D64-AED9-F057A5E8C03C_fileNameInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__A1EE53C3-465C-4D64-AED9-F057A5E8C03C_namespaceInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__A1EE53C3-465C-4D64-AED9-F057A5E8C03C_modelInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__A1EE53C3-465C-4D64-AED9-F057A5E8C03C_decisionInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B_fileNameInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B_namespaceInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B_modelInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B_decisionInputXItem" structureRef="java.lang.String"/>
<bpmn2:collaboration id="_D8ACC8DE-0207-41A6-A3C6-D3DDBDEBDDF1" name="Default Collaboration">
<bpmn2:participant id="_CFFE2212-6219-48FB-BD86-2AF59F546E2D" name="Pool Participant" processRef="RF1"/>
</bpmn2:collaboration>
<bpmn2:process id="RF1" drools:packageName="lesson4" drools:version="1.0" drools:adHoc="false" name="ruleflow" isExecutable="true" processType="Public">
<bpmn2:sequenceFlow id="_FA27B45F-D9AC-4817-B28C-2385F2564E3C" sourceRef="_99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B" targetRef="_1EB8F09F-686A-4F8F-9D8D-20AC799A955F"/>
<bpmn2:sequenceFlow id="_12DEEA46-261A-4C1B-B106-F78CDFB6FD47" sourceRef="_A1EE53C3-465C-4D64-AED9-F057A5E8C03C" targetRef="_99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B"/>
<bpmn2:sequenceFlow id="_BD1BF859-A517-472D-8493-96842C33BE0F" sourceRef="_31D8796C-726D-4667-A93D-D4B1BFE1F392" targetRef="_A1EE53C3-465C-4D64-AED9-F057A5E8C03C"/>
<bpmn2:endEvent id="_1EB8F09F-686A-4F8F-9D8D-20AC799A955F">
<bpmn2:incoming>_FA27B45F-D9AC-4817-B28C-2385F2564E3C</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:businessRuleTask id="_99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B" drools:ruleFlowGroup="Group2" name="Group 2" implementation="http://www.jboss.org/drools/rule">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Group 2]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>_12DEEA46-261A-4C1B-B106-F78CDFB6FD47</bpmn2:incoming>
<bpmn2:outgoing>_FA27B45F-D9AC-4817-B28C-2385F2564E3C</bpmn2:outgoing>
</bpmn2:businessRuleTask>
<bpmn2:businessRuleTask id="_A1EE53C3-465C-4D64-AED9-F057A5E8C03C" drools:ruleFlowGroup="Group1" name="Group 1" implementation="http://www.jboss.org/drools/rule">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Group 1]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>_BD1BF859-A517-472D-8493-96842C33BE0F</bpmn2:incoming>
<bpmn2:outgoing>_12DEEA46-261A-4C1B-B106-F78CDFB6FD47</bpmn2:outgoing>
</bpmn2:businessRuleTask>
<bpmn2:startEvent id="_31D8796C-726D-4667-A93D-D4B1BFE1F392">
<bpmn2:outgoing>_BD1BF859-A517-472D-8493-96842C33BE0F</bpmn2:outgoing>
</bpmn2:startEvent>
</bpmn2:process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="RF1">
<bpmndi:BPMNShape id="shape__31D8796C-726D-4667-A93D-D4B1BFE1F392" bpmnElement="_31D8796C-726D-4667-A93D-D4B1BFE1F392">
<dc:Bounds height="56" width="56" x="338" y="135"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__A1EE53C3-465C-4D64-AED9-F057A5E8C03C" bpmnElement="_A1EE53C3-465C-4D64-AED9-F057A5E8C03C">
<dc:Bounds height="102" width="154" x="474" y="112"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B" bpmnElement="_99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B">
<dc:Bounds height="102" width="154" x="708" y="112"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__1EB8F09F-686A-4F8F-9D8D-20AC799A955F" bpmnElement="_1EB8F09F-686A-4F8F-9D8D-20AC799A955F">
<dc:Bounds height="56" width="56" x="942" y="135"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="edge_shape__31D8796C-726D-4667-A93D-D4B1BFE1F392_to_shape__A1EE53C3-465C-4D64-AED9-F057A5E8C03C" bpmnElement="_BD1BF859-A517-472D-8493-96842C33BE0F">
<di:waypoint x="366" y="163"/>
<di:waypoint x="551" y="163"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__A1EE53C3-465C-4D64-AED9-F057A5E8C03C_to_shape__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B" bpmnElement="_12DEEA46-261A-4C1B-B106-F78CDFB6FD47">
<di:waypoint x="551" y="163"/>
<di:waypoint x="785" y="163"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B_to_shape__1EB8F09F-686A-4F8F-9D8D-20AC799A955F" bpmnElement="_FA27B45F-D9AC-4817-B28C-2385F2564E3C">
<di:waypoint x="785" y="163"/>
<di:waypoint x="970" y="163"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmn2:relationship type="BPSimData">
<bpmn2:extensionElements>
<bpsim:BPSimData>
<bpsim:Scenario id="default" name="Simulationscenario">
<bpsim:ScenarioParameters/>
<bpsim:ElementParameters elementRef="_31D8796C-726D-4667-A93D-D4B1BFE1F392">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters elementRef="_A1EE53C3-465C-4D64-AED9-F057A5E8C03C">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ResourceParameters>
<bpsim:Availability>
<bpsim:FloatingParameter value="0"/>
</bpsim:Availability>
<bpsim:Quantity>
<bpsim:FloatingParameter value="0"/>
</bpsim:Quantity>
</bpsim:ResourceParameters>
<bpsim:CostParameters>
<bpsim:UnitCost>
<bpsim:FloatingParameter value="0"/>
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters elementRef="_99A7BBC9-FA5A-4EDC-BA6B-2758AE3A835B">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ResourceParameters>
<bpsim:Availability>
<bpsim:FloatingParameter value="0"/>
</bpsim:Availability>
<bpsim:Quantity>
<bpsim:FloatingParameter value="0"/>
</bpsim:Quantity>
</bpsim:ResourceParameters>
<bpsim:CostParameters>
<bpsim:UnitCost>
<bpsim:FloatingParameter value="0"/>
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
</bpsim:Scenario>
</bpsim:BPSimData>
</bpmn2:extensionElements>
<bpmn2:source>_44hPABkGED6e088-Qgncjg</bpmn2:source>
<bpmn2:target>_44hPABkGED6e088-Qgncjg</bpmn2:target>
</bpmn2:relationship>
</bpmn2:definitions>

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

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_fbfE0BnTED6d9Y-MwDhgFA" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">
<bpmn2:itemDefinition id="__826FB26E-4701-4734-8645-5D69B68BC063_fileNameInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__826FB26E-4701-4734-8645-5D69B68BC063_namespaceInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__826FB26E-4701-4734-8645-5D69B68BC063_modelInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__826FB26E-4701-4734-8645-5D69B68BC063_decisionInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__9B3CB050-252E-4D35-B135-DD4707F10F54_fileNameInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__9B3CB050-252E-4D35-B135-DD4707F10F54_namespaceInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__9B3CB050-252E-4D35-B135-DD4707F10F54_modelInputXItem" structureRef="java.lang.String"/>
<bpmn2:itemDefinition id="__9B3CB050-252E-4D35-B135-DD4707F10F54_decisionInputXItem" structureRef="java.lang.String"/>
<bpmn2:collaboration id="_91680BE0-9397-4248-B72E-84EF7D32DCE7" name="Default Collaboration">
<bpmn2:participant id="_B9A0E07F-B936-43F5-8144-E5D792D2D5F6" name="Pool Participant" processRef="RF3"/>
</bpmn2:collaboration>
<bpmn2:process id="RF3" drools:packageName="lesson4a" drools:version="1.0" drools:adHoc="false" name="ruleflow" isExecutable="true" processType="Public">
<bpmn2:sequenceFlow id="_B3A6DC5A-8001-4B99-A009-D734B804D45B" sourceRef="_E084D020-0791-4939-9A0C-ABD655646919" targetRef="_74780C45-15EF-493E-86F9-DFA144C3FC6F"/>
<bpmn2:sequenceFlow id="_1A2BF07C-3C78-49AF-8A11-51E7AC4177B7" sourceRef="_9B3CB050-252E-4D35-B135-DD4707F10F54" targetRef="_E084D020-0791-4939-9A0C-ABD655646919"/>
<bpmn2:sequenceFlow id="_45662642-8AB2-4570-8725-AEA60D98A089" sourceRef="_826FB26E-4701-4734-8645-5D69B68BC063" targetRef="_E084D020-0791-4939-9A0C-ABD655646919"/>
<bpmn2:sequenceFlow id="_9CC42995-5AB0-4A50-9F18-BB5541B55DF1" sourceRef="_ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB" targetRef="_9B3CB050-252E-4D35-B135-DD4707F10F54">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="http://www.jboss.org/drools/rule"><![CDATA[Account(balance < 1000)]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="_3471A19D-106C-454C-8955-E6F49BF41E56" sourceRef="_ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB" targetRef="_826FB26E-4701-4734-8645-5D69B68BC063">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="http://www.jboss.org/drools/rule"><![CDATA[Account(balance >= 1000)]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="_5360403B-B6A4-48D0-BA04-1E4EC95AA72D" sourceRef="_4A1B8AED-8EE7-4DDD-8B62-12223CFD1947" targetRef="_ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB">
<bpmn2:extensionElements>
<drools:metaData name="isAutoConnection.target">
<drools:metaValue><![CDATA[true]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
</bpmn2:sequenceFlow>
<bpmn2:endEvent id="_74780C45-15EF-493E-86F9-DFA144C3FC6F">
<bpmn2:incoming>_B3A6DC5A-8001-4B99-A009-D734B804D45B</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:exclusiveGateway id="_E084D020-0791-4939-9A0C-ABD655646919" gatewayDirection="Converging">
<bpmn2:incoming>_45662642-8AB2-4570-8725-AEA60D98A089</bpmn2:incoming>
<bpmn2:incoming>_1A2BF07C-3C78-49AF-8A11-51E7AC4177B7</bpmn2:incoming>
<bpmn2:outgoing>_B3A6DC5A-8001-4B99-A009-D734B804D45B</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:businessRuleTask id="_9B3CB050-252E-4D35-B135-DD4707F10F54" drools:ruleFlowGroup="Group2" name="Group 2" implementation="http://www.jboss.org/drools/rule">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Group 2]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>_9CC42995-5AB0-4A50-9F18-BB5541B55DF1</bpmn2:incoming>
<bpmn2:outgoing>_1A2BF07C-3C78-49AF-8A11-51E7AC4177B7</bpmn2:outgoing>
</bpmn2:businessRuleTask>
<bpmn2:businessRuleTask id="_826FB26E-4701-4734-8645-5D69B68BC063" drools:ruleFlowGroup="Group1" name="Group 1" implementation="http://www.jboss.org/drools/rule">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Group 1]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>_3471A19D-106C-454C-8955-E6F49BF41E56</bpmn2:incoming>
<bpmn2:outgoing>_45662642-8AB2-4570-8725-AEA60D98A089</bpmn2:outgoing>
</bpmn2:businessRuleTask>
<bpmn2:exclusiveGateway id="_ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB" gatewayDirection="Diverging">
<bpmn2:incoming>_5360403B-B6A4-48D0-BA04-1E4EC95AA72D</bpmn2:incoming>
<bpmn2:outgoing>_3471A19D-106C-454C-8955-E6F49BF41E56</bpmn2:outgoing>
<bpmn2:outgoing>_9CC42995-5AB0-4A50-9F18-BB5541B55DF1</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:startEvent id="_4A1B8AED-8EE7-4DDD-8B62-12223CFD1947">
<bpmn2:outgoing>_5360403B-B6A4-48D0-BA04-1E4EC95AA72D</bpmn2:outgoing>
</bpmn2:startEvent>
</bpmn2:process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="RF3">
<bpmndi:BPMNShape id="shape__4A1B8AED-8EE7-4DDD-8B62-12223CFD1947" bpmnElement="_4A1B8AED-8EE7-4DDD-8B62-12223CFD1947">
<dc:Bounds height="56" width="56" x="295" y="140"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB" bpmnElement="_ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB">
<dc:Bounds height="56" width="56" x="443" y="140"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__826FB26E-4701-4734-8645-5D69B68BC063" bpmnElement="_826FB26E-4701-4734-8645-5D69B68BC063">
<dc:Bounds height="102" width="154" x="578" y="61"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__9B3CB050-252E-4D35-B135-DD4707F10F54" bpmnElement="_9B3CB050-252E-4D35-B135-DD4707F10F54">
<dc:Bounds height="102" width="154" x="579" y="203"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__E084D020-0791-4939-9A0C-ABD655646919" bpmnElement="_E084D020-0791-4939-9A0C-ABD655646919">
<dc:Bounds height="56" width="56" x="819" y="159"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape__74780C45-15EF-493E-86F9-DFA144C3FC6F" bpmnElement="_74780C45-15EF-493E-86F9-DFA144C3FC6F">
<dc:Bounds height="56" width="56" x="955" y="159"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="edge_shape__4A1B8AED-8EE7-4DDD-8B62-12223CFD1947_to_shape__ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB" bpmnElement="_5360403B-B6A4-48D0-BA04-1E4EC95AA72D">
<di:waypoint x="323" y="168"/>
<di:waypoint x="443" y="168"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB_to_shape__826FB26E-4701-4734-8645-5D69B68BC063" bpmnElement="_3471A19D-106C-454C-8955-E6F49BF41E56">
<di:waypoint x="471" y="140"/>
<di:waypoint x="535" y="125"/>
<di:waypoint x="548" y="125"/>
<di:waypoint x="578" y="112"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__ECC45ABE-D31A-41F7-A7DF-C158ACF28EDB_to_shape__9B3CB050-252E-4D35-B135-DD4707F10F54" bpmnElement="_9CC42995-5AB0-4A50-9F18-BB5541B55DF1">
<di:waypoint x="471" y="196"/>
<di:waypoint x="579" y="254"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__826FB26E-4701-4734-8645-5D69B68BC063_to_shape__E084D020-0791-4939-9A0C-ABD655646919" bpmnElement="_45662642-8AB2-4570-8725-AEA60D98A089">
<di:waypoint x="655" y="112"/>
<di:waypoint x="847" y="159"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__9B3CB050-252E-4D35-B135-DD4707F10F54_to_shape__E084D020-0791-4939-9A0C-ABD655646919" bpmnElement="_1A2BF07C-3C78-49AF-8A11-51E7AC4177B7">
<di:waypoint x="656" y="254"/>
<di:waypoint x="847" y="215"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge_shape__E084D020-0791-4939-9A0C-ABD655646919_to_shape__74780C45-15EF-493E-86F9-DFA144C3FC6F" bpmnElement="_B3A6DC5A-8001-4B99-A009-D734B804D45B">
<di:waypoint x="875" y="187"/>
<di:waypoint x="955" y="187"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmn2:relationship type="BPSimData">
<bpmn2:extensionElements>
<bpsim:BPSimData>
<bpsim:Scenario id="default" name="Simulationscenario">
<bpsim:ScenarioParameters/>
<bpsim:ElementParameters elementRef="_4A1B8AED-8EE7-4DDD-8B62-12223CFD1947">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters elementRef="_826FB26E-4701-4734-8645-5D69B68BC063">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ResourceParameters>
<bpsim:Availability>
<bpsim:FloatingParameter value="0"/>
</bpsim:Availability>
<bpsim:Quantity>
<bpsim:FloatingParameter value="0"/>
</bpsim:Quantity>
</bpsim:ResourceParameters>
<bpsim:CostParameters>
<bpsim:UnitCost>
<bpsim:FloatingParameter value="0"/>
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
<bpsim:ElementParameters elementRef="_9B3CB050-252E-4D35-B135-DD4707F10F54">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0"/>
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ResourceParameters>
<bpsim:Availability>
<bpsim:FloatingParameter value="0"/>
</bpsim:Availability>
<bpsim:Quantity>
<bpsim:FloatingParameter value="0"/>
</bpsim:Quantity>
</bpsim:ResourceParameters>
<bpsim:CostParameters>
<bpsim:UnitCost>
<bpsim:FloatingParameter value="0"/>
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
</bpsim:Scenario>
</bpsim:BPSimData>
</bpmn2:extensionElements>
<bpmn2:source>_fbfE0BnTED6d9Y-MwDhgFA</bpmn2:source>
<bpmn2:target>_fbfE0BnTED6d9Y-MwDhgFA</bpmn2:target>
</bpmn2:relationship>
</bpmn2:definitions>

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");
}

View file

@ -11,6 +11,7 @@
<packaging>pom</packaging>
<description>Accounting project</description>
<modules>
<module>drools-lesson4</module>
<module>drools-lesson1</module>
<module>drools-lesson2</module>
<module>drools-lesson31</module>
@ -18,70 +19,7 @@
<module>drools-lesson33</module>
<module>drools-lesson34</module>
<module>drools-lesson35</module>
<module>drools-lesson4</module>
<module>drools-lesson-pojo</module>
</modules>
<build>
<plugins>
<!--plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin-->
<!--plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin-->
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
</dependencies>
</project>
</project>

View file

@ -14,14 +14,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -44,11 +48,7 @@
<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,4 +58,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="kbase-base" packages="rules">
</kbase>

View file

@ -22,45 +22,27 @@ ruleflow-group "total"
$totalBoatTransport : Number( doubleValue > 100 )
from accumulate( $s : Step(transportType ==Step.Ship_TransportType) &&
TransportCostElement(step ==$s, $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value))
$totalTrainTransport : Number( doubleValue > 100 )
from accumulate( $s : Step(transportType ==Step.train_TransportType) &&
TransportCostElement(step ==$s, $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalTruckTransport : Number( doubleValue > 100 )
from accumulate( $s : Step(transportType ==Step.truck_TransportType) &&
TransportCostElement(step ==$s, $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalTransport : Number( doubleValue > 100 )
from accumulate( TransportCostElement( $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalTaxes : Number( doubleValue > 100 )
from accumulate( TaxesCostElement( $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value))
$totalHandling : Number( doubleValue > 100 )
from accumulate( HandlingCostElement( $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
then
System.out.println("NumberOfPallets="+$c.getPallets().size());
System.out.println("TotalShipTransport="+$totalBoatTransport);
@ -69,4 +51,4 @@ ruleflow-group "total"
System.out.println("TotalTransport="+$totalTransport);
System.out.println("TotalTaxes="+$totalTaxes);
System.out.println("TotalHandling="+$totalHandling);
end;
end;

View file

@ -19,14 +19,18 @@
</dependency>
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -49,11 +53,7 @@
<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>
@ -63,4 +63,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase name="kbase-extension" packages="rulesextension" includes="kbase-base">
<ksession name="session-extension"/>
</kbase>

View file

@ -15,17 +15,22 @@
<dependency>
<groupId>org.kiegroup</groupId>
<artifactId>cost-calculation-extension</artifactId>
<version>${project.version}</version>
</dependency>
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -48,12 +53,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>
</plugins>
</build>
</project>
</project>

View file

@ -84,12 +84,12 @@ public class TestExecercice {
this.insertIntoSession(sessionStatefull, request);
sessionStatefull.startProcess("P1");
int i = sessionStatefull.fireAllRules();
// int i = sessionStatefull.fireAllRules();
long after = System.currentTimeMillis();
System.out.println("NumberRules Executed " + i);
// System.out.println("NumberRules Executed " + i);
System.out.println("Rules executed in " + (after - before) + " ms");
Double dd = new Double(i) / (after - before) * 1000;
System.out.println("NbreRules/seconde=" + dd);
// Double dd = new Double(i) / (after - before) * 1000;
//System.out.println("NbreRules/seconde=" + dd);
}

View file

@ -14,14 +14,18 @@
<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.jbpm</groupId>
<groupId>org.drools</groupId>
<artifactId>drools-ecj</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<dependency>
@ -44,11 +48,7 @@
<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,4 +58,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules" packages="rules">
<kmodule xmlns="http://www.drools.org/xsd/kmodule">
<kbase packages="rules">
<ksession name="ksession-rules"/>
</kbase>

View file

@ -121,10 +121,10 @@ end
rule "GetSmallestHeight"
ruleflow-group "distribution"
when
accumulate( Product( $h : height ,transportType==Product.transportType_pallet );
$min : min( $h );
true )
when
$min : Number( )
from accumulate( Product( $h : height ,transportType==Product.transportType_pallet);
min( $h ))
then
CalculatedElement elt = new CalculatedElement();

View file

@ -22,45 +22,24 @@ ruleflow-group "total"
$totalBoatTransport : Number( doubleValue > 100 )
from accumulate( $s : Step(transportType ==Step.Ship_TransportType) &&
TransportCostElement(step ==$s, $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalTrainTransport : Number( doubleValue > 100 )
from accumulate( $s : Step(transportType ==Step.train_TransportType) &&
TransportCostElement(step ==$s, $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalTruckTransport : Number( doubleValue > 100 )
from accumulate( $s : Step(transportType ==Step.truck_TransportType) &&
TransportCostElement(step ==$s, $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalTransport : Number( doubleValue > 100 )
from accumulate( TransportCostElement( $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value))
$totalTaxes : Number( doubleValue > 100 )
from accumulate( TaxesCostElement( $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value) )
$totalHandling : Number( doubleValue > 100 )
from accumulate( HandlingCostElement( $value : amount ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
sum($value))
then
System.out.println("NumberOfPallets="+$c.getPallets().size());
System.out.println("TotalShipTransport="+$totalBoatTransport);
@ -69,4 +48,4 @@ ruleflow-group "total"
System.out.println("TotalTransport="+$totalTransport);
System.out.println("TotalTaxes="+$totalTaxes);
System.out.println("TotalHandling="+$totalHandling);
end;
end;

View file

@ -8,6 +8,7 @@ import org.junit.Test;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.StatelessKieSession;
import org.kie.api.runtime.process.ProcessInstance;
import util.KnowledgeSessionHelper;
@SuppressWarnings("restriction")
@ -83,13 +84,13 @@ public class TestExecercice {
long before = System.currentTimeMillis();
this.insertIntoSession(sessionStatefull, request);
sessionStatefull.startProcess("P1");
int i = sessionStatefull.fireAllRules();
ProcessInstance processInstance = sessionStatefull.startProcess("P1");
long after = System.currentTimeMillis();
System.out.println("NumberRules Executed " + i);
// System.out.println("NumberRules Executed " + i);
System.out.println("Rules executed in " + (after - before) + " ms");
Double dd = new Double(i) / (after - before) * 1000;
System.out.println("NbreRules/seconde=" + dd);
// Double dd = new Double(i) / (after - before) * 1000;
// System.out.println("NbreRules/seconde=" + dd);
}

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

66
pom.xml
View file

@ -22,76 +22,36 @@
<cxf.version>2.2.6</cxf.version>
<spring-version>3.0.1.RELEASE</spring-version>
<commons-logging-version>1.1.1</commons-logging-version>
<drools.version>7.64.0.Final</drools.version>
<drools.version>10.1.0-aletyx-rc.2</drools.version>
<maven.compiler.version>3.14.0</maven.compiler.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.kiegroup</groupId>
<artifactId>cost-calculation-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kiegroup</groupId>
<artifactId>cost-calculation-extension</artifactId>
<version>${project.version}</version>
<groupId>org.drools</groupId>
<artifactId>drools-bom</artifactId>
<version>${drools.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.4.2</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${drools.version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>commons-logging</groupId>
@ -107,7 +67,7 @@
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>