Ajouter examples

This commit is contained in:
Nicolas Héron 2018-08-31 17:05:24 +02:00
commit 25975a0767
527 changed files with 201926 additions and 5 deletions

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<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" />
</component>
</module>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-examples</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-swimming-pool-model</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,85 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
/**
* Created by IntelliJ IDEA.
* Date: 11/09/14
* Time: 10:09
* To change this template use File | Settings | File Templates.
*/
public class Address extends BaseElement {
private String streetNumber;
private String streetName;
private String zipCode;
private String cityName;
private String country;
public Address() {
}
public String getStreetNumber() {
return streetNumber;
}
public void setStreetNumber(String streetNumber) {
this.streetNumber = streetNumber;
}
public String getStreetName() {
return streetName;
}
public void setStreetName(String streetName) {
this.streetName = streetName;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Adress{");
sb.append("streetNumber='").append(streetNumber).append('\'');
sb.append(", streetName='").append(streetName).append('\'');
sb.append(", zipCode='").append(zipCode).append('\'');
sb.append(", cityName='").append(cityName).append('\'');
sb.append(", country='").append(country).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* Date: 12/09/14
* Time: 11:57
* To change this template use File | Settings | File Templates.
*/
public class BaseElement {
private List<CalculatedAttribute> calculatedAttributeList = new ArrayList<>();
public BaseElement() {
}
public List<CalculatedAttribute> getCalculatedAttributeList() {
return calculatedAttributeList;
}
public void setCalculatedAttributeList(List<CalculatedAttribute> calculatedAttributeList) {
this.calculatedAttributeList = calculatedAttributeList;
}
public void addCalculatedElement(CalculatedAttribute calculatedAttribute) {
this.calculatedAttributeList.add(calculatedAttribute);
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("BaseElement{");
sb.append("calculatedAttributeList=").append(calculatedAttributeList);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,98 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
import java.math.BigDecimal;
/**
* Created by IntelliJ IDEA.
* Date: 12/09/14
* Time: 11:52
* To change this template use File | Settings | File Templates.
*/
public class CalculatedAttribute {
private String key;
private String className;
private boolean booleanValue;
private String stringValue;
private BigDecimal bigDecimalValue;
private Integer integerValue;
public CalculatedAttribute() {
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
new Boolean(booleanValue).toString();
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public boolean isBooleanValue() {
return booleanValue;
}
public void setBooleanValue(boolean booleanValue) {
this.booleanValue = booleanValue;
}
public String getStringValue() {
return stringValue;
}
public void setStringValue(String stringValue) {
this.stringValue = stringValue;
}
public BigDecimal getBigDecimalValue() {
return bigDecimalValue;
}
public void setBigDecimalValue(BigDecimal bigDecimalValue) {
this.bigDecimalValue = bigDecimalValue;
}
public Integer getIntegerValue() {
return integerValue;
}
public void setIntegerValue(Integer integerValue) {
this.integerValue = integerValue;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("CalculatedAttribute{");
sb.append("key='").append(key).append('\'');
sb.append(", className='").append(className).append('\'');
sb.append(", booleanValue=").append(booleanValue);
sb.append(", stringValue='").append(stringValue).append('\'');
sb.append(", bigDecimalValue=").append(bigDecimalValue);
sb.append(", integerValue=").append(integerValue);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,20 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
public enum Gender {
male, female
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
import java.util.Date;
public class Period extends BaseElement {
private Date desidedStartDate;
private SeasonType seasonType;
public Period() {
}
public Date getDesidedStartDate() {
return desidedStartDate;
}
public void setDesidedStartDate(Date desidedStartDate) {
this.desidedStartDate = desidedStartDate;
}
public SeasonType getSeasonType() {
return seasonType;
}
public void setSeasonType(SeasonType seasonType) {
this.seasonType = seasonType;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Period{");
sb.append("desidedStartDate=").append(desidedStartDate);
sb.append(", seasonType=").append(seasonType);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,110 @@
package org.chtijbug.example.swimmingpool;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class Person extends BaseElement {
private String name;
private String surname;
private Gender gender;
private Date birthdate;
private List<Price> priceList = new ArrayList<>();
private double age;
private BigDecimal standardPrice;
public Person() {
}
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;
}
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 List<Price> getPriceList() {
return priceList;
}
public void setPriceList(List<Price> priceList) {
this.priceList = priceList;
}
public double getAge() {
return age;
}
public void setAge(double age) {
this.age = age;
}
public void addPrice(Price p) {
this.priceList.add(p);
}
public BigDecimal getStandardPrice() {
return standardPrice;
}
public void setStandardPrice(BigDecimal standardPrice) {
this.standardPrice = standardPrice;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Person{");
sb.append("name='").append(name).append('\'');
sb.append(", surname='").append(surname).append('\'');
sb.append(", gender=").append(gender);
sb.append(", birthdate=").append(birthdate);
sb.append(", priceList=").append(priceList);
sb.append(", age=").append(age);
sb.append(", standardPrice=").append(standardPrice);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
import java.math.BigDecimal;
public class Price {
private BigDecimal amount;
private String description;
private PriceType priceType;
public Price() {
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public PriceType getPriceType() {
return priceType;
}
public void setPriceType(PriceType priceType) {
this.priceType = priceType;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Price{");
sb.append("amount=").append(amount);
sb.append(", description='").append(description).append('\'');
sb.append(", priceType=").append(priceType);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
public enum PriceType {
definitive, promotion, reduction
}

View file

@ -0,0 +1,114 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@XmlRootElement
public class Quote extends BaseElement {
private Date quoteDate;
private Date validUntil;
private Period period;
private Subscription subscription;
private List<Person> personList = new ArrayList<>();
private Address address;
private List<Price> priceList = new ArrayList<>();
private String sessionLogging;
public Quote() {
}
public Period getPeriod() {
return period;
}
public void setPeriod(Period period) {
this.period = period;
}
public Date getQuoteDate() {
return quoteDate;
}
public void setQuoteDate(Date quoteDate) {
this.quoteDate = quoteDate;
}
public Date getValidUntil() {
return validUntil;
}
public void setValidUntil(Date validUntil) {
this.validUntil = validUntil;
}
public Subscription getSubscription() {
return subscription;
}
public void setSubscription(Subscription subscription) {
this.subscription = subscription;
}
public List<Person> getPersonList() {
return personList;
}
public void setPersonList(List<Person> personList) {
this.personList = personList;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public List<Price> getPriceList() {
return priceList;
}
public void setPriceList(List<Price> priceList) {
this.priceList = priceList;
}
public String getSessionLogging() {
return sessionLogging;
}
public void setSessionLogging(String sessionLogging) {
this.sessionLogging = sessionLogging;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Quote{");
sb.append("quoteDate=").append(quoteDate);
sb.append(", validUntil=").append(validUntil);
sb.append(", period=").append(period);
sb.append(", subscription=").append(subscription);
sb.append(", personList=").append(personList);
sb.append(", address=").append(address);
sb.append(", priceList=").append(priceList);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
public enum SeasonType {
day, week, weekend, month, summer, winter, spring, autumn, fullYear
}

View file

@ -0,0 +1,74 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.example.swimmingpool;
import java.math.BigDecimal;
import java.util.Date;
public class Subscription {
private BigDecimal price;
private Date valideFrom;
private Date validUntil;
private String type;
public Subscription() {
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Date getValideFrom() {
return valideFrom;
}
public void setValideFrom(Date valideFrom) {
this.valideFrom = valideFrom;
}
public Date getValidUntil() {
return validUntil;
}
public void setValidUntil(Date validUntil) {
this.validUntil = validUntil;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Subscription{");
sb.append("price=").append(price);
sb.append(", valideFrom=").append(valideFrom);
sb.append(", validUntil=").append(validUntil);
sb.append(", type='").append(type).append('\'');
sb.append('}');
return sb.toString();
}
}