From 83d72d2eef1949fa826162199bd2cb7d1b38fc22 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 7 May 2016 16:30:40 +0200 Subject: [PATCH] addCategory/addProduct are no longer needed for public usage, the events do it now. --- .../PizzaCategoryWebApplicationBean.java | 10 ++-------- .../PizzaCategoryWebApplicationController.java | 7 ------- .../product/PizzaProductWebApplicationBean.java | 16 +++++----------- .../PizzaProductWebApplicationController.java | 7 ------- 4 files changed, 7 insertions(+), 33 deletions(-) diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java index 9af316c1..d89f0f7d 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java @@ -51,12 +51,6 @@ public class PizzaCategoryWebApplicationBean implements PizzaCategoryWebApplicat */ private List categories; - @Override - public void addCategory (final Category category) { - // Add the category - this.categories.add(category); - } - @Override public void afterShopCategoryAdded (@Observes final AddedCategoryEvent event) { // Is all valid? @@ -74,8 +68,8 @@ public class PizzaCategoryWebApplicationBean implements PizzaCategoryWebApplicat throw new IllegalArgumentException(MessageFormat.format("event.addedCategory.categoryId={0} is not valid.", event.getAddedCategory().getCategoryId())); //NOI18N } - // Add it here, too. - this.addCategory(event.getAddedCategory()); + // Add the category + this.categories.add(event.getAddedCategory()); } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationController.java index 886c061c..21569b36 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationController.java @@ -29,13 +29,6 @@ import org.mxchange.jshopcore.model.category.Category; */ public interface PizzaCategoryWebApplicationController extends Serializable { - /** - * Adds given category to the "cached" instance - *

- * @param category Category instance - */ - void addCategory (final Category category); - /** * Some "getter" for a linked list of all categories *

diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java index f90a5bc9..a5ffce83 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java @@ -50,15 +50,6 @@ public class PizzaProductWebApplicationBean implements PizzaProductWebApplicatio */ private List availableProducts; - @Override - public void addProduct (final Product product) { - // Is the product available? - if (product.getProductAvailability()) { - // Add it - this.availableProducts.add(product); - } - } - @Override public void afterShopProductAdded (@Observes final AddedProductEvent event) { // Is all valid? @@ -76,8 +67,11 @@ public class PizzaProductWebApplicationBean implements PizzaProductWebApplicatio throw new IllegalArgumentException(MessageFormat.format("event.addedProduct.productId={0} is not valid.", event.getAddedProduct().getProductId())); //NOI18N } - // Add it here, too. - this.addProduct(event.getAddedProduct()); + // Is the product available? + if (event.getAddedProduct().getProductAvailability()) { + // Add it + this.availableProducts.add(event.getAddedProduct()); + } } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationController.java index 5d255989..3f8fcb31 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationController.java @@ -29,13 +29,6 @@ import org.mxchange.jshopcore.model.product.Product; */ public interface PizzaProductWebApplicationController extends Serializable { - /** - * Adds given product to the "cached" instance - *

- * @param product Product instance - */ - void addProduct (final Product product); - /** * Some "getter" for a linked list of only available products *

-- 2.39.5