Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------- Class NewPayment
- package messages;
- import java.util.Date;
- public class newPayment implements MessageBody{
- private String userUUID;
- private String invoiceUUID;
- private String productUUID;
- private Integer quantity;
- private Double price;
- private Double totalAmountOpen;
- private Double totalAmountPaid;
- private Boolean isPaid;
- private Integer version;
- private String timestamp;
- public newPayment(String userUUID, String invoiceUUID, String productUUID, Integer quantity, Double price,
- Double totalAmountOpen, Double totalAmountPaid, Boolean isPaid, String timestamp, Integer version) {
- super();
- this.userUUID = userUUID;
- this.invoiceUUID = invoiceUUID;
- this.productUUID = productUUID;
- this.quantity = quantity;
- this.price = price;
- this.totalAmountOpen = totalAmountOpen;
- this.totalAmountPaid = totalAmountPaid;
- this.isPaid = isPaid;
- this.version = version;
- this.timestamp = timestamp;
- }
- public String getUserUUID() {
- return userUUID;
- }
- public void setUserUUID(String userUUID) {
- this.userUUID = userUUID;
- }
- public String getInvoiceUUID() {
- return invoiceUUID;
- }
- public void setInvoiceUUID(String invoiceUUID) {
- this.invoiceUUID = invoiceUUID;
- }
- public String getProductUUID() {
- return productUUID;
- }
- public void setProductUUID(String productUUID) {
- this.productUUID = productUUID;
- }
- public Integer getQuantity() {
- return quantity;
- }
- public void setQuantity(Integer quantity) {
- this.quantity = quantity;
- }
- public Double getPrice() {
- return price;
- }
- public void setPrice(Double price) {
- this.price = price;
- }
- public Double getTotalAmountOpen() {
- return totalAmountOpen;
- }
- public void setTotalAmountOpen(Double totalAmountOpen) {
- this.totalAmountOpen = totalAmountOpen;
- }
- public Double getTotalAmountPaid() {
- return totalAmountPaid;
- }
- public void setTotalAmountPaid(Double totalAmountPaid) {
- this.totalAmountPaid = totalAmountPaid;
- }
- public Boolean getIsPaid() {
- return isPaid;
- }
- public void setIsPaid(Boolean isPaid) {
- this.isPaid = isPaid;
- }
- public Integer getVersion() {
- return version;
- }
- public void setVersion(Integer version) {
- this.version = version;
- }
- public String getTimeStamp() {
- return timestamp;
- }
- public void setTimeStamp(String timestamp) {
- this.timestamp = timestamp;
- }
- public newPayment() {
- super();
- }
- }
- -------------------------------------------------- Class Message
- package messages;
- import java.util.Arrays;
- import java.util.HashMap;
- import logic.Odoo;
- import logic.UUIDHelper;
- public class message {
- private String messageType;
- private MessageBody body;
- public String getMessageType() {
- return messageType;
- }
- public void setMessageType(String messageType) {
- this.messageType = messageType;
- }
- public MessageBody getBody() {
- return body;
- }
- public void setBody(MessageBody body) {
- this.body = body;
- }
- public message() {
- super();
- }
- public message(String messageType, MessageBody body) {
- super();
- this.messageType = messageType;
- this.body = body;
- }
- public boolean processMessage() throws Exception {
- Odoo o = new Odoo();
- switch (messageType) {
- case "newPerson":
- newPerson p = (newPerson)body;
- Integer id = (Integer) o.models.execute("execute_kw",Arrays.asList(o.db,o.uid,o.password,"res.partner","create",Arrays.asList(new HashMap() {{
- put("name",p.getFirstName()+" "+p.getLastName());
- put("email",p.getEmail());
- put("phone","0480090900");
- put("city","Brussels");
- put("zip","1000");
- put("street",p.getAddress());
- put("TaxId","123456789");
- put("customer",true);
- put("employee",false);
- put("x_isRegistered",true);
- put("active",true);}})));
- o.models.execute("execute_kw",Arrays.asList(o.db,o.uid,o.password,"res.partner","write",Arrays.asList(Arrays.asList(id),new HashMap() {{
- put("x_UUID",p.getUUID());
- }})));
- return true;
- case "newPayment":
- //o.models.execute("execute_kw",Arrays.asList(o.db,o.uid,o.password,"res.partner","write",));
- default:
- break;
- }
- return false;
- }
- }
- -------------------Interface MessageBody
- package messages;
- public interface MessageBody {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement