Initial
This commit is contained in:
commit
4dbaba5e48
80 changed files with 4193 additions and 0 deletions
8
.idea/artifacts/WebServicesExample_war.xml
generated
Normal file
8
.idea/artifacts/WebServicesExample_war.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="war" name="WebServicesExample:war">
|
||||||
|
<output-path>$PROJECT_DIR$/WebServicesExample/target</output-path>
|
||||||
|
<root id="archive" name="web services.war">
|
||||||
|
<element id="artifact" artifact-name="WebServicesExample:war exploded" />
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
42
.idea/artifacts/WebServicesExample_war_exploded.xml
generated
Normal file
42
.idea/artifacts/WebServicesExample_war_exploded.xml
generated
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="exploded-war" name="WebServicesExample:war exploded">
|
||||||
|
<output-path>$PROJECT_DIR$/WebServicesExample/target/web services</output-path>
|
||||||
|
<root id="root">
|
||||||
|
<element id="javaee-facet-resources" facet="WebServicesExample/web/Web" />
|
||||||
|
<element id="directory" name="WEB-INF">
|
||||||
|
<element id="directory" name="classes">
|
||||||
|
<element id="module-output" name="WebServicesExample" />
|
||||||
|
</element>
|
||||||
|
<element id="directory" name="lib">
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring:2.5.6" />
|
||||||
|
<element id="library" level="project" name="Maven: commons-logging:commons-logging:1.1.1" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.ws:jaxws-rt:2.2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.xml.ws:jaxws-api:2.2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.xml.bind:jaxb-api:2.2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.xml.stream:stax-api:1.0" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.activation:activation:1.1" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.xml.soap:saaj-api:1.3" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.annotation:jsr250-api:1.0" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.jws:jsr181-api:1.0-MR1" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.1.1" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.messaging.saaj:saaj-impl:1.3.4" />
|
||||||
|
<element id="library" level="project" name="Maven: org.jvnet:mimepull:1.4" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.stream.buffer:streambuffer:1.1" />
|
||||||
|
<element id="library" level="project" name="Maven: org.jvnet.staxex:stax-ex:1.2" />
|
||||||
|
<element id="library" level="project" name="Maven: org.codehaus.woodstox:wstx-asl:3.2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: stax:stax-api:1.0.1" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.org.apache.xml.internal:resolver:20050927" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.ws:policy:2.2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.txw2:txw2:20090102" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.istack:istack-commons-runtime:2.2" />
|
||||||
|
<element id="library" level="project" name="Maven: org.glassfish.gmbal:gmbal-api-only:3.0.0-b023" />
|
||||||
|
<element id="library" level="project" name="Maven: org.glassfish.external:management-api:3.0.0-b012" />
|
||||||
|
<element id="library" level="project" name="Maven: org.jvnet.jax-ws-commons.spring:jaxws-spring:1.8" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.servlet:servlet-api:2.5" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.xbean:xbean-spring:2.7" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.stream:sjsxp:1.0" />
|
||||||
|
</element>
|
||||||
|
</element>
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
8
.idea/artifacts/simpleWebApp_war.xml
generated
Normal file
8
.idea/artifacts/simpleWebApp_war.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="war" name="simpleWebApp:war">
|
||||||
|
<output-path>$PROJECT_DIR$/simpleWebApp/target</output-path>
|
||||||
|
<root id="archive" name="simpleWebApp.war">
|
||||||
|
<element id="artifact" artifact-name="simpleWebApp:war exploded" />
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
71
.idea/artifacts/simpleWebApp_war_exploded.xml
generated
Normal file
71
.idea/artifacts/simpleWebApp_war_exploded.xml
generated
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<component name="ArtifactManager">
|
||||||
|
<artifact type="exploded-war" name="simpleWebApp:war exploded">
|
||||||
|
<output-path>$PROJECT_DIR$/simpleWebApp/target/simpleWebApp</output-path>
|
||||||
|
<root id="root">
|
||||||
|
<element id="javaee-facet-resources" facet="simpleWebApp/web/Web" />
|
||||||
|
<element id="directory" name="WEB-INF">
|
||||||
|
<element id="directory" name="classes">
|
||||||
|
<element id="module-output" name="simpleWebApp" />
|
||||||
|
</element>
|
||||||
|
<element id="directory" name="lib">
|
||||||
|
<element id="library" level="project" name="Maven: org.drools:drools-compiler:5.6.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.drools:drools-core:5.6.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.mvel:mvel2:2.1.8.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.drools:knowledge-api:5.6.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.slf4j:slf4j-api:1.6.4" />
|
||||||
|
<element id="library" level="project" name="Maven: org.drools:knowledge-internal-api:5.6.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.antlr:antlr-runtime:3.3" />
|
||||||
|
<element id="library" level="project" name="Maven: org.antlr:antlr:3.3" />
|
||||||
|
<element id="library" level="project" name="Maven: org.antlr:stringtemplate:3.2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: antlr:antlr:2.7.7" />
|
||||||
|
<element id="library" level="project" name="Maven: org.eclipse.jdt.core.compiler:ecj:3.5.1" />
|
||||||
|
<element id="library" level="project" name="Maven: com.thoughtworks.xstream:xstream:1.4.1" />
|
||||||
|
<element id="library" level="project" name="Maven: xmlpull:xmlpull:1.1.3.1" />
|
||||||
|
<element id="library" level="project" name="Maven: xpp3:xpp3_min:1.1.4c" />
|
||||||
|
<element id="library" level="project" name="Maven: org.jbpm:jbpm-bpmn2:5.5.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.jbpm:jbpm-flow-builder:5.5.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: org.jbpm:jbpm-flow:5.5.0.Final" />
|
||||||
|
<element id="library" level="project" name="Maven: com.google.protobuf:protobuf-java:2.5.0" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-frontend-jaxws:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: xml-resolver:xml-resolver:1.2" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.geronimo.specs:geronimo-jaxws_2.1_spec:1.0" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.geronimo.specs:geronimo-activation_1.1_spec:1.0.2" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec:1.1.2" />
|
||||||
|
<element id="library" level="project" name="Maven: asm:asm:2.2.3" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-api:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-common-utilities:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-core:3.0.1.RELEASE" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-asm:3.0.1.RELEASE" />
|
||||||
|
<element id="library" level="project" name="Maven: commons-logging:commons-logging:1.1.1" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-beans:3.0.1.RELEASE" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-context:3.0.1.RELEASE" />
|
||||||
|
<element id="library" level="project" name="Maven: aopalliance:aopalliance:1.0" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.geronimo.specs:geronimo-annotation_1.0_spec:1.1.1" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.xml.bind:jaxb-api:2.1" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:1.0.1" />
|
||||||
|
<element id="library" level="project" name="Maven: wsdl4j:wsdl4j:1.6.2" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.ws.commons.schema:XmlSchema:1.4.5" />
|
||||||
|
<element id="library" level="project" name="Maven: commons-lang:commons-lang:2.4" />
|
||||||
|
<element id="library" level="project" name="Maven: org.codehaus.woodstox:wstx-asl:3.2.9" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.neethi:neethi:2.0.4" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-common-schemas:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-core:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.bind:jaxb-impl:2.1.12" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.geronimo.specs:geronimo-javamail_1.4_spec:1.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-bindings-soap:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-tools-common:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: javax.xml.soap:saaj-api:1.3" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-databinding-jaxb:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-bindings-xml:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-frontend-simple:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-ws-addr:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: com.sun.xml.messaging.saaj:saaj-impl:1.3.2" />
|
||||||
|
<element id="library" level="project" name="Maven: org.apache.cxf:cxf-rt-transports-http:2.2.6" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-web:3.0.1.RELEASE" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-aop:3.0.1.RELEASE" />
|
||||||
|
<element id="library" level="project" name="Maven: org.springframework:spring-expression:3.0.1.RELEASE" />
|
||||||
|
</element>
|
||||||
|
</element>
|
||||||
|
</root>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
5
.idea/copyright/profiles_settings.xml
generated
Normal file
5
.idea/copyright/profiles_settings.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="">
|
||||||
|
<module2copyright />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
5
.idea/encodings.xml
generated
Normal file
5
.idea/encodings.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||||
|
</project>
|
||||||
|
|
||||||
5
.idea/scopes/scope_settings.xml
generated
Normal file
5
.idea/scopes/scope_settings.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<state>
|
||||||
|
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
35
AccountProject/AccountProject.iml
Normal file
35
AccountProject/AccountProject.iml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:drools-compiler:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:drools-core:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.1.8.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:knowledge-api:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:knowledge-internal-api:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.antlr:antlr:3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:3.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.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: org.jbpm:jbpm-bpmn2:5.5.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:5.5.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:5.5.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:2.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.5" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
||||||
53
AccountProject/pom.xml
Normal file
53
AccountProject/pom.xml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.pymma-software.droolscourse</groupId>
|
||||||
|
<artifactId>droolscourse</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>AccountProject</artifactId>
|
||||||
|
<name>Accounting project</name>
|
||||||
|
<description>Accounting project</description>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.8.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
80
AccountProject/src/main/java/com/sample/DroolsTest.java
Normal file
80
AccountProject/src/main/java/com/sample/DroolsTest.java
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.sample;
|
||||||
|
|
||||||
|
import org.drools.KnowledgeBase;
|
||||||
|
import org.drools.KnowledgeBaseFactory;
|
||||||
|
import org.drools.builder.KnowledgeBuilder;
|
||||||
|
import org.drools.builder.KnowledgeBuilderError;
|
||||||
|
import org.drools.builder.KnowledgeBuilderErrors;
|
||||||
|
import org.drools.builder.KnowledgeBuilderFactory;
|
||||||
|
import org.drools.builder.ResourceType;
|
||||||
|
import org.drools.io.ResourceFactory;
|
||||||
|
import org.drools.logger.KnowledgeRuntimeLogger;
|
||||||
|
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a sample class to launch a rule.
|
||||||
|
*/
|
||||||
|
public class DroolsTest {
|
||||||
|
|
||||||
|
public static final void main(String[] args) {
|
||||||
|
try {
|
||||||
|
// load up the knowledge base
|
||||||
|
KnowledgeBase kbase = readKnowledgeBase();
|
||||||
|
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
|
||||||
|
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
|
||||||
|
// go !
|
||||||
|
Message message = new Message();
|
||||||
|
message.setMessage("Hello World");
|
||||||
|
message.setStatus(Message.HELLO);
|
||||||
|
ksession.insert(message);
|
||||||
|
ksession.fireAllRules();
|
||||||
|
logger.close();
|
||||||
|
} catch (Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static KnowledgeBase readKnowledgeBase() throws Exception {
|
||||||
|
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"), ResourceType.DRL);
|
||||||
|
KnowledgeBuilderErrors errors = kbuilder.getErrors();
|
||||||
|
if (errors.size() > 0) {
|
||||||
|
for (KnowledgeBuilderError error: errors) {
|
||||||
|
System.err.println(error);
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Could not parse knowledge.");
|
||||||
|
}
|
||||||
|
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
|
||||||
|
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
|
||||||
|
return kbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Message {
|
||||||
|
|
||||||
|
public static final int HELLO = 0;
|
||||||
|
public static final int GOODBYE = 1;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private int status;
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
44
AccountProject/src/main/java/droolscours/Account.java
Normal file
44
AccountProject/src/main/java/droolscours/Account.java
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
public class Account {
|
||||||
|
private long accountno;
|
||||||
|
private double balance;
|
||||||
|
public long getAccountno() {
|
||||||
|
return accountno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountno(long accountno) {
|
||||||
|
this.accountno = accountno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getBalance() {
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBalance(double balance) {
|
||||||
|
this.balance = balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
StringBuffer buff = new StringBuffer();
|
||||||
|
buff.append("-----Account-----)\n");
|
||||||
|
buff.append("Account no " + this.accountno + "\n");
|
||||||
|
buff.append("Balance " + this.balance + "\n");
|
||||||
|
buff.append("-----End Account-)");
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Account(long accountno, double balance) {
|
||||||
|
super();
|
||||||
|
this.accountno = accountno;
|
||||||
|
this.balance = balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Account() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class AccountingPeriod {
|
||||||
|
private Date startDate;
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
public Date getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(Date start) {
|
||||||
|
this.startDate = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(Date end) {
|
||||||
|
this.endDate = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingPeriod() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
StringBuffer buff = new StringBuffer();
|
||||||
|
buff.append("-----AccountingPeriod-----)\n");
|
||||||
|
if (this.startDate != null) {
|
||||||
|
buff.append("StartDate "
|
||||||
|
+ DateFormat.getDateInstance().format(this.startDate)
|
||||||
|
+ "\n");
|
||||||
|
}else{
|
||||||
|
buff.append("No start date was set\n");
|
||||||
|
}
|
||||||
|
if (this.endDate != null) {
|
||||||
|
buff.append("EndDate "
|
||||||
|
+ DateFormat.getDateInstance().format(this.endDate) + "\n");
|
||||||
|
}else {
|
||||||
|
buff.append("No ens date was set\n");
|
||||||
|
}
|
||||||
|
buff.append("-----End AccountingPeriod -)");
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountingPeriod(Date startDate, Date endDate) {
|
||||||
|
super();
|
||||||
|
this.startDate = startDate;
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
78
AccountProject/src/main/java/droolscours/CashFlow.java
Normal file
78
AccountProject/src/main/java/droolscours/CashFlow.java
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class CashFlow {
|
||||||
|
private Date mvtDate;
|
||||||
|
private double amount;
|
||||||
|
private int type;
|
||||||
|
private long accountNo;
|
||||||
|
public static int CREDIT = 1;
|
||||||
|
public static int DEBIT = 2;
|
||||||
|
|
||||||
|
public Date getMvtDate() {
|
||||||
|
return mvtDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMvtDate(Date date) {
|
||||||
|
this.mvtDate = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(double amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getAccountNo() {
|
||||||
|
return accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountNo(long accountNo) {
|
||||||
|
this.accountNo = accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
StringBuffer buff = new StringBuffer();
|
||||||
|
buff.append("-----CashFlow-----)\n");
|
||||||
|
buff.append("Account no="+this.accountNo+"\n");
|
||||||
|
if (this.mvtDate != null) {
|
||||||
|
buff.append("Mouvement Date= "
|
||||||
|
+ DateFormat.getDateInstance().format(this.mvtDate)
|
||||||
|
+ "\n");
|
||||||
|
}else{
|
||||||
|
buff.append("No Mouvement date was set\n");
|
||||||
|
}
|
||||||
|
buff.append("Mouvement Amount="+this.amount+"\n");
|
||||||
|
buff.append("-----CashFlow end--)");
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CashFlow(Date mvtDate, double amount, int type, long accountNo) {
|
||||||
|
super();
|
||||||
|
this.mvtDate = mvtDate;
|
||||||
|
this.amount = amount;
|
||||||
|
this.type = type;
|
||||||
|
this.accountNo = accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CashFlow() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
46
AccountProject/src/main/java/droolscours/Customer.java
Normal file
46
AccountProject/src/main/java/droolscours/Customer.java
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
public class Customer {
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String country;
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer buff = new StringBuffer();
|
||||||
|
buff.append("-----Customer-----)\n");
|
||||||
|
buff.append("Name=" + this.name + "\n");
|
||||||
|
buff.append("Surname Name=" + this.surname + "\n");
|
||||||
|
buff.append("Country=" + this.country + "\n");
|
||||||
|
buff.append("-----Customer end-)");
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
public Customer(String name, String surname, String country) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
public Customer() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
AccountProject/src/main/java/droolscours/PrivateAccount.java
Normal file
23
AccountProject/src/main/java/droolscours/PrivateAccount.java
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
public class PrivateAccount extends Account {
|
||||||
|
private Customer owner;
|
||||||
|
|
||||||
|
public Customer getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(Customer owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer buff = new StringBuffer();
|
||||||
|
buff.append("-----Private Account-)");
|
||||||
|
buff.append(super.toString());
|
||||||
|
buff.append(this.owner.toString());
|
||||||
|
buff.append("-----Private Account end-)");
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package droolscours.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import droolscours.Customer;
|
||||||
|
|
||||||
|
public class CustomerService {
|
||||||
|
|
||||||
|
public List<Customer> getListCustomer(){
|
||||||
|
List<Customer> result = new ArrayList<Customer>();
|
||||||
|
result.add(new Customer("Héron", "Nicolas", "Fr"));
|
||||||
|
result.add(new Customer("Héron", "James", "GB"));
|
||||||
|
result.add(new Customer("Héron", "Nicolas", "GB"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
AccountProject/src/main/java/util/DateHelper.java
Normal file
20
AccountProject/src/main/java/util/DateHelper.java
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DateHelper {
|
||||||
|
public static String sFormat = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static Date getDate(String sDate) throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
|
||||||
|
return sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date getDate(String sDate, String anotherFormat)
|
||||||
|
throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(anotherFormat);
|
||||||
|
return sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
137
AccountProject/src/main/java/util/KnowledgeSessionHelper.java
Normal file
137
AccountProject/src/main/java/util/KnowledgeSessionHelper.java
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
import org.drools.KnowledgeBase;
|
||||||
|
import org.drools.KnowledgeBaseFactory;
|
||||||
|
import org.drools.builder.KnowledgeBuilder;
|
||||||
|
import org.drools.builder.KnowledgeBuilderError;
|
||||||
|
import org.drools.builder.KnowledgeBuilderErrors;
|
||||||
|
import org.drools.builder.KnowledgeBuilderFactory;
|
||||||
|
import org.drools.builder.ResourceType;
|
||||||
|
import org.drools.event.rule.DefaultAgendaEventListener;
|
||||||
|
import org.drools.event.rule.ActivationCancelledEvent;
|
||||||
|
import org.drools.event.rule.ActivationCreatedEvent;
|
||||||
|
import org.drools.event.rule.AfterActivationFiredEvent;
|
||||||
|
import org.drools.event.rule.AgendaGroupPoppedEvent;
|
||||||
|
import org.drools.event.rule.AgendaGroupPushedEvent;
|
||||||
|
import org.drools.event.rule.BeforeActivationFiredEvent;
|
||||||
|
import org.drools.event.rule.ObjectInsertedEvent;
|
||||||
|
import org.drools.event.rule.ObjectRetractedEvent;
|
||||||
|
import org.drools.event.rule.ObjectUpdatedEvent;
|
||||||
|
import org.drools.event.rule.WorkingMemoryEventListener;
|
||||||
|
import org.drools.io.ResourceFactory;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import org.drools.runtime.StatelessKnowledgeSession;
|
||||||
|
|
||||||
|
public class KnowledgeSessionHelper {
|
||||||
|
|
||||||
|
private static KnowledgeBase createRuleBase(String drlFile) {
|
||||||
|
KnowledgeBase ruleBase = null;
|
||||||
|
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
|
||||||
|
.newKnowledgeBuilder();
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource(drlFile),
|
||||||
|
ResourceType.DRL);
|
||||||
|
KnowledgeBuilderErrors errors = kbuilder.getErrors();
|
||||||
|
if (errors.size() > 0) {
|
||||||
|
for (KnowledgeBuilderError error : errors) {
|
||||||
|
System.err.println(error);
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Probleme a la lecture du fichier.");
|
||||||
|
}
|
||||||
|
ruleBase = KnowledgeBaseFactory.newKnowledgeBase();
|
||||||
|
ruleBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
|
||||||
|
return ruleBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatelessKnowledgeSession getStatelessKnowledgeSession(
|
||||||
|
String drlFile) {
|
||||||
|
KnowledgeBase ruleBase = createRuleBase(drlFile);
|
||||||
|
return ruleBase.newStatelessKnowledgeSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatefulKnowledgeSession getStatefulKnowledgeSession(
|
||||||
|
String drlFile) {
|
||||||
|
KnowledgeBase ruleBase = createRuleBase(drlFile);
|
||||||
|
return ruleBase.newStatefulKnowledgeSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatefulKnowledgeSession getStatefulKnowledgeSessionWithCallback(
|
||||||
|
String drlFile) {
|
||||||
|
StatefulKnowledgeSession session = getStatefulKnowledgeSession(drlFile);
|
||||||
|
session.addEventListener(new WorkingMemoryEventListener() {
|
||||||
|
@Override
|
||||||
|
public void objectUpdated(ObjectUpdatedEvent arg0) {
|
||||||
|
System.out.println("Object mise à jour \n"
|
||||||
|
+ "Nouvelles valeurs \n" + arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectRetracted(ObjectRetractedEvent arg0) {
|
||||||
|
System.out.println("Object retiré \n"
|
||||||
|
+ arg0.getOldObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectInserted(ObjectInsertedEvent arg0) {
|
||||||
|
System.out.println("Object inséré \n"
|
||||||
|
+ arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
session.addEventListener(new DefaultAgendaEventListener() {
|
||||||
|
@Override
|
||||||
|
public void beforeActivationFired(BeforeActivationFiredEvent arg0) {
|
||||||
|
System.out.println("La règle "
|
||||||
|
+ arg0.getActivation().getRule().getName()
|
||||||
|
+ " va être déclenchée");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void agendaGroupPushed(AgendaGroupPushedEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void agendaGroupPopped(AgendaGroupPoppedEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterActivationFired(AfterActivationFiredEvent arg0) {
|
||||||
|
System.out.println("La règle "
|
||||||
|
+ arg0.getActivation().getRule().getName()
|
||||||
|
+ " a êté déclenchée");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activationCreated(ActivationCreatedEvent arg0) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activationCancelled(ActivationCancelledEvent arg0) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatefulKnowledgeSession getStatefulKnowledgeSession(
|
||||||
|
String drlFile,String rfFile) {
|
||||||
|
KnowledgeBase ruleBase = null;
|
||||||
|
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
|
||||||
|
.newKnowledgeBuilder();
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource(drlFile),
|
||||||
|
ResourceType.DRL);
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource(rfFile),
|
||||||
|
ResourceType.DRF);
|
||||||
|
KnowledgeBuilderErrors errors = kbuilder.getErrors();
|
||||||
|
if (errors.size() > 0) {
|
||||||
|
for (KnowledgeBuilderError error : errors) {
|
||||||
|
System.err.println(error);
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Probleme a la lecture du fichier.");
|
||||||
|
}
|
||||||
|
ruleBase = KnowledgeBaseFactory.newKnowledgeBase();
|
||||||
|
ruleBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
|
||||||
|
return ruleBase.newStatefulKnowledgeSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
AccountProject/src/main/java/util/OutputDisplay.java
Normal file
10
AccountProject/src/main/java/util/OutputDisplay.java
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
public class OutputDisplay {
|
||||||
|
|
||||||
|
public void showText(String someText) {
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
System.out.println("time=" + time + "-" + someText);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
67
AccountProject/src/test/java/droolscours/PremierEssai.java
Normal file
67
AccountProject/src/test/java/droolscours/PremierEssai.java
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
import org.drools.event.rule.ObjectInsertedEvent;
|
||||||
|
import org.drools.event.rule.ObjectRetractedEvent;
|
||||||
|
import org.drools.event.rule.ObjectUpdatedEvent;
|
||||||
|
import org.drools.event.rule.WorkingMemoryEventListener;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import org.drools.runtime.StatelessKnowledgeSession;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import util.DateHelper;
|
||||||
|
import util.KnowledgeSessionHelper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class PremierEssai {
|
||||||
|
StatelessKnowledgeSession sessionStateless = null;
|
||||||
|
StatefulKnowledgeSession sessionStatefull = null;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test1() {
|
||||||
|
sessionStateless = KnowledgeSessionHelper
|
||||||
|
.getStatelessKnowledgeSession("Sample.drl");
|
||||||
|
sessionStateless.execute(new String("Hello"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("SimpleSample.drl");
|
||||||
|
sessionStatefull.addEventListener(new WorkingMemoryEventListener() {
|
||||||
|
@Override
|
||||||
|
public void objectUpdated(ObjectUpdatedEvent arg0) {
|
||||||
|
System.out.println("Object mise à jour \n"
|
||||||
|
+ "Nouvelles valeurs \n" + arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectRetracted(ObjectRetractedEvent arg0) {
|
||||||
|
System.out.println("Object retiré \n"
|
||||||
|
+ arg0.getOldObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectInserted(ObjectInsertedEvent arg0) {
|
||||||
|
System.out.println("Object inséré \n"
|
||||||
|
+ arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Account account = new Account();
|
||||||
|
account.setAccountno(1);
|
||||||
|
sessionStatefull.insert(account);
|
||||||
|
AccountingPeriod period = new AccountingPeriod();
|
||||||
|
period.setStartDate(DateHelper.getDate("2010-01-01"));
|
||||||
|
period.setEndDate(DateHelper.getDate("2010-03-31"));
|
||||||
|
sessionStatefull.insert(period);
|
||||||
|
CashFlow action1 = new CashFlow();
|
||||||
|
action1.setAccountNo(1);
|
||||||
|
action1.setAmount(1000);
|
||||||
|
action1.setType(CashFlow.CREDIT);
|
||||||
|
action1.setMvtDate(DateHelper.getDate("2010-01-02"));
|
||||||
|
sessionStatefull.insert(action1);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
Assert.assertTrue(account.getBalance() == 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
64
AccountProject/src/test/java/droolscours/TestRuleFlow.java
Normal file
64
AccountProject/src/test/java/droolscours/TestRuleFlow.java
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import util.KnowledgeSessionHelper;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestRuleFlow {
|
||||||
|
StatefulKnowledgeSession sessionStatefull = null;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
System.out.println("------------Before------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
System.out.println("------------Après ------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait1() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo-ruleflow.drl","RuleFlow1.rf");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
AccountingPeriod period = new AccountingPeriod();
|
||||||
|
sessionStatefull.insert(period);
|
||||||
|
sessionStatefull.startProcess("RF1");
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait2() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo-ruleflow2.drl","RuleFlow2.rf");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
AccountingPeriod period = new AccountingPeriod();
|
||||||
|
sessionStatefull.insert(period);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait3() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo-ruleflow3.drl","RuleFlow3.rf");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
a.setBalance(1500);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
AccountingPeriod period = new AccountingPeriod();
|
||||||
|
sessionStatefull.insert(period);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
138
AccountProject/src/test/java/droolscours/TestUnFait.java
Normal file
138
AccountProject/src/test/java/droolscours/TestUnFait.java
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
import org.drools.event.rule.ObjectInsertedEvent;
|
||||||
|
import org.drools.event.rule.ObjectRetractedEvent;
|
||||||
|
import org.drools.event.rule.ObjectUpdatedEvent;
|
||||||
|
import org.drools.event.rule.WorkingMemoryEventListener;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import org.drools.runtime.rule.FactHandle;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import util.KnowledgeSessionHelper;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
public class TestUnFait {
|
||||||
|
StatefulKnowledgeSession sessionStatefull = null;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
System.out.println("------------Before------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
System.out.println("------------Après ------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnFaitSansFait() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo.drl");
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
System.out.println("Avez-vous vu quelquechose ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnFaitAvecAccountCommeFait() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo.drl");
|
||||||
|
Account a = new Account();
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
System.out.println("Vous avez donc vu quelquechose ;)");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnFaitAvecAccountCommeFaitGlobal() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo-global.drl");
|
||||||
|
Account a = new Account();
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
System.out.println("Vous avez donc vu quelquechose ;)");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnFaitAvecAccountCommeFaitGlobalEtAvecCallBack() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo.drl");
|
||||||
|
sessionStatefull.addEventListener(new WorkingMemoryEventListener() {
|
||||||
|
@Override
|
||||||
|
public void objectUpdated(ObjectUpdatedEvent arg0) {
|
||||||
|
System.out.println("Object mise à jour \n"
|
||||||
|
+ "Nouvelles valeurs \n" + arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectRetracted(ObjectRetractedEvent arg0) {
|
||||||
|
System.out.println("Object retiré \n"
|
||||||
|
+ arg0.getOldObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectInserted(ObjectInsertedEvent arg0) {
|
||||||
|
System.out.println("Object inséré \n"
|
||||||
|
+ arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Account a = new Account();
|
||||||
|
a.setAccountno(0);
|
||||||
|
FactHandle handlea = sessionStatefull.insert(a);
|
||||||
|
a.setAccountno(100);
|
||||||
|
sessionStatefull.update(handlea, a);
|
||||||
|
sessionStatefull.retract(handlea);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
System.out.println("Vous avez donc vu quelquechose ;)");
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testUnFaitAvecAccountRDGDeclenchement1() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo.drl");
|
||||||
|
Account a = new Account();
|
||||||
|
FactHandle handlea = sessionStatefull.insert(a);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testUnFaitAvecAccountRDGDeclenchement2() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo.drl");
|
||||||
|
Account a = new Account();
|
||||||
|
FactHandle handlea = sessionStatefull.insert(a);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
sessionStatefull.update(handlea, a);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testUnFaitAvecAccountInsert() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("demo-insertupdatedelete.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
|
||||||
|
sessionStatefull.addEventListener(new WorkingMemoryEventListener() {
|
||||||
|
@Override
|
||||||
|
public void objectUpdated(ObjectUpdatedEvent arg0) {
|
||||||
|
System.out.println("Object mise à jour \n"
|
||||||
|
+ "Nouvelles valeurs \n" + arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void objectRetracted(ObjectRetractedEvent arg0) {
|
||||||
|
System.out.println("Object retiré \n"
|
||||||
|
+ arg0.getOldObject().toString());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void objectInserted(ObjectInsertedEvent arg0) {
|
||||||
|
System.out.println("Object inséré \n"
|
||||||
|
+ arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Account a = new Account();
|
||||||
|
FactHandle handlea = sessionStatefull.insert(a);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
}
|
||||||
248
AccountProject/src/test/java/droolscours/Testlanguage.java
Normal file
248
AccountProject/src/test/java/droolscours/Testlanguage.java
Normal file
|
|
@ -0,0 +1,248 @@
|
||||||
|
package droolscours;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.drools.audit.WorkingMemoryFileLogger;
|
||||||
|
import org.drools.event.rule.ObjectInsertedEvent;
|
||||||
|
import org.drools.event.rule.ObjectRetractedEvent;
|
||||||
|
import org.drools.event.rule.ObjectUpdatedEvent;
|
||||||
|
import org.drools.event.rule.WorkingMemoryEventListener;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import droolscours.service.CustomerService;
|
||||||
|
|
||||||
|
import util.DateHelper;
|
||||||
|
import util.KnowledgeSessionHelper;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
|
||||||
|
public class Testlanguage {
|
||||||
|
StatefulKnowledgeSession sessionStatefull = null;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
System.out.println("------------Before------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
System.out.println("------------Après ------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait1() {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language.drl");
|
||||||
|
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
AccountingPeriod period = new AccountingPeriod();
|
||||||
|
sessionStatefull.insert(period);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait2() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
a.setAccountno(1);
|
||||||
|
a.setBalance(0);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
CashFlow cash1 = new CashFlow();
|
||||||
|
cash1.setAccountNo(1);
|
||||||
|
cash1.setAmount(1000);
|
||||||
|
cash1.setMvtDate(DateHelper.getDate("2010-01-15"));
|
||||||
|
cash1.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash1);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
Assert.assertTrue(a.getBalance()==1000);
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait3() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
a.setAccountno(1);
|
||||||
|
a.setBalance(0);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
CashFlow cash1 = new CashFlow();
|
||||||
|
cash1.setAccountNo(1);
|
||||||
|
cash1.setAmount(1000);
|
||||||
|
cash1.setMvtDate(DateHelper.getDate("2010-01-15"));
|
||||||
|
cash1.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash1);
|
||||||
|
CashFlow cash2 = new CashFlow();
|
||||||
|
cash2.setAccountNo(2);
|
||||||
|
cash2.setAmount(1000);
|
||||||
|
cash2.setMvtDate(DateHelper.getDate("2010-01-15"));
|
||||||
|
cash2.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash2);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
Assert.assertTrue(a.getBalance()==1000);
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait4() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language2.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
a.setAccountno(1);
|
||||||
|
a.setBalance(0);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
CashFlow cash1 = new CashFlow();
|
||||||
|
cash1.setAccountNo(1);
|
||||||
|
cash1.setAmount(1000);
|
||||||
|
cash1.setMvtDate(DateHelper.getDate("2010-01-15"));
|
||||||
|
cash1.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash1);
|
||||||
|
CashFlow cash2 = new CashFlow();
|
||||||
|
cash2.setAccountNo(1);
|
||||||
|
cash2.setAmount(500);
|
||||||
|
cash2.setMvtDate(DateHelper.getDate("2010-02-15"));
|
||||||
|
cash2.setType(CashFlow.DEBIT);
|
||||||
|
sessionStatefull.insert(cash2);
|
||||||
|
CashFlow cash3 = new CashFlow();
|
||||||
|
cash3.setAccountNo(1);
|
||||||
|
cash3.setAmount(1000);
|
||||||
|
cash3.setMvtDate(DateHelper.getDate("2010-04-15"));
|
||||||
|
cash3.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash3);
|
||||||
|
AccountingPeriod period = new AccountingPeriod();
|
||||||
|
period.setStartDate(DateHelper.getDate("2010-01-01"));
|
||||||
|
period.setEndDate(DateHelper.getDate("2010-03-31"));
|
||||||
|
sessionStatefull.insert(period);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
Assert.assertTrue(a.getBalance()==500);
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait5() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language3.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Customer customer = new Customer();
|
||||||
|
customer.setName("Héron");
|
||||||
|
customer.setSurname("Nicolas");
|
||||||
|
PrivateAccount pAccount = new PrivateAccount();
|
||||||
|
pAccount.setOwner(customer);
|
||||||
|
sessionStatefull.insert(pAccount);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait6() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language3.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Customer customer = new Customer();
|
||||||
|
customer.setName("Héron");
|
||||||
|
customer.setSurname("Nicolas");
|
||||||
|
customer.setCountry("GB");
|
||||||
|
sessionStatefull.insert(customer);
|
||||||
|
PrivateAccount pAccount = new PrivateAccount();
|
||||||
|
pAccount.setOwner(customer);
|
||||||
|
sessionStatefull.insert(pAccount);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait7() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language3.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account pAccount = new Account();
|
||||||
|
sessionStatefull.insert(pAccount);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait8() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language3.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account pAccount = new Account();
|
||||||
|
sessionStatefull.insert(pAccount);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait9() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language4.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
a.setAccountno(1);
|
||||||
|
a.setBalance(0);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
CashFlow cash1 = new CashFlow();
|
||||||
|
cash1.setAccountNo(1);
|
||||||
|
cash1.setAmount(1000);
|
||||||
|
cash1.setMvtDate(DateHelper.getDate("2010-01-15"));
|
||||||
|
cash1.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash1);
|
||||||
|
CashFlow cash2 = new CashFlow();
|
||||||
|
cash2.setAccountNo(1);
|
||||||
|
cash2.setAmount(500);
|
||||||
|
cash2.setMvtDate(DateHelper.getDate("2010-02-15"));
|
||||||
|
cash2.setType(CashFlow.DEBIT);
|
||||||
|
sessionStatefull.insert(cash2);
|
||||||
|
CashFlow cash3 = new CashFlow();
|
||||||
|
cash3.setAccountNo(1);
|
||||||
|
cash3.setAmount(1000);
|
||||||
|
cash3.setMvtDate(DateHelper.getDate("2010-04-15"));
|
||||||
|
cash3.setType(CashFlow.CREDIT);
|
||||||
|
sessionStatefull.insert(cash3);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait10() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language5.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
sessionStatefull.setGlobal("serviceCustomer", new CustomerService());
|
||||||
|
Customer c = new Customer("Héron","Nicolas","A");
|
||||||
|
sessionStatefull.insert(c);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait11() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language6.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
Account a = new Account();
|
||||||
|
a.setAccountno(1);
|
||||||
|
a.setBalance(0);
|
||||||
|
sessionStatefull.insert(a);
|
||||||
|
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-01-15"),1000,CashFlow.CREDIT,1));
|
||||||
|
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-02-15"),500,CashFlow.DEBIT,1));
|
||||||
|
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-04-15"),1000,CashFlow.CREDIT,1));
|
||||||
|
sessionStatefull.insert(new AccountingPeriod(DateHelper.getDate("2010-01-01"),DateHelper.getDate("2010-31-31")));
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testdeuxFait12() throws Exception {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSessionWithCallback("demo-Language7.drl");
|
||||||
|
OutputDisplay display = new OutputDisplay();
|
||||||
|
sessionStatefull.setGlobal("result", display);
|
||||||
|
sessionStatefull.insert(new Account(1,0));
|
||||||
|
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-01-15"),1000,CashFlow.CREDIT,1));
|
||||||
|
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-02-15"),500,CashFlow.DEBIT,1));
|
||||||
|
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-04-15"),1000,CashFlow.CREDIT,1));
|
||||||
|
sessionStatefull.insert(new AccountingPeriod(DateHelper.getDate("2010-01-01"),DateHelper.getDate("2010-31-31")));
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
}
|
||||||
|
}
|
||||||
23
AccountProject/src/test/resources/RuleFlow1.rf
Normal file
23
AccountProject/src/test/resources/RuleFlow1.rf
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?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="cours" >
|
||||||
|
|
||||||
|
<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>
|
||||||
23
AccountProject/src/test/resources/RuleFlow2.rf
Normal file
23
AccountProject/src/test/resources/RuleFlow2.rf
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?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="RuleFlow2" id="RF2" package-name="cours" >
|
||||||
|
|
||||||
|
<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>
|
||||||
36
AccountProject/src/test/resources/RuleFlow3.rf
Normal file
36
AccountProject/src/test/resources/RuleFlow3.rf
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?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="RF2" package-name="cours" >
|
||||||
|
|
||||||
|
<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 <= 1000 )</constraint>
|
||||||
|
<constraint toNodeId="3" toType="DROOLS_DEFAULT" name="constraint" priority="1" type="rule" dialect="mvel" >Account(balance > 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>
|
||||||
20
AccountProject/src/test/resources/Sample.drl
Normal file
20
AccountProject/src/test/resources/Sample.drl
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.sample
|
||||||
|
|
||||||
|
import com.sample.DroolsTest.Message;
|
||||||
|
|
||||||
|
rule "Hello World"
|
||||||
|
when
|
||||||
|
m : Message( status == Message.HELLO, myMessage : message )
|
||||||
|
then
|
||||||
|
System.out.println( myMessage );
|
||||||
|
m.setMessage( "Goodbye cruel world" );
|
||||||
|
m.setStatus( Message.GOODBYE );
|
||||||
|
update( m );
|
||||||
|
end
|
||||||
|
|
||||||
|
rule "GoodBye"
|
||||||
|
when
|
||||||
|
Message( status == Message.GOODBYE, myMessage : message )
|
||||||
|
then
|
||||||
|
System.out.println( myMessage );
|
||||||
|
end
|
||||||
17
AccountProject/src/test/resources/SimpleSample.drl
Normal file
17
AccountProject/src/test/resources/SimpleSample.drl
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.sample
|
||||||
|
|
||||||
|
import com.sample.DroolsTest.Message;
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import util.DateHelper;
|
||||||
|
|
||||||
|
rule "Credit Rule"
|
||||||
|
when
|
||||||
|
acc: Account( no : accountno )
|
||||||
|
period : AccountingPeriod(s : startDate , e: endDate )
|
||||||
|
act : CashFlow( type == CashFlow.CREDIT ,mvtDate >= s && mvtDate <=e ,accountNo ==no)
|
||||||
|
then
|
||||||
|
acc.setBalance(acc.getBalance()+act.getAmount());
|
||||||
|
end
|
||||||
|
|
||||||
34
AccountProject/src/test/resources/demo-Language.drl
Normal file
34
AccountProject/src/test/resources/demo-Language.drl
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
//#declare any global variables here
|
||||||
|
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
|
||||||
|
rule "Account and accounting period both exist"
|
||||||
|
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
AccountingPeriod( )
|
||||||
|
then
|
||||||
|
result.showText("Un compte est un accountingperiod existe");
|
||||||
|
|
||||||
|
end
|
||||||
|
rule "Credit rule"
|
||||||
|
|
||||||
|
when
|
||||||
|
$cash :CashFlow( $no : accountNo ,type == CashFlow.CREDIT )
|
||||||
|
$acc : Account(accountno ==$no )
|
||||||
|
then
|
||||||
|
$acc.setBalance($acc.getBalance()+$cash.getAmount());
|
||||||
|
result.showText("le compte no "+$no+ " a maintenant une valeur de "+$acc.getBalance());
|
||||||
|
end
|
||||||
|
|
||||||
31
AccountProject/src/test/resources/demo-Language2.drl
Normal file
31
AccountProject/src/test/resources/demo-Language2.drl
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
rule "Credit rule"
|
||||||
|
|
||||||
|
when
|
||||||
|
$cash :CashFlow( $aDate : mvtDate, $no : accountNo ,type == CashFlow.CREDIT )
|
||||||
|
$acc : Account(accountno ==$no )
|
||||||
|
$period : AccountingPeriod( startDate <= $aDate && endDate >= $aDate)
|
||||||
|
then
|
||||||
|
$acc.setBalance($acc.getBalance()+$cash.getAmount());
|
||||||
|
result.showText("le compte no "+$no+ " a maintenant une valeur de "+$acc.getBalance());
|
||||||
|
end
|
||||||
|
rule "Debit rule"
|
||||||
|
|
||||||
|
when
|
||||||
|
$cash :CashFlow( $aDate : mvtDate, $no : accountNo ,type == CashFlow.DEBIT )
|
||||||
|
$acc : Account(accountno ==$no )
|
||||||
|
$period : AccountingPeriod( startDate <= $aDate && endDate >= $aDate)
|
||||||
|
then
|
||||||
|
$acc.setBalance($acc.getBalance()-$cash.getAmount());
|
||||||
|
result.showText("le compte no "+$no+ " a maintenant une valeur de "+$acc.getBalance());
|
||||||
|
end
|
||||||
|
|
||||||
51
AccountProject/src/test/resources/demo-Language3.drl
Normal file
51
AccountProject/src/test/resources/demo-Language3.drl
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import droolscours.PrivateAccount;
|
||||||
|
import droolscours.Customer;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
//#declare any global variables here
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
rule "Le cashFlow est du crédit ou du débit"
|
||||||
|
|
||||||
|
when
|
||||||
|
$cash :CashFlow(type in ( CashFlow.DEBIT,CashFlow.CREDIT) )
|
||||||
|
|
||||||
|
then
|
||||||
|
result.showText("Cash Flow est un crédit ou un débit");
|
||||||
|
end
|
||||||
|
rule "Accessor"
|
||||||
|
|
||||||
|
when
|
||||||
|
$cash :PrivateAccount( owner.name =="Héron" )
|
||||||
|
|
||||||
|
then
|
||||||
|
result.showText("Account is owned by Héron");
|
||||||
|
end
|
||||||
|
rule "infixAnd"
|
||||||
|
when
|
||||||
|
( $c1 : Customer ( country=="GB") and PrivateAccount( owner==$c1))
|
||||||
|
or
|
||||||
|
( $c1 : Customer (country=="US") and PrivateAccount( owner==$c1))
|
||||||
|
|
||||||
|
|
||||||
|
then
|
||||||
|
result.showText("Person lives in GB or US");
|
||||||
|
end
|
||||||
|
rule "no customer"
|
||||||
|
when
|
||||||
|
not Customer( )
|
||||||
|
then
|
||||||
|
result.showText("No customer");
|
||||||
|
end
|
||||||
|
rule "Exists"
|
||||||
|
when
|
||||||
|
exists Account( )
|
||||||
|
then
|
||||||
|
result.showText("Account exists");
|
||||||
|
end
|
||||||
23
AccountProject/src/test/resources/demo-Language4.drl
Normal file
23
AccountProject/src/test/resources/demo-Language4.drl
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import droolscours.PrivateAccount;
|
||||||
|
import droolscours.Customer;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
//#declare any global variables here
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
|
||||||
|
rule "ForAll"
|
||||||
|
when
|
||||||
|
$acc : Account()
|
||||||
|
forall ( Account( this==$acc, $no : accountno )
|
||||||
|
CashFlow( accountNo == $no)
|
||||||
|
)
|
||||||
|
then
|
||||||
|
result.showText("All mouvements concerns account no " + $acc.getAccountno());
|
||||||
|
end
|
||||||
22
AccountProject/src/test/resources/demo-Language5.drl
Normal file
22
AccountProject/src/test/resources/demo-Language5.drl
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import droolscours.PrivateAccount;
|
||||||
|
import droolscours.Customer;
|
||||||
|
import droolscours.service.CustomerService;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
//#declare any global variables here
|
||||||
|
global OutputDisplay result;
|
||||||
|
global CustomerService serviceCustomer;
|
||||||
|
|
||||||
|
rule "ForAll"
|
||||||
|
when
|
||||||
|
$c : Customer()
|
||||||
|
$cc : Customer(name ==$c.name,surname==$c.surname,country !=$c.country) from serviceCustomer.getListCustomer();
|
||||||
|
then
|
||||||
|
result.showText("Found same customer in 2 countries");
|
||||||
|
end
|
||||||
37
AccountProject/src/test/resources/demo-Language6.drl
Normal file
37
AccountProject/src/test/resources/demo-Language6.drl
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import droolscours.PrivateAccount;
|
||||||
|
import droolscours.Customer;
|
||||||
|
import droolscours.service.CustomerService;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
//#declare any global variables here
|
||||||
|
global OutputDisplay result;
|
||||||
|
global CustomerService serviceCustomer;
|
||||||
|
|
||||||
|
rule "More then 2 CashFlow Line"
|
||||||
|
when
|
||||||
|
$c : Account( $acc : accountno )
|
||||||
|
$p : AccountingPeriod ($sDate : startDate ,$eDate : endDate )
|
||||||
|
$number : ArrayList(size >= 2 )
|
||||||
|
from collect( CashFlow( mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ) )
|
||||||
|
|
||||||
|
then
|
||||||
|
result.showText("Found more than 2 CashFlow Lines");
|
||||||
|
end
|
||||||
|
|
||||||
|
rule "Numbers of CashFlow Line"
|
||||||
|
when
|
||||||
|
$c : Account( $acc : accountno )
|
||||||
|
$p : AccountingPeriod ($sDate : startDate ,$eDate : endDate )
|
||||||
|
$number : ArrayList( )
|
||||||
|
from collect( CashFlow( mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ) )
|
||||||
|
|
||||||
|
then
|
||||||
|
result.showText("Found "+$number+" more than 2 CashFlow Lines");
|
||||||
|
end
|
||||||
38
AccountProject/src/test/resources/demo-Language7.drl
Normal file
38
AccountProject/src/test/resources/demo-Language7.drl
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import droolscours.PrivateAccount;
|
||||||
|
import droolscours.Customer;
|
||||||
|
import droolscours.service.CustomerService;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
//#declare any global variables here
|
||||||
|
global OutputDisplay result;
|
||||||
|
global CustomerService serviceCustomer;
|
||||||
|
|
||||||
|
|
||||||
|
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 ) )
|
||||||
|
$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 ) )
|
||||||
|
|
||||||
|
then
|
||||||
|
result.showText(" Found "+$totalCredit+" as a credit");
|
||||||
|
result.showText(" Found "+$totalDebit+" as a debit");
|
||||||
|
end
|
||||||
30
AccountProject/src/test/resources/demo-global.drl
Normal file
30
AccountProject/src/test/resources/demo-global.drl
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
//#declare any global variables here
|
||||||
|
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
|
||||||
|
rule "Your First Rule revisited"
|
||||||
|
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Le compte existe donc déjà");
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
rule "Your Second Rule"
|
||||||
|
//#include attributes such as "salience" here...
|
||||||
|
when
|
||||||
|
//#conditions
|
||||||
|
then
|
||||||
|
//#actions
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
//#declare any global variables here
|
||||||
|
global OutputDisplay result;
|
||||||
|
rule "Your First Rule revisited"
|
||||||
|
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Le compte existe donc déjà");
|
||||||
|
AccountingPeriod newPeriod = new AccountingPeriod();
|
||||||
|
insert (newPeriod);
|
||||||
|
end
|
||||||
|
rule "Rule on Period"
|
||||||
|
when
|
||||||
|
AccountingPeriod ()
|
||||||
|
then
|
||||||
|
result.showText("Période de compte existe");
|
||||||
|
end
|
||||||
32
AccountProject/src/test/resources/demo-ruleflow.drl
Normal file
32
AccountProject/src/test/resources/demo-ruleflow.drl
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
//#declare any global variables here
|
||||||
|
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
|
||||||
|
rule "Account group1"
|
||||||
|
ruleflow-group "Group1"
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Account in Group1");
|
||||||
|
|
||||||
|
end
|
||||||
|
rule "Account group2"
|
||||||
|
ruleflow-group "Group2"
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Account in Group2");
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
37
AccountProject/src/test/resources/demo-ruleflow2.drl
Normal file
37
AccountProject/src/test/resources/demo-ruleflow2.drl
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
//#declare any global variables here
|
||||||
|
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
rule "start process"
|
||||||
|
when
|
||||||
|
then
|
||||||
|
kcontext.getKnowledgeRuntime().startProcess("RF2");
|
||||||
|
end
|
||||||
|
|
||||||
|
rule "Account group1"
|
||||||
|
ruleflow-group "Group1"
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Account in Group1");
|
||||||
|
|
||||||
|
end
|
||||||
|
rule "Account group2"
|
||||||
|
ruleflow-group "Group2"
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Account in Group2");
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
37
AccountProject/src/test/resources/demo-ruleflow3.drl
Normal file
37
AccountProject/src/test/resources/demo-ruleflow3.drl
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//#list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import droolscours.AccountingPeriod;
|
||||||
|
import droolscours.CashFlow;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
//#declare any global variables here
|
||||||
|
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
rule "start process"
|
||||||
|
when
|
||||||
|
then
|
||||||
|
kcontext.getKnowledgeRuntime().startProcess("RF2");
|
||||||
|
end
|
||||||
|
|
||||||
|
rule "Account group1"
|
||||||
|
ruleflow-group "Group1"
|
||||||
|
when
|
||||||
|
Account(balance > 0 )
|
||||||
|
then
|
||||||
|
result.showText("Account in Group1 > 1000 ");
|
||||||
|
|
||||||
|
end
|
||||||
|
rule "Account group2"
|
||||||
|
ruleflow-group "Group2"
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
result.showText("Account in Group2 < 1000");
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
21
AccountProject/src/test/resources/demo.drl
Normal file
21
AccountProject/src/test/resources/demo.drl
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
//#created on: 30 oct. 2010
|
||||||
|
package cours
|
||||||
|
|
||||||
|
//list any import classes here.
|
||||||
|
import droolscours.Account;
|
||||||
|
import util.OutputDisplay;
|
||||||
|
|
||||||
|
//declare any global variables here
|
||||||
|
|
||||||
|
|
||||||
|
global OutputDisplay result;
|
||||||
|
|
||||||
|
rule "Your First Rule"
|
||||||
|
|
||||||
|
when
|
||||||
|
Account( )
|
||||||
|
then
|
||||||
|
System.out.println("Le compte existe");
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
5
demodrools/.idea/copyright/profiles_settings.xml
generated
Normal file
5
demodrools/.idea/copyright/profiles_settings.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="">
|
||||||
|
<module2copyright />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
5
demodrools/.idea/encodings.xml
generated
Normal file
5
demodrools/.idea/encodings.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||||
|
</project>
|
||||||
|
|
||||||
670
demodrools/.idea/workspace.xml
generated
Normal file
670
demodrools/.idea/workspace.xml
generated
Normal file
|
|
@ -0,0 +1,670 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CCaseConfig">
|
||||||
|
<option name="checkoutReserved" value="false" />
|
||||||
|
<option name="markExternalChangeAsUpToDate" value="true" />
|
||||||
|
<option name="checkInUseHijack" value="true" />
|
||||||
|
<option name="useUcmModel" value="true" />
|
||||||
|
<option name="synchOutside" value="false" />
|
||||||
|
<option name="isHistoryResticted" value="true" />
|
||||||
|
<option name="useIdenticalSwitch" value="true" />
|
||||||
|
<option name="synchActivitiesOnRefresh" value="true" />
|
||||||
|
<option name="lastScr" value="" />
|
||||||
|
<option name="scrTextFileName" value="" />
|
||||||
|
<option name="historyRevisionsNumber" value="4" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" readonly="true" id="73ef924e-9b62-4b42-a083-49699e61920c" name="Default" comment="">
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/demo/TicketLine.java" afterPath="$PROJECT_DIR$/src/main/java/demo/TicketLine.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/service/TickerService.java" afterPath="$PROJECT_DIR$/src/main/java/service/TickerService.java" />
|
||||||
|
</list>
|
||||||
|
<ignored path="demodrools.iws" />
|
||||||
|
<ignored path=".idea/workspace.xml" />
|
||||||
|
<option name="TRACKING_ENABLED" value="true" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
||||||
|
<component name="CreatePatchCommitExecutor">
|
||||||
|
<option name="PATCH_PATH" value="" />
|
||||||
|
<option name="REVERSE_PATCH" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="DaemonCodeAnalyzer">
|
||||||
|
<disable_hints />
|
||||||
|
</component>
|
||||||
|
<component name="DebuggerManager">
|
||||||
|
<breakpoint_any>
|
||||||
|
<breakpoint>
|
||||||
|
<option name="NOTIFY_CAUGHT" value="true" />
|
||||||
|
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
<option name="LOG_ENABLED" value="false" />
|
||||||
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
|
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||||
|
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||||
|
<option name="COUNT_FILTER" value="0" />
|
||||||
|
<option name="CONDITION_ENABLED" value="false" />
|
||||||
|
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="CONDITION" value="" />
|
||||||
|
<option name="LOG_MESSAGE" value="" />
|
||||||
|
</breakpoint>
|
||||||
|
<breakpoint>
|
||||||
|
<option name="NOTIFY_CAUGHT" value="true" />
|
||||||
|
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
<option name="LOG_ENABLED" value="false" />
|
||||||
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
|
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||||
|
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||||
|
<option name="COUNT_FILTER" value="0" />
|
||||||
|
<option name="CONDITION_ENABLED" value="false" />
|
||||||
|
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="CONDITION" value="" />
|
||||||
|
<option name="LOG_MESSAGE" value="" />
|
||||||
|
</breakpoint>
|
||||||
|
</breakpoint_any>
|
||||||
|
<breakpoint_rules />
|
||||||
|
<ui_properties />
|
||||||
|
</component>
|
||||||
|
<component name="FavoritesManager">
|
||||||
|
<favorites_list name="demodrools" />
|
||||||
|
</component>
|
||||||
|
<component name="FileEditorManager">
|
||||||
|
<leaf>
|
||||||
|
<file leaf-file-name="JAVA/demo" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="uml://JAVA/demo">
|
||||||
|
<provider selected="true" editor-type-id="UmlEditorProvider">
|
||||||
|
<state>
|
||||||
|
<ID>JAVA</ID>
|
||||||
|
<OriginalElement>demo</OriginalElement>
|
||||||
|
<nodes>
|
||||||
|
<node x="-455.0" y="-198.0">demo.TicketLine</node>
|
||||||
|
<node x="554.0" y="45.0">demo.Gender</node>
|
||||||
|
<node x="-465.0" y="72.0">demo.Product</node>
|
||||||
|
<node x="379.0" y="242.0">demo.Card</node>
|
||||||
|
<node x="-86.0" y="280.0">demo.Price</node>
|
||||||
|
<node x="-420.0" y="338.0">demo.Provider</node>
|
||||||
|
<node x="-273.0" y="416.0">demo.Currency</node>
|
||||||
|
<node x="161.0" y="-232.0">demo.Customer</node>
|
||||||
|
<node x="-144.0" y="-157.0">demo.Ticket</node>
|
||||||
|
</nodes>
|
||||||
|
<notes />
|
||||||
|
<edges />
|
||||||
|
<settings isCamel="false" isColorManagerEnabled="true" isShowDependencies="false" isVcsFilterEnabled="false" layout="Hierarchic Group" zoom="1.0" x="-317.0" y="-52.5" />
|
||||||
|
<SelectedNodes>
|
||||||
|
<node>demo.Currency</node>
|
||||||
|
</SelectedNodes>
|
||||||
|
<Categories>
|
||||||
|
<Category>Fields</Category>
|
||||||
|
</Categories>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="JAVA/droolscours" pinned="false" current="true" current-in-tab="true">
|
||||||
|
<entry file="uml://JAVA/droolscours">
|
||||||
|
<provider selected="true" editor-type-id="UmlEditorProvider">
|
||||||
|
<state>
|
||||||
|
<ID>JAVA</ID>
|
||||||
|
<OriginalElement>droolscours</OriginalElement>
|
||||||
|
<nodes>
|
||||||
|
<node x="187.0" y="0.0">droolscours.Account</node>
|
||||||
|
<node x="0.0" y="158.0">droolscours.AccountingPeriod</node>
|
||||||
|
<node x="0.0" y="0.0">droolscours.CashFlow</node>
|
||||||
|
</nodes>
|
||||||
|
<notes />
|
||||||
|
<edges />
|
||||||
|
<settings isCamel="false" isColorManagerEnabled="true" isShowDependencies="false" isVcsFilterEnabled="false" layout="Hierarchic Group" zoom="1.0" x="71.5" y="88.5" />
|
||||||
|
<SelectedNodes />
|
||||||
|
<Categories>
|
||||||
|
<Category>Fields</Category>
|
||||||
|
</Categories>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
</leaf>
|
||||||
|
</component>
|
||||||
|
<component name="FindManager">
|
||||||
|
<FindUsagesManager>
|
||||||
|
<setting name="OPEN_NEW_TAB" value="false" />
|
||||||
|
</FindUsagesManager>
|
||||||
|
</component>
|
||||||
|
<component name="MavenRunner">
|
||||||
|
<option name="jreName" value="#JAVA_INTERNAL" />
|
||||||
|
</component>
|
||||||
|
<component name="ModuleEditorState">
|
||||||
|
<option name="LAST_EDITED_MODULE_NAME" />
|
||||||
|
<option name="LAST_EDITED_TAB_NAME" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager">
|
||||||
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
<OptionsSetting value="true" id="Checkout" />
|
||||||
|
<OptionsSetting value="true" id="Update" />
|
||||||
|
<OptionsSetting value="true" id="Status" />
|
||||||
|
<OptionsSetting value="true" id="Edit" />
|
||||||
|
<OptionsSetting value="true" id="Undo Check Out" />
|
||||||
|
<OptionsSetting value="true" id="Get Latest Version" />
|
||||||
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectReloadState">
|
||||||
|
<option name="STATE" value="0" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectView">
|
||||||
|
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
|
||||||
|
<flattenPackages />
|
||||||
|
<showMembers />
|
||||||
|
<showModules />
|
||||||
|
<showLibraryContents />
|
||||||
|
<hideEmptyPackages />
|
||||||
|
<abbreviatePackageNames />
|
||||||
|
<autoscrollToSource />
|
||||||
|
<autoscrollFromSource />
|
||||||
|
<sortByType />
|
||||||
|
</navigator>
|
||||||
|
<panes>
|
||||||
|
<pane id="Favorites" />
|
||||||
|
<pane id="Scope" />
|
||||||
|
<pane id="ProjectPane">
|
||||||
|
<subPane>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="demodrools" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="demodrools" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="AccountProject" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="demodrools" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="AccountProject" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="src" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="main" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="demodrools" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="AccountProject" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="src" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="main" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="java" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="droolscours" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="demodrools" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="AccountProject" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="src" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="main" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="java" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
</subPane>
|
||||||
|
</pane>
|
||||||
|
<pane id="PackagesPane" />
|
||||||
|
</panes>
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="GoToFile.includeJavaFiles" value="false" />
|
||||||
|
<property name="project.structure.last.edited" value="SDKs" />
|
||||||
|
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
|
||||||
|
<property name="project.structure.proportion" value="0.0" />
|
||||||
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
|
<property name="MemberChooser.sorted" value="false" />
|
||||||
|
<property name="MemberChooser.showClasses" value="true" />
|
||||||
|
<property name="GoToClass.includeLibraries" value="false" />
|
||||||
|
<property name="project.structure.side.proportion" value="0.2" />
|
||||||
|
<property name="MemberChooser.copyJavadoc" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration default="true" type="PhpRunConfigurationType" factoryName="PHP">
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="FtpUpload" enabled="false" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
<option name="ValidateXdebugSetup" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
<option name="ValidateXdebugSetup" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Remote" factoryName="Remote">
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||||
|
<option name="HOST" value="localhost" />
|
||||||
|
<option name="PORT" value="5005" />
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="FlexUnitRunConfigurationType" factoryName="FlexUnit" adl_options="" air_descriptor_path="" air_program_params="" air_publisher_id="" air_root_dir_path="" air_run_mode="AppDescriptor" browser_family="FIREFOX" class_name="" debugger_sdk="Module SDK" html_or_swf_file_path="" launcher_type="OSDefault" main_class_name="" method_name="" module_name="" output_log_level="" package_name="" player_path="/usr/bin/flashplayer" port="0" run_mode="HtmlOrSwfFile" run_trusted="false" scope="Class" socket_policy_port="0" url_to_launch="http://">
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" />
|
||||||
|
<extension name="snapshooter" />
|
||||||
|
<module name="" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<option name="SUITE_NAME" />
|
||||||
|
<option name="PACKAGE_NAME" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="METHOD_NAME" />
|
||||||
|
<option name="GROUP_NAME" />
|
||||||
|
<option name="TEST_OBJECT" value="CLASS" />
|
||||||
|
<option name="VM_PARAMETERS" />
|
||||||
|
<option name="PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" />
|
||||||
|
<option name="OUTPUT_DIRECTORY" />
|
||||||
|
<option name="ANNOTATION_TYPE" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
|
<value defaultName="moduleWithDependencies" />
|
||||||
|
</option>
|
||||||
|
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||||
|
<option name="PROPERTIES_FILE" />
|
||||||
|
<envs />
|
||||||
|
<properties />
|
||||||
|
<listeners />
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Applet" factoryName="Applet">
|
||||||
|
<module name="" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="HTML_FILE_NAME" />
|
||||||
|
<option name="HTML_USED" value="false" />
|
||||||
|
<option name="WIDTH" value="400" />
|
||||||
|
<option name="HEIGHT" value="300" />
|
||||||
|
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||||
|
<option name="VM_PARAMETERS" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Application" factoryName="Application">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" />
|
||||||
|
<extension name="snapshooter" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="VM_PARAMETERS" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<module name="" />
|
||||||
|
<envs />
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="PhpUnitRemoteRunConfigurationType" factoryName="PHPUnit on Server">
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="FtpUpload" enabled="false" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
<option name="ValidateXdebugSetup" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" />
|
||||||
|
<extension name="snapshooter" />
|
||||||
|
<module name="" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<option name="PACKAGE_NAME" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="METHOD_NAME" />
|
||||||
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<option name="VM_PARAMETERS" />
|
||||||
|
<option name="PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
|
<value defaultName="moduleWithDependencies" />
|
||||||
|
</option>
|
||||||
|
<envs />
|
||||||
|
<patterns />
|
||||||
|
<method>
|
||||||
|
<option name="AntTarget" enabled="false" />
|
||||||
|
<option name="BuildArtifacts" enabled="false" />
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<list size="0" />
|
||||||
|
<configuration name="<template>" type="WebApp" default="true" selected="false">
|
||||||
|
<Host>localhost</Host>
|
||||||
|
<Port>5050</Port>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
|
<component name="ShelveChangesManager" show_recycled="false" />
|
||||||
|
<component name="StarteamConfiguration">
|
||||||
|
<option name="SERVER" value="" />
|
||||||
|
<option name="PORT" value="49201" />
|
||||||
|
<option name="USER" value="" />
|
||||||
|
<option name="PASSWORD" value="" />
|
||||||
|
<option name="PROJECT" value="" />
|
||||||
|
<option name="VIEW" value="" />
|
||||||
|
<option name="ALTERNATIVE_WORKING_PATH" value="" />
|
||||||
|
<option name="LOCK_ON_CHECKOUT" value="false" />
|
||||||
|
<option name="UNLOCK_ON_CHECKIN" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="SvnConfiguration" maxAnnotateRevisions="500">
|
||||||
|
<option name="USER" value="" />
|
||||||
|
<option name="PASSWORD" value="" />
|
||||||
|
<option name="LAST_MERGED_REVISION" />
|
||||||
|
<option name="UPDATE_RUN_STATUS" value="false" />
|
||||||
|
<option name="MERGE_DRY_RUN" value="false" />
|
||||||
|
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
|
||||||
|
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
|
||||||
|
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
|
||||||
|
<option name="DETECT_NESTED_COPIES" value="true" />
|
||||||
|
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
|
||||||
|
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
|
||||||
|
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
|
||||||
|
<configuration useDefault="true">$USER_HOME$/.subversion_IDEA</configuration>
|
||||||
|
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
|
||||||
|
<supportedVersion>125</supportedVersion>
|
||||||
|
</component>
|
||||||
|
<component name="SvnFileUrlMappingImpl">
|
||||||
|
<option name="myMappingRoots">
|
||||||
|
<list>
|
||||||
|
<SvnCopyRootSimple>
|
||||||
|
<option name="myVcsRoot" value="$PROJECT_DIR$" />
|
||||||
|
<option name="myCopyRoot" value="$PROJECT_DIR$" />
|
||||||
|
</SvnCopyRootSimple>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="myMoreRealMappingRoots">
|
||||||
|
<list>
|
||||||
|
<SvnCopyRootSimple>
|
||||||
|
<option name="myVcsRoot" value="$PROJECT_DIR$" />
|
||||||
|
<option name="myCopyRoot" value="$PROJECT_DIR$" />
|
||||||
|
</SvnCopyRootSimple>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="73ef924e-9b62-4b42-a083-49699e61920c" name="Default" comment="" />
|
||||||
|
<created>1286719839048</created>
|
||||||
|
<updated>1286719839048</updated>
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="ToolWindowManager">
|
||||||
|
<frame x="-4" y="1" width="1928" height="1083" extended-state="6" />
|
||||||
|
<editor active="true" />
|
||||||
|
<layout>
|
||||||
|
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
|
||||||
|
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24959914" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||||
|
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
|
||||||
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
|
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
|
||||||
|
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
|
||||||
|
<option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
|
||||||
|
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
|
||||||
|
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
|
||||||
|
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" />
|
||||||
|
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
|
||||||
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
|
||||||
|
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
||||||
|
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
||||||
|
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
||||||
|
<option name="ACTIVE_VCS_NAME" />
|
||||||
|
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
||||||
|
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
||||||
|
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
||||||
|
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
||||||
|
</component>
|
||||||
|
<component name="XDebuggerManager">
|
||||||
|
<breakpoint-manager />
|
||||||
|
</component>
|
||||||
|
<component name="editorHistoryManager">
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/main/java/demo/TicketLine.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="2" column="13" selection-start="28" selection-end="28" vertical-scroll-proportion="0.033259425" />
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="uml://JAVA/demo">
|
||||||
|
<provider selected="true" editor-type-id="UmlEditorProvider">
|
||||||
|
<state>
|
||||||
|
<ID>JAVA</ID>
|
||||||
|
<OriginalElement>demo</OriginalElement>
|
||||||
|
<nodes>
|
||||||
|
<node x="-455.0" y="-198.0">demo.TicketLine</node>
|
||||||
|
<node x="554.0" y="45.0">demo.Gender</node>
|
||||||
|
<node x="-465.0" y="72.0">demo.Product</node>
|
||||||
|
<node x="379.0" y="242.0">demo.Card</node>
|
||||||
|
<node x="-86.0" y="280.0">demo.Price</node>
|
||||||
|
<node x="-420.0" y="338.0">demo.Provider</node>
|
||||||
|
<node x="-273.0" y="416.0">demo.Currency</node>
|
||||||
|
<node x="161.0" y="-232.0">demo.Customer</node>
|
||||||
|
<node x="-144.0" y="-157.0">demo.Ticket</node>
|
||||||
|
</nodes>
|
||||||
|
<notes />
|
||||||
|
<edges />
|
||||||
|
<settings isCamel="false" isColorManagerEnabled="true" isShowDependencies="false" isVcsFilterEnabled="false" layout="Hierarchic Group" zoom="1.0" x="-317.0" y="-52.5" />
|
||||||
|
<SelectedNodes>
|
||||||
|
<node>demo.Currency</node>
|
||||||
|
</SelectedNodes>
|
||||||
|
<Categories>
|
||||||
|
<Category>Fields</Category>
|
||||||
|
</Categories>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="uml://JAVA/droolscours">
|
||||||
|
<provider selected="true" editor-type-id="UmlEditorProvider">
|
||||||
|
<state>
|
||||||
|
<ID>JAVA</ID>
|
||||||
|
<OriginalElement>droolscours</OriginalElement>
|
||||||
|
<nodes>
|
||||||
|
<node x="187.0" y="0.0">droolscours.Account</node>
|
||||||
|
<node x="0.0" y="158.0">droolscours.AccountingPeriod</node>
|
||||||
|
<node x="0.0" y="0.0">droolscours.CashFlow</node>
|
||||||
|
</nodes>
|
||||||
|
<notes />
|
||||||
|
<edges />
|
||||||
|
<settings isCamel="false" isColorManagerEnabled="true" isShowDependencies="false" isVcsFilterEnabled="false" layout="Hierarchic Group" zoom="1.0" x="71.5" y="88.5" />
|
||||||
|
<SelectedNodes />
|
||||||
|
<Categories>
|
||||||
|
<Category>Fields</Category>
|
||||||
|
</Categories>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
<component name="masterDetails">
|
||||||
|
<states>
|
||||||
|
<state key="ArtifactsStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<artifact-editor />
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="FacetStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>Android</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="GlobalLibrariesConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="JdkListConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>1.6</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ModuleStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>demodrools</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
<option value="0.5" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ProjectLibrariesConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
</states>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
||||||
16
demodrools/demodrools.iml
Normal file
16
demodrools/demodrools.iml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.2" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
||||||
44
demodrools/pom.xml
Normal file
44
demodrools/pom.xml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.pymma-software.droolscourse</groupId>
|
||||||
|
<artifactId>droolscourse</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>demodrools</artifactId>
|
||||||
|
<name>demodrools</name>
|
||||||
|
<description>demodrools</description>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.8.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
59
demodrools/src/main/java/demo/Card.java
Normal file
59
demodrools/src/main/java/demo/Card.java
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
public class Card {
|
||||||
|
private String number;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Customer customer;
|
||||||
|
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomer(Customer customer) {
|
||||||
|
this.customer = customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartType(String cartType) {
|
||||||
|
this.cartType = cartType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String cartType;
|
||||||
|
|
||||||
|
public Card(String number, String cartName, String cartType,
|
||||||
|
String customerID, String name, String surname, String maritalName,
|
||||||
|
Gender gender) {
|
||||||
|
this.number = number;
|
||||||
|
this.name = cartName;
|
||||||
|
this.cartType = cartType;
|
||||||
|
this.customer = new Customer(customerID, name, surname, maritalName,
|
||||||
|
gender, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCartType() {
|
||||||
|
return cartType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customer getCustomer() {
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
5
demodrools/src/main/java/demo/Currency.java
Normal file
5
demodrools/src/main/java/demo/Currency.java
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
public enum Currency {
|
||||||
|
Euro, Dollar, Yen
|
||||||
|
}
|
||||||
77
demodrools/src/main/java/demo/Customer.java
Normal file
77
demodrools/src/main/java/demo/Customer.java
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class Customer {
|
||||||
|
private String customerID;
|
||||||
|
private String surName;
|
||||||
|
private String name;
|
||||||
|
private String maritalName;
|
||||||
|
private Gender gender;
|
||||||
|
private Date birthDate;
|
||||||
|
|
||||||
|
public String getCustomerID() {
|
||||||
|
return customerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerID(String customerID) {
|
||||||
|
this.customerID = customerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurName() {
|
||||||
|
return surName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurName(String surName) {
|
||||||
|
this.surName = surName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaritalName() {
|
||||||
|
return maritalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaritalName(String maritalName) {
|
||||||
|
this.maritalName = maritalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Gender getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(Gender gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBirthDate() {
|
||||||
|
return birthDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthDate(Date birthDate) {
|
||||||
|
this.birthDate = birthDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customer(String customerID, String surName, String name,
|
||||||
|
String maritalName, Gender gender, Date birthDate) {
|
||||||
|
super();
|
||||||
|
this.customerID = customerID;
|
||||||
|
this.surName = surName;
|
||||||
|
this.name = name;
|
||||||
|
this.maritalName = maritalName;
|
||||||
|
this.gender = gender;
|
||||||
|
this.birthDate = birthDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customer() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
5
demodrools/src/main/java/demo/Gender.java
Normal file
5
demodrools/src/main/java/demo/Gender.java
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
public enum Gender {
|
||||||
|
Mr,Mrs,Miss
|
||||||
|
}
|
||||||
35
demodrools/src/main/java/demo/Price.java
Normal file
35
demodrools/src/main/java/demo/Price.java
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
public class Price {
|
||||||
|
|
||||||
|
private Float price;
|
||||||
|
private Currency currency;
|
||||||
|
|
||||||
|
public Float getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Float price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Currency getCurrency() {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrency(Currency currency) {
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Price(Float price, Currency currency) {
|
||||||
|
super();
|
||||||
|
this.price = price;
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Price() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
84
demodrools/src/main/java/demo/Product.java
Normal file
84
demodrools/src/main/java/demo/Product.java
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class Product {
|
||||||
|
|
||||||
|
private String Id;
|
||||||
|
private String Name;
|
||||||
|
private Map<Date, Map<Currency, Price>> prices = new HashMap<Date, Map<Currency, Price>>();
|
||||||
|
private Provider provider;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Provider getProvider() {
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvider(Provider provider) {
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product(String id, String name, Provider provider) {
|
||||||
|
super();
|
||||||
|
Id = id;
|
||||||
|
Name = name;
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Date startTime, Float price, Currency currency) {
|
||||||
|
if (prices.containsKey(startTime) == false) {
|
||||||
|
Price newprice = new Price(price, currency);
|
||||||
|
Map<Currency, Price> priceMap = new HashMap<Currency, Price>();
|
||||||
|
priceMap.put(currency, newprice);
|
||||||
|
prices.put(startTime, priceMap);
|
||||||
|
} else {
|
||||||
|
Map<Currency, Price> priceMap = prices.get(startTime);
|
||||||
|
if (priceMap.containsKey(currency) == false) {
|
||||||
|
Price aNewPrice = new Price(price, currency);
|
||||||
|
priceMap.put(currency, aNewPrice);
|
||||||
|
} else {
|
||||||
|
Price aExistingPrice = priceMap.get(currency);
|
||||||
|
aExistingPrice.setPrice(price);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delPrice(DateTime startTime) {
|
||||||
|
if (prices.containsKey(startTime) == true) {
|
||||||
|
prices.remove(startTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Date, Map<Currency, Price>> getPrices() {
|
||||||
|
return prices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrices(Map<Date, Map<Currency, Price>> prices) {
|
||||||
|
this.prices = prices;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
34
demodrools/src/main/java/demo/Provider.java
Normal file
34
demodrools/src/main/java/demo/Provider.java
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
public class Provider {
|
||||||
|
private String name;
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Provider(String name, String country) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Provider() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
85
demodrools/src/main/java/demo/Ticket.java
Normal file
85
demodrools/src/main/java/demo/Ticket.java
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Ticket {
|
||||||
|
|
||||||
|
private String Id;
|
||||||
|
private Date date;
|
||||||
|
private Float amount;
|
||||||
|
private Card loyaltyCard;
|
||||||
|
private Customer customer;
|
||||||
|
|
||||||
|
public Customer getCustomer() {
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomer(Customer customer) {
|
||||||
|
this.customer = customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card getLoyaltyCard() {
|
||||||
|
return loyaltyCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoyaltyCard(Card loyaltyCard) {
|
||||||
|
this.loyaltyCard = loyaltyCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TicketLine> ticketLines = new ArrayList<TicketLine>();
|
||||||
|
|
||||||
|
public long AddLine(Product product, Float price, long quantity) {
|
||||||
|
TicketLine newLine = new TicketLine(this, product, quantity, price);
|
||||||
|
ticketLines.add(newLine);
|
||||||
|
this.amount = this.amount + newLine.getLineTotal();
|
||||||
|
return newLine.getLineNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delLine(int lineNumber) {
|
||||||
|
if (lineNumber <= this.ticketLines.size()) {
|
||||||
|
TicketLine lineToDel = this.ticketLines.get(lineNumber);
|
||||||
|
lineToDel.setValid(false);
|
||||||
|
this.amount = this.amount-lineToDel.getLineTotal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ticket() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(Float amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TicketLine> getTicketLines() {
|
||||||
|
return ticketLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicketLines(List<TicketLine> ticketLines) {
|
||||||
|
this.ticketLines = ticketLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
97
demodrools/src/main/java/demo/TicketLine.java
Normal file
97
demodrools/src/main/java/demo/TicketLine.java
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
package demo;
|
||||||
|
|
||||||
|
public class TicketLine {
|
||||||
|
private static int numberLines = 0;
|
||||||
|
private Ticket ticket;
|
||||||
|
private int lineNumber;
|
||||||
|
|
||||||
|
private Product product;
|
||||||
|
private long quantity;
|
||||||
|
private Float price = null;
|
||||||
|
private Float lineTotal;;
|
||||||
|
|
||||||
|
private boolean valid;
|
||||||
|
|
||||||
|
public int getLineNumber() {
|
||||||
|
return lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getLineTotal() {
|
||||||
|
return lineTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValid(boolean valid) {
|
||||||
|
this.valid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ticket getTicket() {
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicket(Ticket ticket) {
|
||||||
|
this.ticket = ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product getProduct() {
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProduct(Product product) {
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TicketLine(Ticket ticket, Product product, long quantity, Float price) {
|
||||||
|
super();
|
||||||
|
numberLines = numberLines + 1;
|
||||||
|
this.lineNumber = numberLines;
|
||||||
|
this.ticket = ticket;
|
||||||
|
this.product = product;
|
||||||
|
this.quantity = quantity;
|
||||||
|
this.price = price;
|
||||||
|
this.lineTotal = price * quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(long quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Float price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TicketLine() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getNumberLines() {
|
||||||
|
return numberLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNumberLines(int numberLines) {
|
||||||
|
TicketLine.numberLines = numberLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineNumber(int lineNumber) {
|
||||||
|
this.lineNumber = lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineTotal(Float lineTotal) {
|
||||||
|
this.lineTotal = lineTotal;
|
||||||
|
}
|
||||||
|
public void AddProductToTicketLine(Product p){
|
||||||
|
this.product = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
demodrools/src/main/java/service/TickerService.java
Normal file
40
demodrools/src/main/java/service/TickerService.java
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
package service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import demo.Product;
|
||||||
|
import demo.Ticket;
|
||||||
|
import demo.TicketLine;
|
||||||
|
|
||||||
|
public class TickerService {
|
||||||
|
public void CalculateAmountTicket(Ticket ticket) {
|
||||||
|
if (ticket != null) {
|
||||||
|
Float total = new Float(0.0);
|
||||||
|
for (TicketLine line : ticket.getTicketLines()) {
|
||||||
|
total = total + line.getQuantity() * line.getPrice();
|
||||||
|
}
|
||||||
|
ticket.setAmount(total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CalculateTicketLineAmount(TicketLine line) {
|
||||||
|
if (line != null) {
|
||||||
|
Float total = new Float(0.0);
|
||||||
|
total = line.getQuantity() * line.getPrice();
|
||||||
|
line.setLineTotal(total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CalculateTicketLinesAmount(List<TicketLine> lines) {
|
||||||
|
if (lines != null) {
|
||||||
|
Float total = new Float(0.0);
|
||||||
|
for (TicketLine aLine : lines) {
|
||||||
|
total = aLine.getQuantity() * aLine.getPrice();
|
||||||
|
aLine.setLineTotal(total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void addProductTicket(Product p, TicketLine t){
|
||||||
|
t.setProduct(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
demodrools/src/main/java/util/DateHelper.java
Normal file
20
demodrools/src/main/java/util/DateHelper.java
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DateHelper {
|
||||||
|
public static String sFormat = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static Date getDate(String sDate) throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
|
||||||
|
return sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date getDate(String sDate, String anotherFormat)
|
||||||
|
throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(anotherFormat);
|
||||||
|
return sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
droolscourse.iml
Normal file
24
droolscourse.iml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="Spring" name="Spring">
|
||||||
|
<configuration>
|
||||||
|
<fileset id="fileset" name="Spring Application Context" removed="false">
|
||||||
|
<file>file://$MODULE_DIR$/LoyaltyServer/src/main/webapp/META-INF/applicationContext.xml</file>
|
||||||
|
<file>file://$MODULE_DIR$/LoyaltyServer/build/classes/WEB-INF/beans.xml</file>
|
||||||
|
<file>file://$MODULE_DIR$/LoyaltyServer/target/LoyaltyServer-1.0-SNAPSHOT/META-INF/applicationContext.xml</file>
|
||||||
|
</fileset>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
|
<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>
|
||||||
|
|
||||||
91
pom.xml
Normal file
91
pom.xml
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.pymma-software.droolscourse</groupId>
|
||||||
|
<artifactId>droolscourse</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>AccountProject</module>
|
||||||
|
<module>demodrools</module>
|
||||||
|
<module>simpleWebApp</module>
|
||||||
|
</modules>
|
||||||
|
<properties>
|
||||||
|
|
||||||
|
<junit-version>4.5</junit-version>
|
||||||
|
<cxf.version>2.2.6</cxf.version>
|
||||||
|
<spring-version>3.0.1.RELEASE</spring-version>
|
||||||
|
<commons-logging-version>1.1.1</commons-logging-version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.drools</groupId>
|
||||||
|
<artifactId>drools-compiler</artifactId>
|
||||||
|
<version>5.6.0.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jdt.core.compiler</groupId>
|
||||||
|
<artifactId>ecj</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jbpm</groupId>
|
||||||
|
<artifactId>jbpm-bpmn2</artifactId>
|
||||||
|
<version>5.5.0.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Apache CXF dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||||
|
<version>${cxf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-transports-http</artifactId>
|
||||||
|
<version>${cxf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
<version>${spring-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
<version>${spring-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Logging -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>${commons-logging-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Testing -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
||||||
88
simpleWebApp/pom.xml
Normal file
88
simpleWebApp/pom.xml
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.pymma-software.droolscourse</groupId>
|
||||||
|
<artifactId>droolscourse</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
|
<artifactId>simpleWebApp</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>Calculation Service WebApp</name>
|
||||||
|
<url>http://www.springframework.org/spring-ws</url>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<build>
|
||||||
|
<finalName>simpleWebApp</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.tomcat.maven</groupId>
|
||||||
|
<artifactId>tomcat6-maven-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
|
||||||
|
</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>
|
||||||
|
<!-- Apache CXF dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-transports-http</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Logging -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Testing -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
92
simpleWebApp/simpleWebApp.iml
Normal file
92
simpleWebApp/simpleWebApp.iml
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="web" name="Web">
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" />
|
||||||
|
</descriptors>
|
||||||
|
<webroots>
|
||||||
|
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
|
||||||
|
</webroots>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
<facet type="Spring" name="Spring">
|
||||||
|
<configuration>
|
||||||
|
<fileset id="fileset" name="Spring Application Context" removed="false">
|
||||||
|
<file>file://$MODULE_DIR$/src/main/webapp/WEB-INF/spring-ws-servlet.xml</file>
|
||||||
|
</fileset>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/webapp" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:drools-compiler:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:drools-core:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.1.8.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:knowledge-api:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.drools:knowledge-internal-api:5.6.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.antlr:antlr:3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.antlr:stringtemplate:3.2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:3.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.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: org.jbpm:jbpm-bpmn2:5.5.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:5.5.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:5.5.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:2.5.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-jaxws:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: xml-resolver:xml-resolver:1.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-jaxws_2.1_spec:1.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-activation_1.1_spec:1.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-ws-metadata_2.0_spec:1.1.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: asm:asm:2.2.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-api:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-common-utilities:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-asm:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-annotation_1.0_spec:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: wsdl4j:wsdl4j:1.6.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.ws.commons.schema:XmlSchema:1.4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.codehaus.woodstox:wstx-asl:3.2.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.neethi:neethi:2.0.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-common-schemas:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-core:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.1.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-javamail_1.4_spec:1.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-bindings-soap:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-tools-common:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.xml.soap:saaj-api:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-databinding-jaxb:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-bindings-xml:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-frontend-simple:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-ws-addr:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.sun.xml.messaging.saaj:saaj-impl:1.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.cxf:cxf-rt-transports-http:2.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:3.0.1.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.5" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package droolscours.loyalty;
|
||||||
|
|
||||||
|
import droolscours.loyalty.domains.Ticket;
|
||||||
|
|
||||||
|
import javax.jws.WebMethod;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService
|
||||||
|
public interface IServiceCalculate {
|
||||||
|
|
||||||
|
@WebMethod(operationName = "calculate")
|
||||||
|
public abstract Ticket calculate( Ticket ticket);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package droolscours.loyalty;
|
||||||
|
|
||||||
|
import droolscours.loyalty.domains.Ticket;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import util.KnowledgeSessionHelper;
|
||||||
|
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService(endpointInterface = "droolscours.loyalty.IServiceCalculate")
|
||||||
|
public class ServiceCalculate implements IServiceCalculate{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* droolscours.loyalty.IServiceCalculate#calculate(droolscours.loyalty.domains
|
||||||
|
* .Ticket)
|
||||||
|
*/
|
||||||
|
private StatefulKnowledgeSession sessionStatefull = null;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Ticket calculate( Ticket ticket) {
|
||||||
|
sessionStatefull = KnowledgeSessionHelper
|
||||||
|
.getStatefulKnowledgeSession("File1.drl");
|
||||||
|
sessionStatefull.insert(ticket);
|
||||||
|
sessionStatefull.fireAllRules();
|
||||||
|
System.out.println("Works");
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public class Card {
|
||||||
|
private String number;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Customer customer;
|
||||||
|
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomer(Customer customer) {
|
||||||
|
this.customer = customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartType(String cartType) {
|
||||||
|
this.cartType = cartType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String cartType;
|
||||||
|
|
||||||
|
public Card(String number, String cartName, String cartType,
|
||||||
|
String customerID, String name, String surname, String maritalName,
|
||||||
|
Gender gender) {
|
||||||
|
this.number = number;
|
||||||
|
this.name = cartName;
|
||||||
|
this.cartType = cartType;
|
||||||
|
this.customer = new Customer(customerID, name, surname, maritalName,
|
||||||
|
gender, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCartType() {
|
||||||
|
return cartType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customer getCustomer() {
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public enum Currency {
|
||||||
|
Euro, Dollar, Yen
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class Customer {
|
||||||
|
private String customerID;
|
||||||
|
private String surName;
|
||||||
|
private String name;
|
||||||
|
private String maritalName;
|
||||||
|
private Gender gender;
|
||||||
|
private Date birthDate;
|
||||||
|
|
||||||
|
public String getCustomerID() {
|
||||||
|
return customerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerID(String customerID) {
|
||||||
|
this.customerID = customerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurName() {
|
||||||
|
return surName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurName(String surName) {
|
||||||
|
this.surName = surName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaritalName() {
|
||||||
|
return maritalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaritalName(String maritalName) {
|
||||||
|
this.maritalName = maritalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Gender getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(Gender gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBirthDate() {
|
||||||
|
return birthDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthDate(Date birthDate) {
|
||||||
|
this.birthDate = birthDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customer(String customerID, String surName, String name,
|
||||||
|
String maritalName, Gender gender, Date birthDate) {
|
||||||
|
super();
|
||||||
|
this.customerID = customerID;
|
||||||
|
this.surName = surName;
|
||||||
|
this.name = name;
|
||||||
|
this.maritalName = maritalName;
|
||||||
|
this.gender = gender;
|
||||||
|
this.birthDate = birthDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Customer() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public enum Gender {
|
||||||
|
Mr,Mrs,Miss
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public class Ligneop {
|
||||||
|
private String nomOP;
|
||||||
|
private Float montantReduction;
|
||||||
|
public String getNomOP() {
|
||||||
|
return nomOP;
|
||||||
|
}
|
||||||
|
public void setNomOP(String nomOP) {
|
||||||
|
this.nomOP = nomOP;
|
||||||
|
}
|
||||||
|
public Float getMontantReduction() {
|
||||||
|
return montantReduction;
|
||||||
|
}
|
||||||
|
public void setMontantReduction(Float montantReduction) {
|
||||||
|
this.montantReduction = montantReduction;
|
||||||
|
}
|
||||||
|
public Ligneop() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public class Price {
|
||||||
|
|
||||||
|
private Float price;
|
||||||
|
private Currency currency;
|
||||||
|
|
||||||
|
public Float getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Float price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Currency getCurrency() {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrency(Currency currency) {
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Price(Float price, Currency currency) {
|
||||||
|
super();
|
||||||
|
this.price = price;
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Price() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public class Product {
|
||||||
|
|
||||||
|
private String Id;
|
||||||
|
private String Name;
|
||||||
|
private Price price;
|
||||||
|
|
||||||
|
public Price getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Price price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Provider provider;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Provider getProvider() {
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvider(Provider provider) {
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product(String id, String name, Provider provider) {
|
||||||
|
super();
|
||||||
|
Id = id;
|
||||||
|
Name = name;
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public class Provider {
|
||||||
|
private String name;
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Provider(String name, String country) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Provider() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Ticket {
|
||||||
|
|
||||||
|
private String Id;
|
||||||
|
private Date date;
|
||||||
|
private Float amount;
|
||||||
|
private Card loyaltyCard;
|
||||||
|
private Customer customer;
|
||||||
|
|
||||||
|
public Customer getCustomer() {
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomer(Customer customer) {
|
||||||
|
this.customer = customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card getLoyaltyCard() {
|
||||||
|
return loyaltyCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoyaltyCard(Card loyaltyCard) {
|
||||||
|
this.loyaltyCard = loyaltyCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<TicketLine> ticketLines = new ArrayList<TicketLine>();
|
||||||
|
|
||||||
|
public long AddLine(Product product, Float price, long quantity) {
|
||||||
|
TicketLine newLine = new TicketLine(this, product, quantity, price);
|
||||||
|
ticketLines.add(newLine);
|
||||||
|
this.amount = this.amount + newLine.getLineTotal();
|
||||||
|
return newLine.getLineNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delLine(int lineNumber) {
|
||||||
|
if (lineNumber <= this.ticketLines.size()) {
|
||||||
|
TicketLine lineToDel = this.ticketLines.get(lineNumber);
|
||||||
|
lineToDel.setValid(false);
|
||||||
|
this.amount = this.amount-lineToDel.getLineTotal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ticket() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(Float amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TicketLine> getTicketLines() {
|
||||||
|
return ticketLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicketLines(List<TicketLine> ticketLines) {
|
||||||
|
this.ticketLines = ticketLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
package droolscours.loyalty.domains;
|
||||||
|
|
||||||
|
public class TicketLine {
|
||||||
|
private static int numberLines = 0;
|
||||||
|
private String ticketID;
|
||||||
|
private Ticket ticket;
|
||||||
|
private int lineNumber;
|
||||||
|
private String productID;
|
||||||
|
private Product product;
|
||||||
|
private long quantity;
|
||||||
|
private Float price = null;
|
||||||
|
private Float lineTotal;;
|
||||||
|
private Ligneop op;
|
||||||
|
public Ligneop getOp() {
|
||||||
|
return op;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductID() {
|
||||||
|
return productID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductID(String productID) {
|
||||||
|
this.productID = productID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTicketID() {
|
||||||
|
return this.ticketID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicketID(String ticketID) {
|
||||||
|
this.ticketID = ticketID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOp(Ligneop op) {
|
||||||
|
this.op = op;
|
||||||
|
}
|
||||||
|
private boolean valid;
|
||||||
|
|
||||||
|
public int getLineNumber() {
|
||||||
|
return lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getLineTotal() {
|
||||||
|
return lineTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValid(boolean valid) {
|
||||||
|
this.valid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ticket getTicket() {
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicket(Ticket ticket) {
|
||||||
|
this.ticket = ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product getProduct() {
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProduct(Product product) {
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TicketLine(Ticket ticket, Product product, long quantity, Float price) {
|
||||||
|
super();
|
||||||
|
numberLines = numberLines + 1;
|
||||||
|
this.lineNumber = numberLines;
|
||||||
|
this.ticket = ticket;
|
||||||
|
this.product = product;
|
||||||
|
this.quantity = quantity;
|
||||||
|
this.price = price;
|
||||||
|
this.lineTotal = price * quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(long quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Float price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TicketLine() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getNumberLines() {
|
||||||
|
return numberLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNumberLines(int numberLines) {
|
||||||
|
TicketLine.numberLines = numberLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineNumber(int lineNumber) {
|
||||||
|
this.lineNumber = lineNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineTotal(Float lineTotal) {
|
||||||
|
this.lineTotal = lineTotal;
|
||||||
|
}
|
||||||
|
public void AddProductToTicketLine(Product p){
|
||||||
|
this.product = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
20
simpleWebApp/src/main/java/util/DateHelper.java
Normal file
20
simpleWebApp/src/main/java/util/DateHelper.java
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DateHelper {
|
||||||
|
public static String sFormat = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static Date getDate(String sDate) throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
|
||||||
|
return sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date getDate(String sDate, String anotherFormat)
|
||||||
|
throws Exception {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(anotherFormat);
|
||||||
|
return sdf.parse(sDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
132
simpleWebApp/src/main/java/util/KnowledgeSessionHelper.java
Normal file
132
simpleWebApp/src/main/java/util/KnowledgeSessionHelper.java
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
import org.drools.KnowledgeBase;
|
||||||
|
import org.drools.KnowledgeBaseFactory;
|
||||||
|
import org.drools.builder.KnowledgeBuilder;
|
||||||
|
import org.drools.builder.KnowledgeBuilderError;
|
||||||
|
import org.drools.builder.KnowledgeBuilderErrors;
|
||||||
|
import org.drools.builder.KnowledgeBuilderFactory;
|
||||||
|
import org.drools.builder.ResourceType;
|
||||||
|
import org.drools.event.rule.*;
|
||||||
|
import org.drools.io.ResourceFactory;
|
||||||
|
import org.drools.runtime.StatefulKnowledgeSession;
|
||||||
|
import org.drools.runtime.StatelessKnowledgeSession;
|
||||||
|
|
||||||
|
public class KnowledgeSessionHelper {
|
||||||
|
private static KnowledgeBase ruleBase = null;
|
||||||
|
|
||||||
|
private static KnowledgeBase createRuleBase(String drlFile) {
|
||||||
|
|
||||||
|
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
|
||||||
|
.newKnowledgeBuilder();
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource(drlFile),
|
||||||
|
ResourceType.DRL);
|
||||||
|
KnowledgeBuilderErrors errors = kbuilder.getErrors();
|
||||||
|
if (errors.size() > 0) {
|
||||||
|
for (KnowledgeBuilderError error : errors) {
|
||||||
|
System.err.println(error);
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Probleme a la lecture du fichier.");
|
||||||
|
}
|
||||||
|
ruleBase = KnowledgeBaseFactory.newKnowledgeBase();
|
||||||
|
ruleBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
|
||||||
|
return ruleBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatelessKnowledgeSession getStatelessKnowledgeSession(
|
||||||
|
String drlFile) {
|
||||||
|
if (ruleBase == null) {
|
||||||
|
ruleBase = createRuleBase(drlFile);
|
||||||
|
}
|
||||||
|
return ruleBase.newStatelessKnowledgeSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatefulKnowledgeSession getStatefulKnowledgeSession(
|
||||||
|
String drlFile) {
|
||||||
|
if (ruleBase == null) {
|
||||||
|
ruleBase = createRuleBase(drlFile);
|
||||||
|
}
|
||||||
|
return ruleBase.newStatefulKnowledgeSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatefulKnowledgeSession getStatefulKnowledgeSessionWithCallback(
|
||||||
|
String drlFile) {
|
||||||
|
StatefulKnowledgeSession session = getStatefulKnowledgeSession(drlFile);
|
||||||
|
session.addEventListener(new WorkingMemoryEventListener() {
|
||||||
|
@Override
|
||||||
|
public void objectUpdated(ObjectUpdatedEvent arg0) {
|
||||||
|
System.out.println("Object mise à jour \n"
|
||||||
|
+ "Nouvelles valeurs \n" + arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectRetracted(ObjectRetractedEvent arg0) {
|
||||||
|
System.out.println("Object retiré \n"
|
||||||
|
+ arg0.getOldObject().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void objectInserted(ObjectInsertedEvent arg0) {
|
||||||
|
System.out.println("Object inséré \n"
|
||||||
|
+ arg0.getObject().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
session.addEventListener(new DefaultAgendaEventListener() {
|
||||||
|
@Override
|
||||||
|
public void beforeActivationFired(BeforeActivationFiredEvent arg0) {
|
||||||
|
System.out.println("La règle "
|
||||||
|
+ arg0.getActivation().getRule().getName()
|
||||||
|
+ " va être déclenchée");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void agendaGroupPushed(AgendaGroupPushedEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void agendaGroupPopped(AgendaGroupPoppedEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterActivationFired(AfterActivationFiredEvent arg0) {
|
||||||
|
System.out.println("La règle "
|
||||||
|
+ arg0.getActivation().getRule().getName()
|
||||||
|
+ " a êté déclenchée");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activationCreated(ActivationCreatedEvent arg0) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activationCancelled(ActivationCancelledEvent arg0) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatefulKnowledgeSession getStatefulKnowledgeSession(
|
||||||
|
String drlFile, String rfFile) {
|
||||||
|
KnowledgeBase ruleBase = null;
|
||||||
|
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
|
||||||
|
.newKnowledgeBuilder();
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource(drlFile),
|
||||||
|
ResourceType.DRL);
|
||||||
|
kbuilder.add(ResourceFactory.newClassPathResource(rfFile),
|
||||||
|
ResourceType.DRF);
|
||||||
|
KnowledgeBuilderErrors errors = kbuilder.getErrors();
|
||||||
|
if (errors.size() > 0) {
|
||||||
|
for (KnowledgeBuilderError error : errors) {
|
||||||
|
System.err.println(error);
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Probleme a la lecture du fichier.");
|
||||||
|
}
|
||||||
|
ruleBase = KnowledgeBaseFactory.newKnowledgeBase();
|
||||||
|
ruleBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
|
||||||
|
return ruleBase.newStatefulKnowledgeSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
34
simpleWebApp/src/main/java/util/MyDate.java
Normal file
34
simpleWebApp/src/main/java/util/MyDate.java
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class MyDate {
|
||||||
|
|
||||||
|
private String uneOp;
|
||||||
|
private Date uneDate1;
|
||||||
|
private Date uneDate2;
|
||||||
|
|
||||||
|
public String getUneOp() {
|
||||||
|
return uneOp;
|
||||||
|
}
|
||||||
|
public void setUneOp(String uneOp) {
|
||||||
|
this.uneOp = uneOp;
|
||||||
|
}
|
||||||
|
public Date getUneDate1() {
|
||||||
|
return uneDate1;
|
||||||
|
}
|
||||||
|
public void setUneDate1(Date uneDate1) {
|
||||||
|
this.uneDate1 = uneDate1;
|
||||||
|
}
|
||||||
|
public Date getUneDate2() {
|
||||||
|
return uneDate2;
|
||||||
|
}
|
||||||
|
public void setUneDate2(Date uneDate2) {
|
||||||
|
this.uneDate2 = uneDate2;
|
||||||
|
}
|
||||||
|
public MyDate() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
simpleWebApp/src/main/java/util/OutputDisplay.java
Normal file
10
simpleWebApp/src/main/java/util/OutputDisplay.java
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
public class OutputDisplay {
|
||||||
|
|
||||||
|
public void showText(String someText) {
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
System.out.println("time=" + time + "-" + someText);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
34
simpleWebApp/src/main/resources/File1.drl
Normal file
34
simpleWebApp/src/main/resources/File1.drl
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
//#created on: 21 nov. 2010
|
||||||
|
package droolscours.loyalty
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import util.MyDate;
|
||||||
|
import droolscours.loyalty.domains.Ticket;
|
||||||
|
import droolscours.loyalty.domains.TicketLine;
|
||||||
|
import droolscours.loyalty.domains.Ligneop;
|
||||||
|
import droolscours.loyalty.domains.Product
|
||||||
|
import util.DateHelper;
|
||||||
|
dialect "MVEL"
|
||||||
|
|
||||||
|
rule "createdateOpPampers"
|
||||||
|
when
|
||||||
|
then
|
||||||
|
MyDate t = new MyDate();
|
||||||
|
t.setUneDate1(DateHelper.getDate("2010-12-01"));
|
||||||
|
t.setUneDate1(DateHelper.getDate("2010-12-31"));
|
||||||
|
t.setUneOp("pampers");
|
||||||
|
insert(t);
|
||||||
|
end
|
||||||
|
rule "opPameprs"
|
||||||
|
when
|
||||||
|
MyDate(uneOp=="pampers",$d1:uneDate1,$d2:uneDate2)
|
||||||
|
$t : Ticket(date >=$d1,date <=$d2)
|
||||||
|
$l : TicketLine(ticketID==$t.Id)
|
||||||
|
$p : Product(Id == $l.productID , name=="pampers")
|
||||||
|
then
|
||||||
|
$l.setOp(new Ligneop());
|
||||||
|
$l.getOp().setMontantReduction(new Float($l.getLineTotal()*0.2));
|
||||||
|
$l.getOp().setNomOP("opPameprs");
|
||||||
|
end
|
||||||
|
|
||||||
15
simpleWebApp/src/main/resources/application-context.xml
Normal file
15
simpleWebApp/src/main/resources/application-context.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
|
||||||
|
|
||||||
|
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
||||||
|
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
|
||||||
|
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
|
||||||
|
|
||||||
|
<!-- Spring manage ServiceBean -->
|
||||||
|
<bean id="calculateService" class="droolscours.loyalty.ServiceCalculate" />
|
||||||
|
|
||||||
|
<!-- JAX-WS Service Endpoint -->
|
||||||
|
<jaxws:endpoint id="personService" implementor="#calculateService" address="/calculateService" />
|
||||||
|
|
||||||
|
</beans>
|
||||||
28
simpleWebApp/src/main/webapp/WEB-INF/web.xml
Normal file
28
simpleWebApp/src/main/webapp/WEB-INF/web.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
|
||||||
|
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||||
|
|
||||||
|
<display-name>CXF Example Webservice</display-name>
|
||||||
|
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
|
||||||
|
<context-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath:application-context.xml</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>CXFServlet</servlet-name>
|
||||||
|
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>CXFServlet</servlet-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
</web-app>
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue