diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java index 48ddabc8..c072920e 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/ConnectionService.java @@ -61,6 +61,6 @@ public class ConnectionService { throw new IllegalStateException("No url specified for data server"); if(executor.isShutdown() || executor.isTerminated()) throw new IllegalStateException("Service was shut down : unable to send text"); - executor.submit(()->textSender.send(serverUrl, text, listener)); + executor.submit(()->textSender.send(serverUrl, "message="+text, listener)); } } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java index cd9c7521..8cd70e90 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java @@ -12,6 +12,7 @@ import com.pqt.core.entities.messages.Message; import com.pqt.core.entities.messages.MessageType; import com.pqt.core.entities.product.Product; import com.pqt.core.entities.product.ProductUpdate; +import com.pqt.core.entities.sale.LightweightSale; import com.pqt.core.entities.sale.Sale; import com.pqt.core.entities.user_account.Account; @@ -34,7 +35,7 @@ public class QueryExecutor { messageFactory.setAccountService(accountService); } - public void executeSaleQuery(Sale sale, INoItemMessageCallback callback) { + public void executeSaleQuery(LightweightSale sale, INoItemMessageCallback callback) { sendMessage(messageFactory.newSaleMessage(sale), callback, MessageType.ACK_SALE); } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryMessageFactory.java b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryMessageFactory.java index 8849e491..1f41d089 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryMessageFactory.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryMessageFactory.java @@ -5,6 +5,7 @@ import com.pqt.core.communication.IMessageToolFactory; import com.pqt.core.entities.messages.Message; import com.pqt.core.entities.messages.MessageType; import com.pqt.core.entities.product.ProductUpdate; +import com.pqt.core.entities.sale.LightweightSale; import com.pqt.core.entities.sale.Sale; import com.pqt.core.entities.user_account.Account; @@ -27,9 +28,9 @@ class QueryMessageFactory { this.accountService = accountService; } - Message newSaleMessage(Sale sale) { + Message newSaleMessage(LightweightSale sale) { Map fields = new HashMap<>(); - fields.put("sale", messageToolFactory.getObjectFormatter(Sale.class).format(sale)); + fields.put("lightweight_sale", messageToolFactory.getObjectFormatter(LightweightSale.class).format(sale)); return newSimpleMessage(MessageType.QUERY_SALE, fields); } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java index a70bac00..b6a7b40b 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleBuilder.java @@ -3,6 +3,7 @@ package com.pqt.client.module.sale; import com.pqt.client.module.stock.StockDao; import com.pqt.core.entities.members.Client; import com.pqt.core.entities.product.Product; +import com.pqt.core.entities.sale.LightweightSale; import com.pqt.core.entities.sale.Sale; import com.pqt.core.entities.sale.SaleStatus; import com.pqt.core.entities.sale.SaleType; @@ -91,7 +92,11 @@ public class SaleBuilder { } public Sale build() { - return new Sale(0, products, new Date(), orderedWith, orderedBy, orderedFor, type, SaleStatus.PENDING); + return new Sale(0, products, orderedWith, orderedBy, orderedFor, type, SaleStatus.PENDING); } + public LightweightSale buildLightweight(){ + return new LightweightSale(build()); + } + } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java index 7f3235a9..e9a1d0c7 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/sale/SaleService.java @@ -34,7 +34,7 @@ public class SaleService { else saleId = 0; - executor.executeSaleQuery(saleBuilder.build(), new INoItemMessageCallback() { + executor.executeSaleQuery(saleBuilder.buildLightweight(), new INoItemMessageCallback() { @Override public void ack() { eventFirerer.fireSaleValidationSuccess(currentSaleId);