diff --git a/services/src/main/java/ch/hepia/account/AccountService.java b/services/src/main/java/ch/hepia/account/AccountService.java index 3377d9b4c9b76eb4d0978285bf57b03e43ac64f7..21e68f67de925b0cbc4c74213c1327adb22e48cb 100644 --- a/services/src/main/java/ch/hepia/account/AccountService.java +++ b/services/src/main/java/ch/hepia/account/AccountService.java @@ -68,18 +68,18 @@ public class AccountService{ EventCreateAccount e = (EventCreateAccount) obj; accountsDB.addAccount(new Account(accountsDB.nextID(), e.name(), 0.0)); send(new EventAccountCreated(e.id(), "The account is created")); - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if(obj instanceof EventAccountDoesntExist){ EventAccountDoesntExist e = (EventAccountDoesntExist) obj; - System.out.println(e.toString()); + System.out.println(e); send(new EventOrderCancelled(e.id(), "Account used in order doesn't exist")); } //------------------------------------------ if (obj instanceof EventAccountCreated){ EventAccountCreated e = (EventAccountCreated) obj; - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if (obj instanceof EventCreditAnAccount){ @@ -91,7 +91,7 @@ public class AccountService{ else{ send(new EventAccountDoesntExist(e.id(), "The account doesn't exist")); } - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if (obj instanceof EventOrderPlaced){ @@ -105,14 +105,14 @@ public class AccountService{ } else { send(new EventAccountDoesntExist(e.id(), "The account doesn't exist")); } - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if(obj instanceof EventOrderPrepared){ EventOrderPrepared e = (EventOrderPrepared) obj; accountsDB.withdrawCreditAccount(e.idAccount(), e.price()); send(new EventCreditWithdrawn(e.id(), "The account credit has been withdrawn")); - System.out.println(e.toString()); + System.out.println(e); } } } catch (JMSException e) { diff --git a/services/src/main/java/ch/hepia/order/OrderService.java b/services/src/main/java/ch/hepia/order/OrderService.java index c4442b361cca2f7fd9f18b5459501f42fb2e8477..6a49b21b7f9b5b678e5ceba5c00bfef36040c8ca 100644 --- a/services/src/main/java/ch/hepia/order/OrderService.java +++ b/services/src/main/java/ch/hepia/order/OrderService.java @@ -64,35 +64,35 @@ public class OrderService{ if (obj instanceof EventOrderCreated){ EventOrderCreated e = (EventOrderCreated) obj; ordersDB.add(new Order(e.id(), e.idAccount(), e.products())); - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if (obj instanceof EventCreditRefused){ EventCreditRefused e = (EventCreditRefused) obj; send(new EventOrderCancelled(e.id(), "Credit is too low")); - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if (obj instanceof EventProductOutOfStock){ EventProductOutOfStock e = (EventProductOutOfStock) obj; send(new EventOrderCancelled(e.id(), "There are not enough products")); - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------ if (obj instanceof EventCreditWithdrawn){ EventCreditWithdrawn e = (EventCreditWithdrawn) obj; send(new EventOrderSent(e.id(), "Order is sent")); - System.out.println(e.toString()); + System.out.println(e); } //---------------------------------------------- if (obj instanceof EventOrderSent){ EventOrderSent e = (EventOrderSent) obj; - System.out.println(e.toString()); + System.out.println(e); } //------------------------------------------------ if (obj instanceof EventOrderCancelled){ EventOrderCancelled e = (EventOrderCancelled) obj; - System.out.println(e.toString()); + System.out.println(e); } } } catch (JMSException e) { @@ -101,9 +101,6 @@ public class OrderService{ } }); - // TextMessage txtMessage = session.createTextMessage("Test"); - // producer.send(txtMessage); - } catch (JMSException e) { e.printStackTrace(); } diff --git a/services/src/main/java/ch/hepia/stock/StockService.java b/services/src/main/java/ch/hepia/stock/StockService.java index 206c39d4e70b97000cb839adc83d0bd7451ab6fb..6448427b43c5cf3a3ad1d78e90e325a5498cdd5d 100644 --- a/services/src/main/java/ch/hepia/stock/StockService.java +++ b/services/src/main/java/ch/hepia/stock/StockService.java @@ -72,19 +72,19 @@ public class StockService { // des produits stockDB.addQuantity(idProduct, 0); // ajout au stock avec quantité 0 send(new EventProductCreated(e.id(), "The product is created")); - System.out.println(e.toString()); + System.out.println(e); // productsDB.database.forEach(i -> System.out.println(i.name() + i.price())); } // ------------------------------------------ if (obj instanceof EventProductDoesntExist) { EventProductDoesntExist e = (EventProductDoesntExist) obj; - System.out.println(e.toString()); + System.out.println(e); send(new EventOrderCancelled(e.id(), "Products in order don't exist")); } // ------------------------------------------ if (obj instanceof EventProductCreated) { EventProductCreated e = (EventProductCreated) obj; - System.out.println(e.toString()); + System.out.println(e); } // ------------------------------------------ if (obj instanceof EventAddProductQuantity) { @@ -97,12 +97,12 @@ public class StockService { send(new EventProductDoesntExist(e.id(), "Product doesn't exist")); } - System.out.println(e.toString()); + System.out.println(e); } if(obj instanceof EventProductQuantityAdded){ EventProductQuantityAdded e = (EventProductQuantityAdded) obj; - System.out.println(e.toString()); + System.out.println(e); } // ------------------------------------------ @@ -123,7 +123,7 @@ public class StockService { send(new EventOrderPrepared(e.id(), "Order is prepared", e.idAccount(), e.price())); else send(new EventProductOutOfStock(e.id(), "We are out of stock")); - System.out.println(e.toString()); + System.out.println(e); } }