Refactor SimpleWebApp in two projects
This commit is contained in:
parent
a04888e7c8
commit
4d7a77d2b5
26 changed files with 180 additions and 57 deletions
|
|
@ -1,59 +0,0 @@
|
|||
package droolscours.loyalty;
|
||||
|
||||
import droolscours.loyalty.domains.Ticket;
|
||||
import org.chtijbug.drools.runtime.DroolsChtijbugException;
|
||||
import org.chtijbug.drools.runtime.RuleBaseBuilder;
|
||||
import org.chtijbug.drools.runtime.RuleBasePackage;
|
||||
import org.chtijbug.drools.runtime.RuleBaseSession;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.CoursHistoryContainer;
|
||||
|
||||
import javax.jws.WebParam;
|
||||
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)
|
||||
*/
|
||||
/**
|
||||
* Class Logger
|
||||
*/
|
||||
private static Logger logger = LoggerFactory.getLogger(ServiceCalculate.class);
|
||||
|
||||
|
||||
private RuleBasePackage ruleBasePackage = null;
|
||||
|
||||
@Override
|
||||
public Ticket calculate(@WebParam(name = "ticket") Ticket ticket) {
|
||||
if (ruleBasePackage == null) {
|
||||
|
||||
try {
|
||||
CoursHistoryContainer coursHistoryContainer = new CoursHistoryContainer();
|
||||
ruleBasePackage= RuleBaseBuilder.createPackageBasePackageWithListener(coursHistoryContainer, "File1.drl");
|
||||
//ruleBasePackage= RuleBaseBuilder.createGuvnorRuleBasePackageWithListener(coursHistoryContainer,"http://localhost:8080", "drools-guvnor", "mypackage","1.27.0-PROD",
|
||||
// "admin", "admin");
|
||||
} catch (DroolsChtijbugException e) {
|
||||
logger.error("Could not create RuleBase", e);
|
||||
}
|
||||
}
|
||||
|
||||
RuleBaseSession sessionStatefull = null;
|
||||
try {
|
||||
sessionStatefull = ruleBasePackage.createRuleBaseSession();
|
||||
sessionStatefull.insertByReflection(ticket);
|
||||
sessionStatefull.fireAllRules();
|
||||
// System.out.println(sessionStatefull.getHistoryContainer().getListHistoryEvent().toString());
|
||||
} catch (DroolsChtijbugException e) {
|
||||
logger.error("Error in fireallrules", e);
|
||||
}
|
||||
|
||||
return ticket;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package droolscours.loyalty.domains;
|
||||
|
||||
public enum Currency {
|
||||
Euro, Dollar, Yen
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package droolscours.loyalty.domains;
|
||||
|
||||
public enum Gender {
|
||||
Mr,Mrs,Miss
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
package droolscours.loyalty.domains;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class Ticket {
|
||||
|
||||
private String Id;
|
||||
private Date dateTicket;
|
||||
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 getDateTicket() {
|
||||
return dateTicket;
|
||||
}
|
||||
|
||||
public void setDateTicket(Date date) {
|
||||
this.dateTicket = 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package droolscours.loyalty;
|
||||
package loyalty.service;
|
||||
|
||||
import droolscours.loyalty.domains.Ticket;
|
||||
import loyalty.domains.Ticket;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebService;
|
||||
|
|
@ -9,6 +9,6 @@ import javax.jws.WebService;
|
|||
public interface IServiceCalculate {
|
||||
|
||||
@WebMethod(operationName = "calculate")
|
||||
public abstract Ticket calculate( Ticket ticket);
|
||||
public abstract Ticket calculate(Ticket ticket);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package loyalty.service;
|
||||
|
||||
import loyalty.DroolsServiceCalculate;
|
||||
import loyalty.domains.Ticket;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
|
||||
@WebService(endpointInterface = "loyalty.service.IServiceCalculate")
|
||||
public class ServiceCalculate implements IServiceCalculate {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* IDroolsServiceCalculate#calculate(droolscours.loyalty.domains
|
||||
* .Ticket)
|
||||
*/
|
||||
/**
|
||||
* Class Logger
|
||||
*/
|
||||
private static Logger logger = LoggerFactory.getLogger(DroolsServiceCalculate.class);
|
||||
|
||||
|
||||
|
||||
|
||||
private DroolsServiceCalculate droolsServiceCalculate;
|
||||
|
||||
public void setDroolsServiceCalculate(DroolsServiceCalculate droolsServiceCalculate) {
|
||||
this.droolsServiceCalculate = droolsServiceCalculate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ticket calculate(@WebParam(name = "ticket") Ticket ticket) {
|
||||
|
||||
droolsServiceCalculate.calculate(ticket);
|
||||
return ticket;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package util;
|
||||
|
||||
import org.chtijbug.drools.entity.history.HistoryEvent;
|
||||
import org.chtijbug.drools.runtime.DroolsChtijbugException;
|
||||
import org.chtijbug.drools.runtime.listener.HistoryListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* Date: 14/02/14
|
||||
* Time: 11:47
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class CoursHistoryContainer implements HistoryListener {
|
||||
/**
|
||||
* Class Logger
|
||||
*/
|
||||
private static Logger logger = LoggerFactory.getLogger(CoursHistoryContainer.class);
|
||||
|
||||
@Override
|
||||
public void fireEvent(HistoryEvent historyEvent) throws DroolsChtijbugException {
|
||||
logger.info(historyEvent.toString());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package util;
|
||||
|
||||
import droolscours.loyalty.ServiceCalculate;
|
||||
import droolscours.loyalty.domains.Product;
|
||||
import droolscours.loyalty.domains.Ticket;
|
||||
import droolscours.loyalty.domains.TicketLine;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* Date: 14/02/14
|
||||
* Time: 13:12
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
public static void main(String args[]) throws Exception{
|
||||
ServiceCalculate serviceCalculate= new ServiceCalculate();
|
||||
Ticket ticket = new Ticket();
|
||||
ticket.setDateTicket(DateHelper.getDate("2012-01-01"));
|
||||
TicketLine ticketLine = new TicketLine();
|
||||
|
||||
ticket.getTicketLines().add(ticketLine);
|
||||
ticketLine.setLineTotal(new Float("2.0"));
|
||||
Product product = new Product();
|
||||
product.setName("pampers");
|
||||
ticketLine.setProduct(product);
|
||||
serviceCalculate.calculate(ticket);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
//#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.setUneDate2(DateHelper.getDate("2014-12-31"));
|
||||
t.setUneOp("pampers");
|
||||
insert(t);
|
||||
end
|
||||
rule "opPameprs"
|
||||
when
|
||||
MyDate(uneOp=="pampers",$d1:uneDate1,$d2:uneDate2)
|
||||
$p : Product( name=="pampers")
|
||||
$l : TicketLine(product==$p)
|
||||
$t : Ticket(ticketLines contains $l,dateTicket >= $d1 && dateTicket <= $d2)
|
||||
|
||||
then
|
||||
$l.setOp(new Ligneop());
|
||||
$l.getOp().setMontantReduction(new Float($l.getLineTotal()*0.2));
|
||||
$l.getOp().setNomOP("opPameprs");
|
||||
end
|
||||
|
||||
|
|
@ -1,15 +1,20 @@
|
|||
<?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" />
|
||||
<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="aDroolsCalculateService" class="loyalty.DroolsServiceCalculate"/>
|
||||
|
||||
<bean id="calculateService" class="loyalty.service.ServiceCalculate">
|
||||
<property name="droolsServiceCalculate" ref="aDroolsCalculateService"/>
|
||||
</bean>
|
||||
|
||||
<!-- JAX-WS Service Endpoint -->
|
||||
<jaxws:endpoint id="personService" implementor="#calculateService" address="/calculateService"/>
|
||||
|
||||
<!-- JAX-WS Service Endpoint -->
|
||||
<jaxws:endpoint id="personService" implementor="#calculateService" address="/calculateService" />
|
||||
|
||||
</beans>
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue