]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
renamed files to make difference to other war-projects
authorRoland Haeder <roland@mxchange.org>
Mon, 4 Apr 2016 16:11:03 +0000 (18:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 4 Apr 2016 16:11:03 +0000 (18:11 +0200)
44 files changed:
src/java/org/mxchange/jshopcore/model/category/CategoryConverter.java [deleted file]
src/java/org/mxchange/jshopcore/model/category/PizzaCategoryConverter.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebSessionBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebSessionController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebRequestBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebRequestController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebSessionBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebSessionController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/country/CountryWebApplicationBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/country/CountryWebApplicationController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebSessionBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebSessionController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebApplicationBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebApplicationController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/localization/LocalizationSessionController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebRequestBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebRequestController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebSessionBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebSessionController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebApplicationBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebApplicationController.java [deleted file]
src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java [deleted file]
src/java/org/mxchange/pizzaapplication/servlet/receipt/PizzaPdfReceiptServlet.java [new file with mode: 0644]
web/WEB-INF/web.xml

diff --git a/src/java/org/mxchange/jshopcore/model/category/CategoryConverter.java b/src/java/org/mxchange/jshopcore/model/category/CategoryConverter.java
deleted file mode 100644 (file)
index 1ba1394..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jshopcore.model.category;
-
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.FacesConverter;
-import javax.inject.Inject;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
-import org.mxchange.pizzaapplication.beans.shop.ShopWebApplicationController;
-
-/**
- * A converter for transfering category objects
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@FacesConverter (value = "category")
-public class CategoryConverter implements Converter {
-
-       /**
-        * Logger instance
-        */
-       @Log
-       private LoggerBeanLocal loggerBeanLocal;
-
-       /**
-        * Category bean
-        */
-       @Inject
-       private ShopWebApplicationController shopController;
-
-       @Override
-       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Trace message
-               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
-
-               // Get full list
-               List<Category> categoryList = this.shopController.getAllCategories();
-
-               // Is the value null or empty?
-               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Trace message
-                       this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
-
-                       // Return null
-                       return null;
-               }
-
-               // Init value
-               Category category = null;
-
-               // Try this better
-               try {
-                       // Convert it to long
-                       Long categoryId = Long.parseLong(submittedValue);
-
-                       // Category id should not be below 1
-                       assert (categoryId > 0) : "categoryId is smaller than one: " + categoryId; //NOI18N
-
-                       // Debug message
-                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: categoryId={0}", categoryId)); //NOI18N
-
-                       // Try to find it
-                       for (final Category cat : categoryList) {
-                               // Is the id the same? (null-safe)
-                               if (Objects.equals(cat.getCategoryId(), categoryId)) {
-                                       // Found it
-                                       category = cat;
-                                       break;
-                               }
-                       }
-               } catch (final NumberFormatException ex) {
-                       // Log exception (maybe to much?)
-                       this.loggerBeanLocal.logException(ex);
-               }
-
-               // Trace message
-               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: category={0} - EXIT!", category)); //NOI18N
-
-               // Return it
-               return category;
-       }
-
-       @Override
-       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
-               // Is the object null?
-               if (null == value) {
-                       // Is null
-                       return ""; //NOI18N
-               } else if (!(value instanceof Category)) {
-                       // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Category.", value)); //NOI18N
-               }
-
-               // Return category id
-               return String.valueOf(((Category) value).getCategoryId());
-       }
-
-       /**
-        * Initialization of this converter
-        */
-       @PostConstruct
-       public void init () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Lookup logger
-                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
-               }
-       }
-}
diff --git a/src/java/org/mxchange/jshopcore/model/category/PizzaCategoryConverter.java b/src/java/org/mxchange/jshopcore/model/category/PizzaCategoryConverter.java
new file mode 100644 (file)
index 0000000..48cdb27
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jshopcore.model.category;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.PostConstruct;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import javax.inject.Inject;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.pizzaapplication.beans.shop.PizzaShopWebApplicationController;
+
+/**
+ * A converter for transfering category objects
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "category")
+public class PizzaCategoryConverter implements Converter {
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * Category bean
+        */
+       @Inject
+       private PizzaShopWebApplicationController shopController;
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
+
+               // Get full list
+               List<Category> categoryList = this.shopController.getAllCategories();
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Trace message
+                       this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init value
+               Category category = null;
+
+               // Try this better
+               try {
+                       // Convert it to long
+                       Long categoryId = Long.parseLong(submittedValue);
+
+                       // Category id should not be below 1
+                       assert (categoryId > 0) : "categoryId is smaller than one: " + categoryId; //NOI18N
+
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: categoryId={0}", categoryId)); //NOI18N
+
+                       // Try to find it
+                       for (final Category cat : categoryList) {
+                               // Is the id the same? (null-safe)
+                               if (Objects.equals(cat.getCategoryId(), categoryId)) {
+                                       // Found it
+                                       category = cat;
+                                       break;
+                               }
+                       }
+               } catch (final NumberFormatException ex) {
+                       // Log exception (maybe to much?)
+                       this.loggerBeanLocal.logException(ex);
+               }
+
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: category={0} - EXIT!", category)); //NOI18N
+
+               // Return it
+               return category;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+               // Is the object null?
+               if (null == value) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof Category)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Category.", value)); //NOI18N
+               }
+
+               // Return category id
+               return String.valueOf(((Category) value).getCategoryId());
+       }
+
+       /**
+        * Initialization of this converter
+        */
+       @PostConstruct
+       public void init () {
+               // Try to get it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw it
+                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+               }
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebSessionBean.java
deleted file mode 100644 (file)
index 5e26f34..0000000
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.basket;
-
-import java.text.MessageFormat;
-import java.util.List;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.basket.Basket;
-import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
-import org.mxchange.jshopcore.model.basket.ShopBasket;
-import org.mxchange.jshopcore.model.basket.items.BasketItem;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * A bean for the basket
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("basketController")
-@SessionScoped
-public class BasketWebSessionBean implements BasketWebSessionController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 5_476_347_320_198L;
-
-       /**
-        * Instance of wrapped basket
-        */
-       private final Basket<AddableBasketItem> basket;
-
-       /**
-        * Basket bean
-        */
-       private final BasketSessionBeanRemote basketBean;
-
-       /**
-        * Current item
-        */
-       private AddableBasketItem currentItem;
-
-       /////////////////////// Properties /////////////////////
-       /**
-        * Ordered orderedAmount
-        */
-       private Long orderedAmount;
-
-       /**
-        * Default constructor
-        */
-       public BasketWebSessionBean () {
-               // Get new application instance
-               this.basket = new ShopBasket();
-
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.basketBean = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
-       @Override
-       public String addItem (final Product product) {
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("addItem: product={0} - CALLED!", product));
-
-               // product should not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null");
-               }
-
-               // Generate item instance
-               AddableBasketItem item = new BasketItem(product, this.getOrderedAmount());
-
-               // Is orderedAmount set?
-               if (this.getOrderedAmount() == null) {
-                       // Trace message
-                       //this.getLogger().logTrace("addItem: orderedAmount not specified, returning null ... - EXIT!");
-
-                       // No orderedAmount specified?!
-                       return null;
-               }
-
-               try {
-                       // item should not be null
-                       if (null == item) {
-                               // Abort here
-                               throw new NullPointerException("item is null"); //NOI18N
-                       }
-
-                       // Deligate to model
-                       this.basket.addItem(item);
-
-                       // Remove orderedAmount
-                       this.setOrderedAmount(null);
-
-                       // Trace message
-                       //this.getLogger().logTrace(MessageFormat.format("addItem: item {0} - has been added to basket. - EXIT!", item));
-                       // Added
-                       return "item_added"; //NOI18N
-               } catch (final BasketItemAlreadyAddedException ex) {
-                       // Throw unchecked exception
-                       throw new FacesException(ex);
-               }
-       }
-
-       @Override
-       public List<AddableBasketItem> allItems () {
-               // Trace message
-               //this.getLogger().logTrace("allItems: CALLED!");
-
-               // Deligate to basket instance
-               List<AddableBasketItem> list = this.basket.getAll();
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("allItems: list={0} - EXIT!", list));
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       public Float calculateCurrentItemPrice () {
-               // Trace message
-               //this.getLogger().logTrace("calculateCurrentItemPrice: CALLED!");
-
-               // Is the current item/amount set?
-               if (this.getCurrentItem() == null) {
-                       // Current item is null
-                       throw new NullPointerException("currentItem is null"); //NOI18N
-               } else if (this.getCurrentItem().getItemProduct() == null) {
-                       // Product is null
-                       throw new NullPointerException("currentItem.product is null"); //NOI18N
-               } else if (this.getCurrentItem().getOrderedAmount() == null) {
-                       // Amount is null
-                       throw new NullPointerException("currentItem.amount is null"); //NOI18N
-               }
-
-               // Caculate item's price
-               Float totalPrice = (this.getCurrentItem().getItemProduct().getProductPrice() * this.getCurrentItem().getOrderedAmount());
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("calculateCurrentItemPrice: totalPrice={0} - EXIT!", totalPrice));
-
-               // Return it
-               return totalPrice;
-       }
-
-       @Override
-       public Float calculateItemPrice (final AddableBasketItem item) {
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: item={0} - CALLED!", item));
-
-               // item must not be null
-               if (null == item) {
-                       // Abort here
-                       throw new NullPointerException("item is null");
-               }
-
-               // Default value
-               Float totalPrice = 0.0f;
-
-               // Is it a product?
-               if (item.isProductType()) {
-                       // Caculate item's price
-                       totalPrice = (item.getItemProduct().getProductPrice() * item.getOrderedAmount());
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: totalPrice={0} - EXIT!", totalPrice));
-               // Return it
-               return totalPrice;
-       }
-
-       @Override
-       public Float calculateTotalPrice () {
-               // Trace message
-               //this.getLogger().logTrace("calculateTotalPrice: CALLED!");
-
-               // Init total price
-               Float totalPrice = 0.0f;
-
-               // Iterate over all items
-               for (final AddableBasketItem item : this.allItems()) {
-                       // Is the item a product?
-                       if (item.isProductType()) {
-                               // Calculate single price and add it
-                               totalPrice += this.calculateItemPrice(item);
-                       }
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("calculateTotalPrice: totalPrice={0} - EXIT!", totalPrice));
-
-               // Return final sum
-               return totalPrice;
-       }
-
-       @Override
-       public void clear () {
-               // Clear bean as well
-               this.basketBean.clear();
-
-               // Deligate to basket instance
-               this.basket.clear();
-       }
-
-       @Override
-       public String doChangeItem (final AddableBasketItem item) {
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("doChangeItem: item={0} - CALLED!", item));
-
-               // item shall not be null
-               if (null == item) {
-                       // Abort here
-                       throw new NullPointerException("item is null");
-               }
-
-               // Default is not found
-               String targetPage = "item_not_changed"; //NOI18N
-
-               // Lookup item in basket
-               for (final AddableBasketItem basketItem : this.allItems()) {
-                       // Is it the same?
-                       if (basketItem.equals(item)) {
-                               // Found it, so allow redirect to proper page
-                               targetPage = "basket"; //NOI18N
-                               break;
-                       }
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("doChangeItem: targetPage={0} - EXIT!", targetPage));
-               // Return page
-               return targetPage;
-       }
-
-       @Override
-       public AddableBasketItem getCurrentItem () {
-               return this.currentItem;
-       }
-
-       @Override
-       public void setCurrentItem (final AddableBasketItem currentItem) {
-               this.currentItem = currentItem;
-       }
-
-       @Override
-       public Long getItemAmount (final Product product) {
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("getItemAmount: product={0} - CALLED!", product));
-
-               // product should not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null");
-               }
-
-               // Initial value is zero
-               Long itemAmount = 0L;
-
-               // Iterate over all
-               for (final AddableBasketItem item : this.allItems()) {
-                       // Debug message
-                       //this.getLogger().logDebug(MessageFormat.format("getItemAmount: item={0}", item));
-
-                       // Is this product instance and same?
-                       if (null == item) {
-                               // item is null
-                               throw new NullPointerException("item is null");
-                       } else if ((item.isProductType()) && (item.getItemProduct().equals(product))) {
-                               // Found it
-                               itemAmount = item.getOrderedAmount();
-                               break;
-                       }
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("getItemAmount: itemAmount={0} - EXIT!", itemAmount));
-               // Return it
-               return itemAmount;
-       }
-
-       @Override
-       public AddableBasketItem getLast () {
-               // Deligate to basket instance
-               return this.basket.getLast();
-       }
-
-       @Override
-       public int getLastNumRows () {
-               // Deligate to basket instance
-               return this.basket.getLastNumRows();
-       }
-
-       @Override
-       public Long getOrderedAmount () {
-               return this.orderedAmount;
-       }
-
-       @Override
-       public void setOrderedAmount (final Long orderedAmount) {
-               this.orderedAmount = orderedAmount;
-       }
-
-       @Override
-       public boolean hasItems () {
-               // Call above and invert it
-               return (!this.isEmpty());
-       }
-
-       @Override
-       public boolean isEmpty () {
-               // Deligate to basket instance
-               return this.basket.isEmpty();
-       }
-
-       @Override
-       public boolean isProductAdded (final Product product) {
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("isProductAdded: product={0} - EXIT!", product));
-
-               // Must not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-
-               // Generate fake instance
-               AddableBasketItem fake = new BasketItem(product);
-
-               // Debug message
-               //this.getLogger().logDebug(MessageFormat.format("isProductAdded: fake={0}", fake));
-               // Ask bean about it
-               boolean isAdded = this.basket.isAdded(fake);
-
-               // Debug message
-               //this.getLogger().logDebug(MessageFormat.format("isProductAdded: isAdded={0}", isAdded));
-               // Is it added?
-               if (isAdded) {
-                       // Get item
-                       AddableBasketItem item = this.getItemFromProduct(product);
-
-                       // Debug message
-                       //this.getLogger().logDebug(MessageFormat.format("isProductAdded: item={0} - setting as current item.", item));
-                       // Set this as current item
-                       this.setCurrentItem(item);
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("isProductAdded: isAdded={0} - EXIT!", isAdded));
-               // Return status
-               return isAdded;
-       }
-
-       @Override
-       public String outputLastAddedItem () {
-               // Trace message
-               //this.getLogger().logTrace("outputLastAddedItem: CALLED!");
-
-               // Default message
-               String lastItem = ""; //NOI18N
-
-               // Get instance
-               AddableBasketItem item = this.getLast();
-
-               // Is it set?
-               if (item instanceof AddableBasketItem) {
-                       // Get type
-                       switch (item.getItemType()) {
-                               case "product": // Sellable product //NOI18N
-                                       assert (item.getItemProduct() instanceof Product) : MessageFormat.format("item {0} has no product instance set.", item); //NOI18N
-
-                                       // Get title
-                                       lastItem = item.getItemProduct().getProductTitle();
-                                       break;
-
-                               default: // Not supported
-                                       throw new FacesException(MessageFormat.format("item type {0} is not supported.", item.getItemType())); //NOI18N
-                       }
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("outputLastAddedItem: lastItem={0} - EXIT!", lastItem));
-               // Return it
-               return lastItem;
-       }
-
-       /**
-        * Getter for basket bean instance
-        * <p>
-        * @return Basket bean instance
-        */
-       private BasketSessionBeanRemote getBasketBean () {
-               return this.basketBean;
-       }
-
-       /**
-        * Somewhat getter for an item instance from given product instance. This
-        * method returns null if no item was found to given product. The product is
-        * found by checking it's id and itemType=product
-        * <p>
-        * @param product Product instance
-        * <p>
-        * @return Item instance or null if not found
-        */
-       private AddableBasketItem getItemFromProduct (final Product product) {
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: product={0} - CALLED!", product));
-
-               // Product must not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-
-               // Create item instance
-               AddableBasketItem foundItem = null;
-
-               // Create fake instance
-               AddableBasketItem fake = new BasketItem(product);
-
-               // Debug message
-               //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: fake={0}", fake));
-               // Get all items
-               List<AddableBasketItem> list = this.basket.getAll();
-
-               // Debug message
-               //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: list={0}", list));
-               // Check all entries
-               for (final AddableBasketItem item : list) {
-                       // Debug message
-                       //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: item={0}", item));
-
-                       // item must not be null
-                       if (null == item) {
-                               // Abort here
-                               throw new NullPointerException("item is null"); //NOI18N
-                       }
-
-                       // Is it the same?
-                       if (item.equals(fake)) {
-                               // Set found item and abort look
-                               foundItem = item;
-                               break;
-                       }
-               }
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: foundItem={0} - EXIT!", foundItem));
-               // Return it
-               return foundItem;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebSessionController.java
deleted file mode 100644 (file)
index 5317e9c..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.basket;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for a basket
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface BasketWebSessionController extends Serializable {
-
-       /**
-        * Adds given product instance to basket by adding amount from form data to
-        * it.
-        * <p>
-        * @param product Product instance to add
-        * <p>
-        * @return Redirect target or null
-        */
-       String addItem (final Product product);
-
-       /**
-        * Gets for all added items
-        * <p>
-        * @return A list of all added items
-        */
-       List<AddableBasketItem> allItems ();
-
-       /**
-        * Calculates total price (no tax added) of current item. If no current item
-        * is set and no amount, a NPE is thrown.
-        * <p>
-        * @return Current item's total price
-        */
-       Float calculateCurrentItemPrice ();
-
-       /**
-        * Calculates total price (no tax added) for given item.
-        * <p>
-        * @param item Item instance to calculate total price for
-        * <p>
-        * @return Total price
-        */
-       Float calculateItemPrice (final AddableBasketItem item);
-
-       /**
-        * Calculates total sum (no tax added) for all items
-        * <p>
-        * @return Total price of all items
-        */
-       Float calculateTotalPrice ();
-
-       /**
-        * Changes given item instance's amount in basket and redirects to proper
-        * page. If the item is not found, another "error" page is called.
-        * <p>
-        * @param item Item instance to change
-        * <p>
-        * @return Page redirection
-        */
-       String doChangeItem (final AddableBasketItem item);
-
-       /**
-        * Clears this basket instance
-        */
-       void clear ();
-
-       /**
-        * Getter for item amount property
-        * <p>
-        * @return Item amount property
-        */
-       Long getOrderedAmount ();
-
-       /**
-        * Setter for item amount property
-        * <p>
-        * @param amount Item amount property
-        */
-       void setOrderedAmount (final Long amount);
-
-       /**
-        * Getter for current item
-        * <p>
-        * @return Current item
-        */
-       AddableBasketItem getCurrentItem ();
-
-       /**
-        * Setter for current item
-        * <p>
-        * @param currentItem Current item
-        */
-       void setCurrentItem (final AddableBasketItem currentItem);
-
-       /**
-        * Some getter for item amount of given product. This method requires a full
-        * iteration over all items in the basket to look for proper product
-        * instance.
-        * <p>
-        * @param product Product instance
-        * <p>
-        * @return Item amount of given product
-        */
-       Long getItemAmount (final Product product);
-
-       /**
-        * Getter for last entry
-        * <p>
-        * @return Last added item in basket
-        */
-       AddableBasketItem getLast ();
-
-       /**
-        * Getter for last num rows
-        * <p>
-        * @return Last num rows
-        */
-       int getLastNumRows ();
-
-       /**
-        * Checks whether the basket has items in it. This method is wrapper to
-        * isEmpty()
-        * <p>
-        * @return Whether the basket is empty
-        */
-       boolean hasItems ();
-
-       /**
-        * Checks whether the basket is empty
-        * <p>
-        * @return Whether the basket is empty
-        */
-       boolean isEmpty ();
-
-       /**
-        * Checks whether the currently set product is added in basked
-        * <p>
-        * @param product Product instance
-        * <p>
-        * @return Whether the product is added
-        */
-       boolean isProductAdded (final Product product);
-
-       /**
-        * Outputs last added item in the basket.
-        * <p>
-        * @return Last added item
-        */
-       String outputLastAddedItem ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java
new file mode 100644 (file)
index 0000000..56bdc6e
--- /dev/null
@@ -0,0 +1,483 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.basket;
+
+import java.text.MessageFormat;
+import java.util.List;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.basket.Basket;
+import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
+import org.mxchange.jshopcore.model.basket.ShopBasket;
+import org.mxchange.jshopcore.model.basket.items.BasketItem;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * A bean for the basket
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("basketController")
+@SessionScoped
+public class PizzaBasketWebSessionBean implements PizzaBasketWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_476_347_320_198L;
+
+       /**
+        * Instance of wrapped basket
+        */
+       private final Basket<AddableBasketItem> basket;
+
+       /**
+        * Basket bean
+        */
+       private final BasketSessionBeanRemote basketBean;
+
+       /**
+        * Current item
+        */
+       private AddableBasketItem currentItem;
+
+       /////////////////////// Properties /////////////////////
+       /**
+        * Ordered orderedAmount
+        */
+       private Long orderedAmount;
+
+       /**
+        * Default constructor
+        */
+       public PizzaBasketWebSessionBean () {
+               // Get new application instance
+               this.basket = new ShopBasket();
+
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.basketBean = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
+       @Override
+       public String addItem (final Product product) {
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("addItem: product={0} - CALLED!", product));
+
+               // product should not be null
+               if (null == product) {
+                       // Abort here
+                       throw new NullPointerException("product is null");
+               }
+
+               // Generate item instance
+               AddableBasketItem item = new BasketItem(product, this.getOrderedAmount());
+
+               // Is orderedAmount set?
+               if (this.getOrderedAmount() == null) {
+                       // Trace message
+                       //this.getLogger().logTrace("addItem: orderedAmount not specified, returning null ... - EXIT!");
+
+                       // No orderedAmount specified?!
+                       return null;
+               }
+
+               try {
+                       // item should not be null
+                       if (null == item) {
+                               // Abort here
+                               throw new NullPointerException("item is null"); //NOI18N
+                       }
+
+                       // Deligate to model
+                       this.basket.addItem(item);
+
+                       // Remove orderedAmount
+                       this.setOrderedAmount(null);
+
+                       // Trace message
+                       //this.getLogger().logTrace(MessageFormat.format("addItem: item {0} - has been added to basket. - EXIT!", item));
+                       // Added
+                       return "item_added"; //NOI18N
+               } catch (final BasketItemAlreadyAddedException ex) {
+                       // Throw unchecked exception
+                       throw new FacesException(ex);
+               }
+       }
+
+       @Override
+       public List<AddableBasketItem> allItems () {
+               // Trace message
+               //this.getLogger().logTrace("allItems: CALLED!");
+
+               // Deligate to basket instance
+               List<AddableBasketItem> list = this.basket.getAll();
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("allItems: list={0} - EXIT!", list));
+
+               // Return it
+               return list;
+       }
+
+       @Override
+       public Float calculateCurrentItemPrice () {
+               // Trace message
+               //this.getLogger().logTrace("calculateCurrentItemPrice: CALLED!");
+
+               // Is the current item/amount set?
+               if (this.getCurrentItem() == null) {
+                       // Current item is null
+                       throw new NullPointerException("currentItem is null"); //NOI18N
+               } else if (this.getCurrentItem().getItemProduct() == null) {
+                       // Product is null
+                       throw new NullPointerException("currentItem.product is null"); //NOI18N
+               } else if (this.getCurrentItem().getOrderedAmount() == null) {
+                       // Amount is null
+                       throw new NullPointerException("currentItem.amount is null"); //NOI18N
+               }
+
+               // Caculate item's price
+               Float totalPrice = (this.getCurrentItem().getItemProduct().getProductPrice() * this.getCurrentItem().getOrderedAmount());
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("calculateCurrentItemPrice: totalPrice={0} - EXIT!", totalPrice));
+
+               // Return it
+               return totalPrice;
+       }
+
+       @Override
+       public Float calculateItemPrice (final AddableBasketItem item) {
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: item={0} - CALLED!", item));
+
+               // item must not be null
+               if (null == item) {
+                       // Abort here
+                       throw new NullPointerException("item is null");
+               }
+
+               // Default value
+               Float totalPrice = 0.0f;
+
+               // Is it a product?
+               if (item.isProductType()) {
+                       // Caculate item's price
+                       totalPrice = (item.getItemProduct().getProductPrice() * item.getOrderedAmount());
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: totalPrice={0} - EXIT!", totalPrice));
+               // Return it
+               return totalPrice;
+       }
+
+       @Override
+       public Float calculateTotalPrice () {
+               // Trace message
+               //this.getLogger().logTrace("calculateTotalPrice: CALLED!");
+
+               // Init total price
+               Float totalPrice = 0.0f;
+
+               // Iterate over all items
+               for (final AddableBasketItem item : this.allItems()) {
+                       // Is the item a product?
+                       if (item.isProductType()) {
+                               // Calculate single price and add it
+                               totalPrice += this.calculateItemPrice(item);
+                       }
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("calculateTotalPrice: totalPrice={0} - EXIT!", totalPrice));
+
+               // Return final sum
+               return totalPrice;
+       }
+
+       @Override
+       public void clear () {
+               // Clear bean as well
+               this.basketBean.clear();
+
+               // Deligate to basket instance
+               this.basket.clear();
+       }
+
+       @Override
+       public String doChangeItem (final AddableBasketItem item) {
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("doChangeItem: item={0} - CALLED!", item));
+
+               // item shall not be null
+               if (null == item) {
+                       // Abort here
+                       throw new NullPointerException("item is null");
+               }
+
+               // Default is not found
+               String targetPage = "item_not_changed"; //NOI18N
+
+               // Lookup item in basket
+               for (final AddableBasketItem basketItem : this.allItems()) {
+                       // Is it the same?
+                       if (basketItem.equals(item)) {
+                               // Found it, so allow redirect to proper page
+                               targetPage = "basket"; //NOI18N
+                               break;
+                       }
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("doChangeItem: targetPage={0} - EXIT!", targetPage));
+               // Return page
+               return targetPage;
+       }
+
+       @Override
+       public AddableBasketItem getCurrentItem () {
+               return this.currentItem;
+       }
+
+       @Override
+       public void setCurrentItem (final AddableBasketItem currentItem) {
+               this.currentItem = currentItem;
+       }
+
+       @Override
+       public Long getItemAmount (final Product product) {
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("getItemAmount: product={0} - CALLED!", product));
+
+               // product should not be null
+               if (null == product) {
+                       // Abort here
+                       throw new NullPointerException("product is null");
+               }
+
+               // Initial value is zero
+               Long itemAmount = 0L;
+
+               // Iterate over all
+               for (final AddableBasketItem item : this.allItems()) {
+                       // Debug message
+                       //this.getLogger().logDebug(MessageFormat.format("getItemAmount: item={0}", item));
+
+                       // Is this product instance and same?
+                       if (null == item) {
+                               // item is null
+                               throw new NullPointerException("item is null");
+                       } else if ((item.isProductType()) && (item.getItemProduct().equals(product))) {
+                               // Found it
+                               itemAmount = item.getOrderedAmount();
+                               break;
+                       }
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("getItemAmount: itemAmount={0} - EXIT!", itemAmount));
+               // Return it
+               return itemAmount;
+       }
+
+       @Override
+       public AddableBasketItem getLast () {
+               // Deligate to basket instance
+               return this.basket.getLast();
+       }
+
+       @Override
+       public int getLastNumRows () {
+               // Deligate to basket instance
+               return this.basket.getLastNumRows();
+       }
+
+       @Override
+       public Long getOrderedAmount () {
+               return this.orderedAmount;
+       }
+
+       @Override
+       public void setOrderedAmount (final Long orderedAmount) {
+               this.orderedAmount = orderedAmount;
+       }
+
+       @Override
+       public boolean hasItems () {
+               // Call above and invert it
+               return (!this.isEmpty());
+       }
+
+       @Override
+       public boolean isEmpty () {
+               // Deligate to basket instance
+               return this.basket.isEmpty();
+       }
+
+       @Override
+       public boolean isProductAdded (final Product product) {
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("isProductAdded: product={0} - EXIT!", product));
+
+               // Must not be null
+               if (null == product) {
+                       // Abort here
+                       throw new NullPointerException("product is null"); //NOI18N
+               }
+
+               // Generate fake instance
+               AddableBasketItem fake = new BasketItem(product);
+
+               // Debug message
+               //this.getLogger().logDebug(MessageFormat.format("isProductAdded: fake={0}", fake));
+               // Ask bean about it
+               boolean isAdded = this.basket.isAdded(fake);
+
+               // Debug message
+               //this.getLogger().logDebug(MessageFormat.format("isProductAdded: isAdded={0}", isAdded));
+               // Is it added?
+               if (isAdded) {
+                       // Get item
+                       AddableBasketItem item = this.getItemFromProduct(product);
+
+                       // Debug message
+                       //this.getLogger().logDebug(MessageFormat.format("isProductAdded: item={0} - setting as current item.", item));
+                       // Set this as current item
+                       this.setCurrentItem(item);
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("isProductAdded: isAdded={0} - EXIT!", isAdded));
+               // Return status
+               return isAdded;
+       }
+
+       @Override
+       public String outputLastAddedItem () {
+               // Trace message
+               //this.getLogger().logTrace("outputLastAddedItem: CALLED!");
+
+               // Default message
+               String lastItem = ""; //NOI18N
+
+               // Get instance
+               AddableBasketItem item = this.getLast();
+
+               // Is it set?
+               if (item instanceof AddableBasketItem) {
+                       // Get type
+                       switch (item.getItemType()) {
+                               case "product": // Sellable product //NOI18N
+                                       assert (item.getItemProduct() instanceof Product) : MessageFormat.format("item {0} has no product instance set.", item); //NOI18N
+
+                                       // Get title
+                                       lastItem = item.getItemProduct().getProductTitle();
+                                       break;
+
+                               default: // Not supported
+                                       throw new FacesException(MessageFormat.format("item type {0} is not supported.", item.getItemType())); //NOI18N
+                       }
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("outputLastAddedItem: lastItem={0} - EXIT!", lastItem));
+               // Return it
+               return lastItem;
+       }
+
+       /**
+        * Getter for basket bean instance
+        * <p>
+        * @return Basket bean instance
+        */
+       private BasketSessionBeanRemote getBasketBean () {
+               return this.basketBean;
+       }
+
+       /**
+        * Somewhat getter for an item instance from given product instance. This
+        * method returns null if no item was found to given product. The product is
+        * found by checking it's id and itemType=product
+        * <p>
+        * @param product Product instance
+        * <p>
+        * @return Item instance or null if not found
+        */
+       private AddableBasketItem getItemFromProduct (final Product product) {
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: product={0} - CALLED!", product));
+
+               // Product must not be null
+               if (null == product) {
+                       // Abort here
+                       throw new NullPointerException("product is null"); //NOI18N
+               }
+
+               // Create item instance
+               AddableBasketItem foundItem = null;
+
+               // Create fake instance
+               AddableBasketItem fake = new BasketItem(product);
+
+               // Debug message
+               //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: fake={0}", fake));
+               // Get all items
+               List<AddableBasketItem> list = this.basket.getAll();
+
+               // Debug message
+               //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: list={0}", list));
+               // Check all entries
+               for (final AddableBasketItem item : list) {
+                       // Debug message
+                       //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: item={0}", item));
+
+                       // item must not be null
+                       if (null == item) {
+                               // Abort here
+                               throw new NullPointerException("item is null"); //NOI18N
+                       }
+
+                       // Is it the same?
+                       if (item.equals(fake)) {
+                               // Set found item and abort look
+                               foundItem = item;
+                               break;
+                       }
+               }
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: foundItem={0} - EXIT!", foundItem));
+               // Return it
+               return foundItem;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionController.java
new file mode 100644 (file)
index 0000000..1c20c11
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.basket;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * An interface for a basket
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaBasketWebSessionController extends Serializable {
+
+       /**
+        * Adds given product instance to basket by adding amount from form data to
+        * it.
+        * <p>
+        * @param product Product instance to add
+        * <p>
+        * @return Redirect target or null
+        */
+       String addItem (final Product product);
+
+       /**
+        * Gets for all added items
+        * <p>
+        * @return A list of all added items
+        */
+       List<AddableBasketItem> allItems ();
+
+       /**
+        * Calculates total price (no tax added) of current item. If no current item
+        * is set and no amount, a NPE is thrown.
+        * <p>
+        * @return Current item's total price
+        */
+       Float calculateCurrentItemPrice ();
+
+       /**
+        * Calculates total price (no tax added) for given item.
+        * <p>
+        * @param item Item instance to calculate total price for
+        * <p>
+        * @return Total price
+        */
+       Float calculateItemPrice (final AddableBasketItem item);
+
+       /**
+        * Calculates total sum (no tax added) for all items
+        * <p>
+        * @return Total price of all items
+        */
+       Float calculateTotalPrice ();
+
+       /**
+        * Changes given item instance's amount in basket and redirects to proper
+        * page. If the item is not found, another "error" page is called.
+        * <p>
+        * @param item Item instance to change
+        * <p>
+        * @return Page redirection
+        */
+       String doChangeItem (final AddableBasketItem item);
+
+       /**
+        * Clears this basket instance
+        */
+       void clear ();
+
+       /**
+        * Getter for item amount property
+        * <p>
+        * @return Item amount property
+        */
+       Long getOrderedAmount ();
+
+       /**
+        * Setter for item amount property
+        * <p>
+        * @param amount Item amount property
+        */
+       void setOrderedAmount (final Long amount);
+
+       /**
+        * Getter for current item
+        * <p>
+        * @return Current item
+        */
+       AddableBasketItem getCurrentItem ();
+
+       /**
+        * Setter for current item
+        * <p>
+        * @param currentItem Current item
+        */
+       void setCurrentItem (final AddableBasketItem currentItem);
+
+       /**
+        * Some getter for item amount of given product. This method requires a full
+        * iteration over all items in the basket to look for proper product
+        * instance.
+        * <p>
+        * @param product Product instance
+        * <p>
+        * @return Item amount of given product
+        */
+       Long getItemAmount (final Product product);
+
+       /**
+        * Getter for last entry
+        * <p>
+        * @return Last added item in basket
+        */
+       AddableBasketItem getLast ();
+
+       /**
+        * Getter for last num rows
+        * <p>
+        * @return Last num rows
+        */
+       int getLastNumRows ();
+
+       /**
+        * Checks whether the basket has items in it. This method is wrapper to
+        * isEmpty()
+        * <p>
+        * @return Whether the basket is empty
+        */
+       boolean hasItems ();
+
+       /**
+        * Checks whether the basket is empty
+        * <p>
+        * @return Whether the basket is empty
+        */
+       boolean isEmpty ();
+
+       /**
+        * Checks whether the currently set product is added in basked
+        * <p>
+        * @param product Product instance
+        * <p>
+        * @return Whether the product is added
+        */
+       boolean isProductAdded (final Product product);
+
+       /**
+        * Outputs last added item in the basket.
+        * <p>
+        * @return Last added item
+        */
+       String outputLastAddedItem ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebRequestBean.java
deleted file mode 100644 (file)
index 65637e9..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.category;
-
-import javax.enterprise.context.RequestScoped;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jshopcore.exceptions.CannotAddCategoryException;
-import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException;
-import org.mxchange.jshopcore.model.category.AdminCategorySessionBeanRemote;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.category.ProductCategory;
-import org.mxchange.pizzaapplication.beans.shop.ShopWebApplicationController;
-
-/**
- * Main application class
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("admin_category")
-@RequestScoped
-public class AdminCategoryWebRequestBean implements AdminCategoryWebRequestController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 5_819_375_183_472_871L;
-
-       /**
-        * Remote bean for categories
-        */
-       private AdminCategorySessionBeanRemote categoryBean;
-
-       /////////////////////// Properties /////////////////////
-       /**
-        * Category categoryTitle
-        */
-       private String categoryTitle;
-
-       /**
-        * Parent category
-        */
-       private Category parentCategory;
-
-       ////////////////////// Bean injections ///////////////////////
-
-       /**
-        * Shop bean
-        */
-       @Inject
-       private ShopWebApplicationController shopController;
-
-       /**
-        * Default constructor
-        */
-       public AdminCategoryWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.categoryBean = (AdminCategorySessionBeanRemote) context.lookup("ejb/stateless-admin-category"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
-       }
-
-       @Override
-       public void addCategory () throws FaceletException {
-               try {
-                       // Create category
-                       Category category = new ProductCategory();
-                       category.setParentCategory(this.getParentCategory());
-                       category.setCategoryTitle(this.getCategoryTitle());
-
-                       // Deligate to remote bean
-                       Category updatedCategory = this.categoryBean.doAdminAddCategory(category);
-
-                       // Also send it to the controller bean
-                       this.shopController.addCategory(updatedCategory);
-
-                       // Unset all older values
-                       this.setCategoryTitle(""); //NOI18N
-                       this.setParentCategory(null);
-               } catch (final CategoryTitleAlreadyUsedException | CannotAddCategoryException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
-       @Override
-       public String getCategoryTitle () {
-               return this.categoryTitle;
-       }
-
-       @Override
-       public void setCategoryTitle (final String categoryTitle) {
-               this.categoryTitle = categoryTitle;
-       }
-
-       @Override
-       public Category getParentCategory () {
-               return this.parentCategory;
-       }
-
-       @Override
-       public void setParentCategory (final Category parentCategory) {
-               this.parentCategory = parentCategory;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebRequestController.java
deleted file mode 100644 (file)
index 7670dd4..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.category;
-
-import javax.faces.view.facelets.FaceletException;
-import org.mxchange.jshopcore.model.category.Category;
-
-/**
- * An interface for product controllers for "ADMIN" role
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface AdminCategoryWebRequestController {
-
-       /**
-        * Adds given category data from request to database
-        * <p>
-        * @throws javax.faces.view.facelets.FaceletException If something
-        * unexpected happened
-        */
-       void addCategory () throws FaceletException;
-
-       /**
-        * Getter for parent id
-        * <p>
-        * @return Parent id
-        */
-       Category getParentCategory ();
-
-       /**
-        * Setter for parent category
-        * <p>
-        * @param parentCategory Parent category to set
-        */
-       void setParentCategory (final Category parentCategory);
-
-       /**
-        * Getter for category title
-        * <p>
-        * @return the title
-        */
-       String getCategoryTitle ();
-
-       /**
-        * Setter for category title
-        * <p>
-        * @param categoryTitle the title to set
-        */
-       void setCategoryTitle (final String categoryTitle);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java
new file mode 100644 (file)
index 0000000..ef70019
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.category;
+
+import javax.enterprise.context.RequestScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jshopcore.exceptions.CannotAddCategoryException;
+import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.jshopcore.model.category.AdminCategorySessionBeanRemote;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.category.ProductCategory;
+import org.mxchange.pizzaapplication.beans.shop.PizzaShopWebApplicationController;
+
+/**
+ * Main application class
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("admin_category")
+@RequestScoped
+public class PizzaAdminCategoryWebRequestBean implements PizzaAdminCategoryWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_819_375_183_472_871L;
+
+       /**
+        * Remote bean for categories
+        */
+       private AdminCategorySessionBeanRemote categoryBean;
+
+       /////////////////////// Properties /////////////////////
+       /**
+        * Category categoryTitle
+        */
+       private String categoryTitle;
+
+       /**
+        * Parent category
+        */
+       private Category parentCategory;
+
+       ////////////////////// Bean injections ///////////////////////
+
+       /**
+        * Shop bean
+        */
+       @Inject
+       private PizzaShopWebApplicationController shopController;
+
+       /**
+        * Default constructor
+        */
+       public PizzaAdminCategoryWebRequestBean () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       this.categoryBean = (AdminCategorySessionBeanRemote) context.lookup("ejb/stateless-admin-category"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public void addCategory () throws FaceletException {
+               try {
+                       // Create category
+                       Category category = new ProductCategory();
+                       category.setParentCategory(this.getParentCategory());
+                       category.setCategoryTitle(this.getCategoryTitle());
+
+                       // Deligate to remote bean
+                       Category updatedCategory = this.categoryBean.doAdminAddCategory(category);
+
+                       // Also send it to the controller bean
+                       this.shopController.addCategory(updatedCategory);
+
+                       // Unset all older values
+                       this.setCategoryTitle(""); //NOI18N
+                       this.setParentCategory(null);
+               } catch (final CategoryTitleAlreadyUsedException | CannotAddCategoryException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
+       @Override
+       public String getCategoryTitle () {
+               return this.categoryTitle;
+       }
+
+       @Override
+       public void setCategoryTitle (final String categoryTitle) {
+               this.categoryTitle = categoryTitle;
+       }
+
+       @Override
+       public Category getParentCategory () {
+               return this.parentCategory;
+       }
+
+       @Override
+       public void setParentCategory (final Category parentCategory) {
+               this.parentCategory = parentCategory;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestController.java
new file mode 100644 (file)
index 0000000..2e130ba
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.category;
+
+import javax.faces.view.facelets.FaceletException;
+import org.mxchange.jshopcore.model.category.Category;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaAdminCategoryWebRequestController {
+
+       /**
+        * Adds given category data from request to database
+        * <p>
+        * @throws javax.faces.view.facelets.FaceletException If something
+        * unexpected happened
+        */
+       void addCategory () throws FaceletException;
+
+       /**
+        * Getter for parent id
+        * <p>
+        * @return Parent id
+        */
+       Category getParentCategory ();
+
+       /**
+        * Setter for parent category
+        * <p>
+        * @param parentCategory Parent category to set
+        */
+       void setParentCategory (final Category parentCategory);
+
+       /**
+        * Getter for category title
+        * <p>
+        * @return the title
+        */
+       String getCategoryTitle ();
+
+       /**
+        * Setter for category title
+        * <p>
+        * @param categoryTitle the title to set
+        */
+       void setCategoryTitle (final String categoryTitle);
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebSessionBean.java
deleted file mode 100644 (file)
index 617d728..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.checkout;
-
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jshopcore.model.basket.AddableBasketItem;
-import org.mxchange.jshopcore.model.customer.Customer;
-import org.mxchange.jshopcore.wrapper.CheckoutWrapper;
-import org.mxchange.jshopcore.wrapper.WrapableCheckout;
-import org.mxchange.pizzaapplication.beans.basket.BasketWebSessionController;
-import org.mxchange.pizzaapplication.beans.customer.CustomerWebSessionController;
-import org.mxchange.pizzaapplication.beans.receipt.ReceiptWebSessionController;
-
-/**
- * Checkout controller
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("checkoutController")
-@SessionScoped
-public class CheckoutWebSessionBean implements CheckoutWebSessionController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 51_987_348_347_183L;
-
-       ////////////////////// Bean injections ///////////////////////
-       /**
-        * Basket bean
-        */
-       @Inject
-       private BasketWebSessionController basketController;
-
-       /**
-        * Connection
-        */
-       private Connection connection;
-
-       /**
-        * Customer instance
-        */
-       private Customer customer;
-
-       /**
-        * Customer bean
-        */
-       @Inject
-       private CustomerWebSessionController customerController;
-
-       /**
-        * Object message
-        */
-       private ObjectMessage message;
-
-       /**
-        * Message producer
-        */
-       private MessageProducer messageProducer;
-
-       /**
-        * Queue instance
-        */
-       private Queue queue;
-
-       /**
-        * Receipt bean
-        */
-       @Inject
-       private ReceiptWebSessionController receiptController;
-
-       /**
-        * Session instance
-        */
-       private Session session;
-
-       /**
-        * Destructor
-        */
-       @PreDestroy
-       public void destroy () {
-               try {
-                       // Try to close all
-                       this.messageProducer.close();
-                       this.session.close();
-                       this.connection.close();
-               } catch (final JMSException ex) {
-                       // TODO: Continue to throw is fine?
-                       throw new FacesException(ex);
-               }
-       }
-
-       @Override
-       public String doCheckout () {
-               // Trace message
-               //this.getLogger().logTrace("doCheckout: CALLED!");
-
-               // Are the beans set?
-               if (null == this.basketController) {
-                       // Abort here
-                       throw new NullPointerException("basketController is null"); //NOI18N
-               } else if (null == this.customerController) {
-                       // Abort here
-                       throw new NullPointerException("customer is null"); //NOI18N
-               }
-
-               // Are at least the required fields set?
-               if (!this.customerController.isRequiredPersonalDataSet()) {
-                       // Trace message
-                       //this.getLogger().logTrace("doCheckout: Not all required fields are set, returning checkout2 ... - EXIT!");
-
-                       // Not set, should not happen
-                       return "checkout2"; //NOI18N
-               } else if (this.basketController.isEmpty()) {
-                       // Trace message
-                       //this.getLogger().logTrace("doCheckout: basket is empty, returning empty_basket ... - EXIT!");
-
-                       // Nothing to order
-                       return "empty_basket"; //NOI18N
-               }
-
-               // Create customer instance
-               this.setCustomer(this.customerController.createCustomerInstance());
-
-               // Debug message
-               //this.getLogger().logDebug(MessageFormat.format("doCheckout: customer={0}", this.getCustomer()));
-               // Get ordered list
-               List<AddableBasketItem> list = this.basketController.allItems();
-
-               // Debug message
-               //this.getLogger().logTrace(MessageFormat.format("doCheckout: list={0}", list));
-               // Construct container
-               WrapableCheckout wrapper = new CheckoutWrapper();
-               wrapper.setCustomer(this.getCustomer());
-               wrapper.setList(list);
-
-               try {
-                       // Construct object message
-                       this.message.setObject(wrapper);
-
-                       // Send message
-                       this.messageProducer.send(this.message);
-               } catch (final JMSException ex) {
-                       // TODO: Log exception?
-                       // Not working
-                       return "jms_failed"; //NOI18N
-               }
-
-               // Clear basket
-               this.basketController.clear();
-
-               // Set customer in receipt controller for verification
-               this.receiptController.setCustomer(this.getCustomer());
-
-               // All fine
-               return "checkout_done"; //NOI18N
-       }
-
-       @Override
-       public Customer getCustomer () {
-               return this.customer;
-       }
-
-       @Override
-       public void setCustomer (final Customer customer) {
-               this.customer = customer;
-       }
-
-       /**
-        * Initialization of this bean
-        */
-       @PostConstruct
-       public void init () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Get factory from JMS resource
-                       QueueConnectionFactory connectionFactory = (QueueConnectionFactory) context.lookup("jms/shopConnectionFactory"); //NOI18N
-
-                       // Lookup queue
-                       this.queue = (Queue) context.lookup("jms/shopCheckoutQueue"); //NOI18N
-
-                       // Create connection
-                       this.connection = connectionFactory.createConnection();
-
-                       // Init session instance
-                       this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-                       // And message producer
-                       this.messageProducer = this.session.createProducer(this.queue);
-
-                       // Finally the message instance itself
-                       this.message = this.session.createObjectMessage();
-               } catch (final NamingException | JMSException e) {
-                       // Continued to throw
-                       throw new FacesException(e);
-               }
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebSessionController.java
deleted file mode 100644 (file)
index 585dbab..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.checkout;
-
-import java.io.Serializable;
-import org.mxchange.jshopcore.model.customer.Customer;
-
-/**
- * An interface for the shop
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface CheckoutWebSessionController extends Serializable {
-
-       /**
-        * Runs the actual checkout and returns a proper page redirection target.
-        * <p>
-        * @return Page redirection target
-        */
-       String doCheckout ();
-
-       /**
-        * Getter for customer instance
-        * <p>
-        * @return Customer instance
-        */
-       Customer getCustomer ();
-
-       /**
-        * Setter for customer instance
-        * <p>
-        * @param customer Customer instance
-        */
-       void setCustomer (final Customer customer);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java
new file mode 100644 (file)
index 0000000..a2e3e96
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.checkout;
+
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.customer.Customer;
+import org.mxchange.jshopcore.wrapper.CheckoutWrapper;
+import org.mxchange.jshopcore.wrapper.WrapableCheckout;
+import org.mxchange.pizzaapplication.beans.basket.PizzaBasketWebSessionController;
+import org.mxchange.pizzaapplication.beans.customer.PizzaCustomerWebSessionController;
+import org.mxchange.pizzaapplication.beans.receipt.PizzaReceiptWebSessionController;
+
+/**
+ * Checkout controller
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("checkoutController")
+@SessionScoped
+public class PizzaCheckoutWebSessionBean implements PizzaCheckoutWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 51_987_348_347_183L;
+
+       ////////////////////// Bean injections ///////////////////////
+       /**
+        * Basket bean
+        */
+       @Inject
+       private PizzaBasketWebSessionController basketController;
+
+       /**
+        * Connection
+        */
+       private Connection connection;
+
+       /**
+        * Customer instance
+        */
+       private Customer customer;
+
+       /**
+        * Customer bean
+        */
+       @Inject
+       private PizzaCustomerWebSessionController customerController;
+
+       /**
+        * Object message
+        */
+       private ObjectMessage message;
+
+       /**
+        * Message producer
+        */
+       private MessageProducer messageProducer;
+
+       /**
+        * Queue instance
+        */
+       private Queue queue;
+
+       /**
+        * Receipt bean
+        */
+       @Inject
+       private PizzaReceiptWebSessionController receiptController;
+
+       /**
+        * Session instance
+        */
+       private Session session;
+
+       /**
+        * Destructor
+        */
+       @PreDestroy
+       public void destroy () {
+               try {
+                       // Try to close all
+                       this.messageProducer.close();
+                       this.session.close();
+                       this.connection.close();
+               } catch (final JMSException ex) {
+                       // TODO: Continue to throw is fine?
+                       throw new FacesException(ex);
+               }
+       }
+
+       @Override
+       public String doCheckout () {
+               // Trace message
+               //this.getLogger().logTrace("doCheckout: CALLED!");
+
+               // Are the beans set?
+               if (null == this.basketController) {
+                       // Abort here
+                       throw new NullPointerException("basketController is null"); //NOI18N
+               } else if (null == this.customerController) {
+                       // Abort here
+                       throw new NullPointerException("customer is null"); //NOI18N
+               }
+
+               // Are at least the required fields set?
+               if (!this.customerController.isRequiredPersonalDataSet()) {
+                       // Trace message
+                       //this.getLogger().logTrace("doCheckout: Not all required fields are set, returning checkout2 ... - EXIT!");
+
+                       // Not set, should not happen
+                       return "checkout2"; //NOI18N
+               } else if (this.basketController.isEmpty()) {
+                       // Trace message
+                       //this.getLogger().logTrace("doCheckout: basket is empty, returning empty_basket ... - EXIT!");
+
+                       // Nothing to order
+                       return "empty_basket"; //NOI18N
+               }
+
+               // Create customer instance
+               this.setCustomer(this.customerController.createCustomerInstance());
+
+               // Debug message
+               //this.getLogger().logDebug(MessageFormat.format("doCheckout: customer={0}", this.getCustomer()));
+               // Get ordered list
+               List<AddableBasketItem> list = this.basketController.allItems();
+
+               // Debug message
+               //this.getLogger().logTrace(MessageFormat.format("doCheckout: list={0}", list));
+               // Construct container
+               WrapableCheckout wrapper = new CheckoutWrapper();
+               wrapper.setCustomer(this.getCustomer());
+               wrapper.setList(list);
+
+               try {
+                       // Construct object message
+                       this.message.setObject(wrapper);
+
+                       // Send message
+                       this.messageProducer.send(this.message);
+               } catch (final JMSException ex) {
+                       // TODO: Log exception?
+                       // Not working
+                       return "jms_failed"; //NOI18N
+               }
+
+               // Clear basket
+               this.basketController.clear();
+
+               // Set customer in receipt controller for verification
+               this.receiptController.setCustomer(this.getCustomer());
+
+               // All fine
+               return "checkout_done"; //NOI18N
+       }
+
+       @Override
+       public Customer getCustomer () {
+               return this.customer;
+       }
+
+       @Override
+       public void setCustomer (final Customer customer) {
+               this.customer = customer;
+       }
+
+       /**
+        * Initialization of this bean
+        */
+       @PostConstruct
+       public void init () {
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Get factory from JMS resource
+                       QueueConnectionFactory connectionFactory = (QueueConnectionFactory) context.lookup("jms/shopConnectionFactory"); //NOI18N
+
+                       // Lookup queue
+                       this.queue = (Queue) context.lookup("jms/shopCheckoutQueue"); //NOI18N
+
+                       // Create connection
+                       this.connection = connectionFactory.createConnection();
+
+                       // Init session instance
+                       this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+                       // And message producer
+                       this.messageProducer = this.session.createProducer(this.queue);
+
+                       // Finally the message instance itself
+                       this.message = this.session.createObjectMessage();
+               } catch (final NamingException | JMSException e) {
+                       // Continued to throw
+                       throw new FacesException(e);
+               }
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionController.java
new file mode 100644 (file)
index 0000000..633c00b
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.checkout;
+
+import java.io.Serializable;
+import org.mxchange.jshopcore.model.customer.Customer;
+
+/**
+ * An interface for the shop
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaCheckoutWebSessionController extends Serializable {
+
+       /**
+        * Runs the actual checkout and returns a proper page redirection target.
+        * <p>
+        * @return Page redirection target
+        */
+       String doCheckout ();
+
+       /**
+        * Getter for customer instance
+        * <p>
+        * @return Customer instance
+        */
+       Customer getCustomer ();
+
+       /**
+        * Setter for customer instance
+        * <p>
+        * @param customer Customer instance
+        */
+       void setCustomer (final Customer customer);
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebApplicationBean.java
deleted file mode 100644 (file)
index 552dbab..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.country;
-
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
-
-/**
- * A country bean
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("country")
-@ApplicationScoped
-public class CountryWebApplicationBean implements CountryWebApplicationController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 176_985_298_681_742_960L;
-
-       /**
-        * Remote country EJB
-        */
-       private CountrySingletonBeanRemote countryBean;
-
-       /**
-        * List of all countries
-        */
-       private List<Country> countryList;
-
-       /**
-        * Default constructor
-        */
-       public CountryWebApplicationBean () {
-               // Try this
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.AddressbookCountrySingletonBeanLocal"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
-       @Override
-       public List<Country> allCountries () {
-               // Return "cached" version
-               return Collections.unmodifiableList(this.countryList);
-       }
-
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-               // "Cache" country list as this will not change so often.
-               this.countryList = this.countryBean.allCountries();
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebApplicationController.java
deleted file mode 100644 (file)
index bdeca74..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.country;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcountry.data.Country;
-
-/**
- * An interface for country beans
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface CountryWebApplicationController extends Serializable {
-
-       /**
-        * A list of all countries
-        * <p>
-        * @return All countries
-        */
-       List<Country> allCountries ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java
new file mode 100644 (file)
index 0000000..c60e797
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.country;
+
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
+
+/**
+ * A country bean
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("country")
+@ApplicationScoped
+public class PizzaCountryWebApplicationBean implements PizzaCountryWebApplicationController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 176_985_298_681_742_960L;
+
+       /**
+        * Remote country EJB
+        */
+       private CountrySingletonBeanRemote countryBean;
+
+       /**
+        * List of all countries
+        */
+       private List<Country> countryList;
+
+       /**
+        * Default constructor
+        */
+       public PizzaCountryWebApplicationBean () {
+               // Try this
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/addressbook-ejb/country!org.mxchange.jcountry.data.AddressbookCountrySingletonBeanLocal"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
+       @Override
+       public List<Country> allCountries () {
+               // Return "cached" version
+               return Collections.unmodifiableList(this.countryList);
+       }
+
+       /**
+        * Post-initialization of this class
+        */
+       @PostConstruct
+       public void init () {
+               // "Cache" country list as this will not change so often.
+               this.countryList = this.countryBean.allCountries();
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationController.java
new file mode 100644 (file)
index 0000000..616891d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.country;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcountry.data.Country;
+
+/**
+ * An interface for country beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaCountryWebApplicationController extends Serializable {
+
+       /**
+        * A list of all countries
+        * <p>
+        * @return All countries
+        */
+       List<Country> allCountries ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebSessionBean.java
deleted file mode 100644 (file)
index a2b4e49..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.customer;
-
-import javax.enterprise.context.SessionScoped;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.UserContact;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jshopcore.model.customer.Customer;
-import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote;
-import org.mxchange.jshopcore.model.customer.ShopCustomer;
-
-/**
- * A customer bean which hides the customer instance
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("customerController")
-@SessionScoped
-public class CustomerWebSessionBean implements CustomerWebSessionController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /////////////////////// Properties /////////////////////
-       /**
-        * Cellphone number
-        */
-       private DialableCellphoneNumber cellphoneNumber;
-
-       /**
-        * City
-        */
-       private String city;
-
-       /**
-        * Optional comments
-        */
-       private String comment;
-
-       /**
-        * Country code
-        */
-       private Country country;
-
-       /**
-        * Remote customer bean
-        */
-       private CustomerSessionBeanRemote customerBean;
-
-       /**
-        * Email address
-        */
-       private String emailAddress;
-
-       /**
-        * Family name
-        */
-       private String familyName;
-
-       /**
-        * Fax number
-        */
-       private DialableFaxNumber faxNumber;
-
-       /**
-        * First name
-        */
-       private String firstName;
-
-       /**
-        * Gender instance
-        */
-       private Gender gender;
-
-       /**
-        * House number
-        */
-       private Short houseNumber;
-
-       /**
-        * Phone number
-        */
-       private DialableLandLineNumber phoneNumber;
-
-       /**
-        * Street
-        */
-       private String street;
-
-       /**
-        * ZIP code
-        */
-       private Integer zipCode;
-
-       /**
-        * Default constructor
-        */
-       public CustomerWebSessionBean () {
-               // Set gender to UNKNOWN
-               this.gender = Gender.UNKNOWN;
-
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.customerBean = (CustomerSessionBeanRemote) context.lookup("ejb/stateless-customer");
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
-       @Override
-       public Customer createCustomerInstance () {
-               // Trace message
-               //this.getLogger().logTrace("createInstance: CALLED!");
-
-               // Required personal data must be set
-               assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
-
-               // Create new customer instance
-               Customer customer = new ShopCustomer();
-
-               // Create new contact
-               Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
-               contact.setContactStreet(this.getStreet());
-               contact.setContactHouseNumber(this.getHouseNumber());
-               contact.setContactZipCode(this.getZipCode());
-               contact.setContactCity(this.getCity());
-               contact.setContactCountry(this.getCountry());
-               contact.setContactLandLineNumber(this.getPhoneNumber());
-               contact.setContactFaxNumber(this.getFaxNumber());
-               contact.setContactCellphoneNumber(this.getCellphoneNumber());
-
-               // Set contact in customer
-               customer.setContact(contact);
-
-               // Trace message
-               //this.getLogger().logTrace(MessageFormat.format("createInstance: customer={0} - EXIT!", customer));
-               // Return it
-               return customer;
-       }
-
-       @Override
-       public DialableCellphoneNumber getCellphoneNumber () {
-               return this.cellphoneNumber;
-       }
-
-       @Override
-       public void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
-               this.cellphoneNumber = cellphoneNumber;
-       }
-
-       @Override
-       public String getCity () {
-               return this.city;
-       }
-
-       @Override
-       public void setCity (final String city) {
-               this.city = city;
-       }
-
-       @Override
-       public Country getCountry () {
-               return this.country;
-       }
-
-       @Override
-       public void setCountry (final Country country) {
-               this.country = country;
-       }
-
-       @Override
-       public String getEmailAddress () {
-               return this.emailAddress;
-       }
-
-       @Override
-       public void setEmailAddress (final String emailAddress) {
-               this.emailAddress = emailAddress;
-       }
-
-       @Override
-       public String getFamilyName () {
-               return this.familyName;
-       }
-
-       @Override
-       public void setFamilyName (final String familyName) {
-               this.familyName = familyName;
-       }
-
-       @Override
-       public DialableFaxNumber getFaxNumber () {
-               return this.faxNumber;
-       }
-
-       @Override
-       public void setFaxNumber (final DialableFaxNumber faxNumber) {
-               this.faxNumber = faxNumber;
-       }
-
-       @Override
-       public String getFirstName () {
-               return this.firstName;
-       }
-
-       @Override
-       public void setFirstName (final String firstName) {
-               this.firstName = firstName;
-       }
-
-       @Override
-       public Gender getGender () {
-               return this.gender;
-       }
-
-       @Override
-       public void setGender (final Gender gender) {
-               this.gender = gender;
-       }
-
-       @Override
-       public Short getHouseNumber () {
-               return this.houseNumber;
-       }
-
-       @Override
-       public void setHouseNumber (final Short houseNumber) {
-               this.houseNumber = houseNumber;
-       }
-
-       @Override
-       public DialableLandLineNumber getPhoneNumber () {
-               return this.phoneNumber;
-       }
-
-       @Override
-       public void setPhoneNumber (final DialableLandLineNumber phoneNumber) {
-               this.phoneNumber = phoneNumber;
-       }
-
-       @Override
-       public String getStreet () {
-               return this.street;
-       }
-
-       @Override
-       public void setStreet (final String street) {
-               this.street = street;
-       }
-
-       @Override
-       public Integer getZipCode () {
-               return this.zipCode;
-       }
-
-       @Override
-       public void setZipCode (final Integer zipCode) {
-               this.zipCode = zipCode;
-       }
-
-       @Override
-       public boolean isRequiredPersonalDataSet () {
-               return ((this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) && (this.getStreet() != null) && (this.getHouseNumber() != null) && (this.getZipCode() != null) && (this.getCity() != null));
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebSessionController.java
deleted file mode 100644 (file)
index 080a8bd..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.customer;
-
-import java.io.Serializable;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jshopcore.model.customer.Customer;
-
-/**
- * An interface for customer beans
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface CustomerWebSessionController extends Serializable {
-
-       /**
-        * Creates an instance from all properties
-        * <p>
-        * @return A Customer instance
-        */
-       Customer createCustomerInstance ();
-
-       /**
-        * Cellphone number
-        * <p>
-        * @return the cellphoneNumber
-        */
-       DialableCellphoneNumber getCellphoneNumber ();
-
-       /**
-        * Cellphone number
-        * <p>
-        * @param cellphoneNumber the cellphoneNumber to set
-        */
-       void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
-
-       /**
-        * City
-        * <p>
-        * @return the city
-        */
-       String getCity ();
-
-       /**
-        * City
-        * <p>
-        * @param city the city to set
-        */
-       void setCity (final String city);
-
-       /**
-        * Getter for country instance
-        * <p>
-        * @return Country instance
-        */
-       Country getCountry ();
-
-       /**
-        * Setter for country instance
-        * <p>
-        * @param country Country instance
-        */
-       void setCountry (final Country country);
-
-       /**
-        * Email address
-        * <p>
-        * @return the emailAddress
-        */
-       String getEmailAddress ();
-
-       /**
-        * Email address
-        * <p>
-        * @param emailAddress the emailAddress to set
-        */
-       void setEmailAddress (final String emailAddress);
-
-       /**
-        * Family name
-        * <p>
-        * @return the familyName
-        */
-       String getFamilyName ();
-
-       /**
-        * Family name
-        * <p>
-        * @param familyName the familyName to set
-        */
-       void setFamilyName (final String familyName);
-
-       /**
-        * Fax number
-        * <p>
-        * @return the faxNumber
-        */
-       DialableFaxNumber getFaxNumber ();
-
-       /**
-        * Fax number
-        * <p>
-        * @param faxNumber the faxNumber to set
-        */
-       void setFaxNumber (final DialableFaxNumber faxNumber);
-
-       /**
-        * First name
-        * <p>
-        * @return the first name
-        */
-       String getFirstName ();
-
-       /**
-        * First name
-        * <p>
-        * @param firstName the first name to set
-        */
-       void setFirstName (final String firstName);
-
-       /**
-        * Gender of the contact
-        * <p>
-        * @return the gender
-        */
-       Gender getGender ();
-
-       /**
-        * Gender of the contact
-        * <p>
-        * @param gender the gender to set
-        */
-       void setGender (final Gender gender);
-
-       /**
-        * House number
-        * <p>
-        * @return the houseNumber
-        */
-       Short getHouseNumber ();
-
-       /**
-        * House number
-        * <p>
-        * @param houseNumber the houseNumber to set
-        */
-       void setHouseNumber (final Short houseNumber);
-
-       /**
-        * Phone number
-        * <p>
-        * @return the phoneNumber
-        */
-       DialableLandLineNumber getPhoneNumber ();
-
-       /**
-        * Phone number
-        * <p>
-        * @param phoneNumber the phoneNumber to set
-        */
-       void setPhoneNumber (final DialableLandLineNumber phoneNumber);
-
-       /**
-        * Street
-        * <p>
-        * @return the street
-        */
-       String getStreet ();
-
-       /**
-        * Street
-        * <p>
-        * @param street the street to set
-        */
-       void setStreet (final String street);
-
-       /**
-        * ZIP code
-        * <p>
-        * @return the zipCode
-        */
-       Integer getZipCode ();
-
-       /**
-        * ZIP code
-        * <p>
-        * @param zipCode the zipCode to set
-        */
-       void setZipCode (final Integer zipCode);
-
-       /**
-        * Checks whether all required personal data is set
-        * <p>
-        * @return Whether the required personal data is set
-        */
-       boolean isRequiredPersonalDataSet ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java
new file mode 100644 (file)
index 0000000..6b3b64b
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.customer;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.contact.UserContact;
+import org.mxchange.jcontacts.contact.gender.Gender;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jshopcore.model.customer.Customer;
+import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote;
+import org.mxchange.jshopcore.model.customer.ShopCustomer;
+
+/**
+ * A customer bean which hides the customer instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("customerController")
+@SessionScoped
+public class PizzaCustomerWebSessionBean implements PizzaCustomerWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_916L;
+
+       /////////////////////// Properties /////////////////////
+       /**
+        * Cellphone number
+        */
+       private DialableCellphoneNumber cellphoneNumber;
+
+       /**
+        * City
+        */
+       private String city;
+
+       /**
+        * Optional comments
+        */
+       private String comment;
+
+       /**
+        * Country code
+        */
+       private Country country;
+
+       /**
+        * Remote customer bean
+        */
+       private CustomerSessionBeanRemote customerBean;
+
+       /**
+        * Email address
+        */
+       private String emailAddress;
+
+       /**
+        * Family name
+        */
+       private String familyName;
+
+       /**
+        * Fax number
+        */
+       private DialableFaxNumber faxNumber;
+
+       /**
+        * First name
+        */
+       private String firstName;
+
+       /**
+        * Gender instance
+        */
+       private Gender gender;
+
+       /**
+        * House number
+        */
+       private Short houseNumber;
+
+       /**
+        * Phone number
+        */
+       private DialableLandLineNumber phoneNumber;
+
+       /**
+        * Street
+        */
+       private String street;
+
+       /**
+        * ZIP code
+        */
+       private Integer zipCode;
+
+       /**
+        * Default constructor
+        */
+       public PizzaCustomerWebSessionBean () {
+               // Set gender to UNKNOWN
+               this.gender = Gender.UNKNOWN;
+
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.customerBean = (CustomerSessionBeanRemote) context.lookup("ejb/stateless-customer");
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public Customer createCustomerInstance () {
+               // Trace message
+               //this.getLogger().logTrace("createInstance: CALLED!");
+
+               // Required personal data must be set
+               assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
+
+               // Create new customer instance
+               Customer customer = new ShopCustomer();
+
+               // Create new contact
+               Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
+               contact.setContactStreet(this.getStreet());
+               contact.setContactHouseNumber(this.getHouseNumber());
+               contact.setContactZipCode(this.getZipCode());
+               contact.setContactCity(this.getCity());
+               contact.setContactCountry(this.getCountry());
+               contact.setContactLandLineNumber(this.getPhoneNumber());
+               contact.setContactFaxNumber(this.getFaxNumber());
+               contact.setContactCellphoneNumber(this.getCellphoneNumber());
+
+               // Set contact in customer
+               customer.setContact(contact);
+
+               // Trace message
+               //this.getLogger().logTrace(MessageFormat.format("createInstance: customer={0} - EXIT!", customer));
+               // Return it
+               return customer;
+       }
+
+       @Override
+       public DialableCellphoneNumber getCellphoneNumber () {
+               return this.cellphoneNumber;
+       }
+
+       @Override
+       public void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
+               this.cellphoneNumber = cellphoneNumber;
+       }
+
+       @Override
+       public String getCity () {
+               return this.city;
+       }
+
+       @Override
+       public void setCity (final String city) {
+               this.city = city;
+       }
+
+       @Override
+       public Country getCountry () {
+               return this.country;
+       }
+
+       @Override
+       public void setCountry (final Country country) {
+               this.country = country;
+       }
+
+       @Override
+       public String getEmailAddress () {
+               return this.emailAddress;
+       }
+
+       @Override
+       public void setEmailAddress (final String emailAddress) {
+               this.emailAddress = emailAddress;
+       }
+
+       @Override
+       public String getFamilyName () {
+               return this.familyName;
+       }
+
+       @Override
+       public void setFamilyName (final String familyName) {
+               this.familyName = familyName;
+       }
+
+       @Override
+       public DialableFaxNumber getFaxNumber () {
+               return this.faxNumber;
+       }
+
+       @Override
+       public void setFaxNumber (final DialableFaxNumber faxNumber) {
+               this.faxNumber = faxNumber;
+       }
+
+       @Override
+       public String getFirstName () {
+               return this.firstName;
+       }
+
+       @Override
+       public void setFirstName (final String firstName) {
+               this.firstName = firstName;
+       }
+
+       @Override
+       public Gender getGender () {
+               return this.gender;
+       }
+
+       @Override
+       public void setGender (final Gender gender) {
+               this.gender = gender;
+       }
+
+       @Override
+       public Short getHouseNumber () {
+               return this.houseNumber;
+       }
+
+       @Override
+       public void setHouseNumber (final Short houseNumber) {
+               this.houseNumber = houseNumber;
+       }
+
+       @Override
+       public DialableLandLineNumber getPhoneNumber () {
+               return this.phoneNumber;
+       }
+
+       @Override
+       public void setPhoneNumber (final DialableLandLineNumber phoneNumber) {
+               this.phoneNumber = phoneNumber;
+       }
+
+       @Override
+       public String getStreet () {
+               return this.street;
+       }
+
+       @Override
+       public void setStreet (final String street) {
+               this.street = street;
+       }
+
+       @Override
+       public Integer getZipCode () {
+               return this.zipCode;
+       }
+
+       @Override
+       public void setZipCode (final Integer zipCode) {
+               this.zipCode = zipCode;
+       }
+
+       @Override
+       public boolean isRequiredPersonalDataSet () {
+               return ((this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) && (this.getStreet() != null) && (this.getHouseNumber() != null) && (this.getZipCode() != null) && (this.getCity() != null));
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionController.java
new file mode 100644 (file)
index 0000000..825192f
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.customer;
+
+import java.io.Serializable;
+import org.mxchange.jcontacts.contact.gender.Gender;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jshopcore.model.customer.Customer;
+
+/**
+ * An interface for customer beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaCustomerWebSessionController extends Serializable {
+
+       /**
+        * Creates an instance from all properties
+        * <p>
+        * @return A Customer instance
+        */
+       Customer createCustomerInstance ();
+
+       /**
+        * Cellphone number
+        * <p>
+        * @return the cellphoneNumber
+        */
+       DialableCellphoneNumber getCellphoneNumber ();
+
+       /**
+        * Cellphone number
+        * <p>
+        * @param cellphoneNumber the cellphoneNumber to set
+        */
+       void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
+
+       /**
+        * City
+        * <p>
+        * @return the city
+        */
+       String getCity ();
+
+       /**
+        * City
+        * <p>
+        * @param city the city to set
+        */
+       void setCity (final String city);
+
+       /**
+        * Getter for country instance
+        * <p>
+        * @return Country instance
+        */
+       Country getCountry ();
+
+       /**
+        * Setter for country instance
+        * <p>
+        * @param country Country instance
+        */
+       void setCountry (final Country country);
+
+       /**
+        * Email address
+        * <p>
+        * @return the emailAddress
+        */
+       String getEmailAddress ();
+
+       /**
+        * Email address
+        * <p>
+        * @param emailAddress the emailAddress to set
+        */
+       void setEmailAddress (final String emailAddress);
+
+       /**
+        * Family name
+        * <p>
+        * @return the familyName
+        */
+       String getFamilyName ();
+
+       /**
+        * Family name
+        * <p>
+        * @param familyName the familyName to set
+        */
+       void setFamilyName (final String familyName);
+
+       /**
+        * Fax number
+        * <p>
+        * @return the faxNumber
+        */
+       DialableFaxNumber getFaxNumber ();
+
+       /**
+        * Fax number
+        * <p>
+        * @param faxNumber the faxNumber to set
+        */
+       void setFaxNumber (final DialableFaxNumber faxNumber);
+
+       /**
+        * First name
+        * <p>
+        * @return the first name
+        */
+       String getFirstName ();
+
+       /**
+        * First name
+        * <p>
+        * @param firstName the first name to set
+        */
+       void setFirstName (final String firstName);
+
+       /**
+        * Gender of the contact
+        * <p>
+        * @return the gender
+        */
+       Gender getGender ();
+
+       /**
+        * Gender of the contact
+        * <p>
+        * @param gender the gender to set
+        */
+       void setGender (final Gender gender);
+
+       /**
+        * House number
+        * <p>
+        * @return the houseNumber
+        */
+       Short getHouseNumber ();
+
+       /**
+        * House number
+        * <p>
+        * @param houseNumber the houseNumber to set
+        */
+       void setHouseNumber (final Short houseNumber);
+
+       /**
+        * Phone number
+        * <p>
+        * @return the phoneNumber
+        */
+       DialableLandLineNumber getPhoneNumber ();
+
+       /**
+        * Phone number
+        * <p>
+        * @param phoneNumber the phoneNumber to set
+        */
+       void setPhoneNumber (final DialableLandLineNumber phoneNumber);
+
+       /**
+        * Street
+        * <p>
+        * @return the street
+        */
+       String getStreet ();
+
+       /**
+        * Street
+        * <p>
+        * @param street the street to set
+        */
+       void setStreet (final String street);
+
+       /**
+        * ZIP code
+        * <p>
+        * @return the zipCode
+        */
+       Integer getZipCode ();
+
+       /**
+        * ZIP code
+        * <p>
+        * @param zipCode the zipCode to set
+        */
+       void setZipCode (final Integer zipCode);
+
+       /**
+        * Checks whether all required personal data is set
+        * <p>
+        * @return Whether the required personal data is set
+        */
+       boolean isRequiredPersonalDataSet ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebApplicationBean.java
deleted file mode 100644 (file)
index e59e4cd..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-package org.mxchange.pizzaapplication.beans.gender;
-
-import java.util.List;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcontacts.contact.gender.GenderUtils;
-
-/**
- * A gender bean (controller)
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("gender")
-@ApplicationScoped
-public class GenderWebApplicationBean implements GenderWebApplicationController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 835_482_364_189L;
-
-       /**
-        * Default constructor
-        */
-       public GenderWebApplicationBean () {
-       }
-
-       @Override
-       public Gender[] getAllGenders () {
-               // Return it
-               return Gender.values();
-       }
-
-       @Override
-       public List<Gender> getSelectableGenders () {
-               // Init array
-               // TODO Call EJB here?
-               List<Gender> genders = GenderUtils.selectableGenders();
-
-               // Return it
-               return genders;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebApplicationController.java
deleted file mode 100644 (file)
index 536eaea..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.gender;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcontacts.contact.gender.Gender;
-
-/**
- * An interface for data beans
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface GenderWebApplicationController extends Serializable {
-
-       /**
-        * Getter for all genders as array
-        * <p>
-        * @return All genders as array
-        */
-       Gender[] getAllGenders ();
-
-       /**
-        * Getter for only selectable genders as array, UNKNOWN is not selectable
-        * <p>
-        * @return All genders as array
-        */
-       List<Gender> getSelectableGenders ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java
new file mode 100644 (file)
index 0000000..eb956f1
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+package org.mxchange.pizzaapplication.beans.gender;
+
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import org.mxchange.jcontacts.contact.gender.Gender;
+import org.mxchange.jcontacts.contact.gender.GenderUtils;
+
+/**
+ * A gender bean (controller)
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("gender")
+@ApplicationScoped
+public class PizzaGenderWebApplicationBean implements PizzaGenderWebApplicationController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 835_482_364_189L;
+
+       /**
+        * Default constructor
+        */
+       public PizzaGenderWebApplicationBean () {
+       }
+
+       @Override
+       public Gender[] getAllGenders () {
+               // Return it
+               return Gender.values();
+       }
+
+       @Override
+       public List<Gender> getSelectableGenders () {
+               // Init array
+               // TODO Call EJB here?
+               List<Gender> genders = GenderUtils.selectableGenders();
+
+               // Return it
+               return genders;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationController.java
new file mode 100644 (file)
index 0000000..9e0b9d8
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.gender;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcontacts.contact.gender.Gender;
+
+/**
+ * An interface for data beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaGenderWebApplicationController extends Serializable {
+
+       /**
+        * Getter for all genders as array
+        * <p>
+        * @return All genders as array
+        */
+       Gender[] getAllGenders ();
+
+       /**
+        * Getter for only selectable genders as array, UNKNOWN is not selectable
+        * <p>
+        * @return All genders as array
+        */
+       List<Gender> getSelectableGenders ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/localization/LocalizationSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/localization/LocalizationSessionController.java
deleted file mode 100644 (file)
index 7383bdd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.localization;
-
-import java.io.Serializable;
-import java.util.Locale;
-
-/**
- * An interface for localization change beans
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface LocalizationSessionController extends Serializable {
-
-       /**
-        * Getter for locale
-        * <p>
-        * @return Locale
-        */
-       Locale getLocale ();
-
-       /**
-        * Setter for locale
-        * <p>
-        * @param locale Locale
-        */
-       void setLocale (final Locale locale);
-
-}
index 8c107ed4a24e82fd91e183ab8f57b4c3efbfc96a..b8fb5cde08be99cfd1515247fb8586f884990dd6 100644 (file)
@@ -33,7 +33,7 @@ import org.mxchange.jcoreee.database.BaseDatabaseBean;
  */
 @Named ("localization")
 @SessionScoped
-public class PizzaLocalizationSessionBean extends BaseDatabaseBean implements LocalizationSessionController {
+public class PizzaLocalizationSessionBean extends BaseDatabaseBean implements PizzaLocalizationSessionController {
 
        /**
         * Serial number
diff --git a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java
new file mode 100644 (file)
index 0000000..e4c9813
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.localization;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * An interface for localization change beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaLocalizationSessionController extends Serializable {
+
+       /**
+        * Getter for locale
+        * <p>
+        * @return Locale
+        */
+       Locale getLocale ();
+
+       /**
+        * Setter for locale
+        * <p>
+        * @param locale Locale
+        */
+       void setLocale (final Locale locale);
+
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebRequestBean.java
deleted file mode 100644 (file)
index 3f0516c..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.product;
-
-import java.util.List;
-import javax.enterprise.context.RequestScoped;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jshopcore.exceptions.CannotAddProductException;
-import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.product.AdminProductSessionBeanRemote;
-import org.mxchange.jshopcore.model.product.GenericProduct;
-import org.mxchange.jshopcore.model.product.Product;
-import org.mxchange.pizzaapplication.beans.shop.ShopWebApplicationController;
-
-/**
- * Main application class
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("adminProductController")
-@RequestScoped
-public class AdminProductWebRequestBean implements AdminProductWebRequestController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 5_819_375_183_472_871L;
-
-       /////////////////////// Properties /////////////////////
-       /**
-        * Available
-        */
-       private Boolean productAvailability;
-
-       /**
-        * Category instance
-        */
-       private Category productCategory;
-
-       /**
-        * Property productPrice
-        */
-       private Float productPrice;
-
-       /**
-        * Remote bean for products
-        */
-       private AdminProductSessionBeanRemote productRemoteBean;
-
-       /**
-        * Property productTitle
-        */
-       private String productTitle;
-
-       ////////////////////// Bean injections ///////////////////////
-
-       /**
-        * Shop bean
-        */
-       @Inject
-       private ShopWebApplicationController shopController;
-
-       /**
-        * Default constructor
-        */
-       public AdminProductWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       this.productRemoteBean = (AdminProductSessionBeanRemote) context.lookup("ejb/stateless-admin-product"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
-       }
-
-       @Override
-       public void addProduct () throws FaceletException {
-               try {
-                       // Create product instance
-                       Product product = new GenericProduct();
-
-                       // Add all
-                       product.setProductAvailability(this.getProductAvailability());
-                       product.setProductCategory(this.getProductCategory());
-                       product.setProductPrice(this.getProductPrice());
-                       product.setProductTitle(this.getProductTitle());
-
-                       // Call bean
-                       Product updatedProduct = this.productRemoteBean.doAdminAddProduct(product);
-
-                       // Add to shop controller
-                       this.shopController.addProduct(updatedProduct);
-
-                       // Set all to null
-                       this.setProductAvailability(Boolean.FALSE);
-                       this.setProductCategory(null);
-                       this.setProductPrice(null);
-                       this.setProductTitle(null);
-               } catch (final ProductTitleAlreadyUsedException | CannotAddProductException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
-       @Override
-       public List<Product> getAllProducts () throws FaceletException {
-               // Call bean
-               return this.productRemoteBean.getAllProducts();
-       }
-
-       @Override
-       public Boolean getProductAvailability () {
-               return this.productAvailability;
-       }
-
-       @Override
-       public void setProductAvailability (final Boolean productAvailability) {
-               this.productAvailability = productAvailability;
-       }
-
-       @Override
-       public Category getProductCategory () {
-               return this.productCategory;
-       }
-
-       @Override
-       public void setProductCategory (final Category productCategory) {
-               this.productCategory = productCategory;
-       }
-
-       @Override
-       public Float getProductPrice () {
-               return this.productPrice;
-       }
-
-       @Override
-       public void setProductPrice (final Float productPrice) {
-               this.productPrice = productPrice;
-       }
-
-       @Override
-       public String getProductTitle () {
-               return this.productTitle;
-       }
-
-       @Override
-       public void setProductTitle (final String productTitle) {
-               this.productTitle = productTitle;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebRequestController.java
deleted file mode 100644 (file)
index e0bbda8..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.product;
-
-import java.util.List;
-import javax.faces.view.facelets.FaceletException;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for product controllers for "ADMIN" role
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface AdminProductWebRequestController {
-
-       /**
-        * Adds given product data from request to database
-        * <p>
-        * @throws javax.faces.view.facelets.FaceletException If something
-        * unexpected happened
-        */
-       void addProduct () throws FaceletException;
-
-       /**
-        * Some "getter" for a linked list of all products
-        * <p>
-        * @return All products
-        * <p>
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       List<Product> getAllProducts () throws FaceletException;
-
-       /**
-        * Getter for product's available property
-        * <p>
-        * @return Product's available property
-        */
-       Boolean getProductAvailability ();
-
-       /**
-        * Setter for product's available property
-        * <p>
-        * @param available Product's available property
-        */
-       void setProductAvailability (final Boolean available);
-
-       /**
-        * Getter for product's category
-        * <p>
-        * @return Product's category
-        */
-       Category getProductCategory ();
-
-       /**
-        * Setter for product's category instance
-        * <p>
-        * @param productCategory Product's category instance
-        */
-       void setProductCategory (final Category productCategory);
-
-       /**
-        * Getter for product's price property
-        * <p>
-        * @return Product's price property
-        */
-       Float getProductPrice ();
-
-       /**
-        * Setter for product's price property
-        * <p>
-        * @param price Product's price property
-        */
-       void setProductPrice (final Float price);
-
-       /**
-        * Getter for product's title property
-        * <p>
-        * @return Product's title
-        */
-       String getProductTitle ();
-
-       /**
-        * Setter for product's title property
-        * <p>
-        * @param title Product's title
-        */
-       void setProductTitle (final String title);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java
new file mode 100644 (file)
index 0000000..b329e09
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.product;
+
+import java.util.List;
+import javax.enterprise.context.RequestScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jshopcore.exceptions.CannotAddProductException;
+import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.product.AdminProductSessionBeanRemote;
+import org.mxchange.jshopcore.model.product.GenericProduct;
+import org.mxchange.jshopcore.model.product.Product;
+import org.mxchange.pizzaapplication.beans.shop.PizzaShopWebApplicationController;
+
+/**
+ * Main application class
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("adminProductController")
+@RequestScoped
+public class PizzaAdminProductWebRequestBean implements PizzaAdminProductWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_819_375_183_472_871L;
+
+       /////////////////////// Properties /////////////////////
+       /**
+        * Available
+        */
+       private Boolean productAvailability;
+
+       /**
+        * Category instance
+        */
+       private Category productCategory;
+
+       /**
+        * Property productPrice
+        */
+       private Float productPrice;
+
+       /**
+        * Remote bean for products
+        */
+       private AdminProductSessionBeanRemote productRemoteBean;
+
+       /**
+        * Property productTitle
+        */
+       private String productTitle;
+
+       ////////////////////// Bean injections ///////////////////////
+
+       /**
+        * Shop bean
+        */
+       @Inject
+       private PizzaShopWebApplicationController shopController;
+
+       /**
+        * Default constructor
+        */
+       public PizzaAdminProductWebRequestBean () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       this.productRemoteBean = (AdminProductSessionBeanRemote) context.lookup("ejb/stateless-admin-product"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public void addProduct () throws FaceletException {
+               try {
+                       // Create product instance
+                       Product product = new GenericProduct();
+
+                       // Add all
+                       product.setProductAvailability(this.getProductAvailability());
+                       product.setProductCategory(this.getProductCategory());
+                       product.setProductPrice(this.getProductPrice());
+                       product.setProductTitle(this.getProductTitle());
+
+                       // Call bean
+                       Product updatedProduct = this.productRemoteBean.doAdminAddProduct(product);
+
+                       // Add to shop controller
+                       this.shopController.addProduct(updatedProduct);
+
+                       // Set all to null
+                       this.setProductAvailability(Boolean.FALSE);
+                       this.setProductCategory(null);
+                       this.setProductPrice(null);
+                       this.setProductTitle(null);
+               } catch (final ProductTitleAlreadyUsedException | CannotAddProductException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
+       @Override
+       public List<Product> getAllProducts () throws FaceletException {
+               // Call bean
+               return this.productRemoteBean.getAllProducts();
+       }
+
+       @Override
+       public Boolean getProductAvailability () {
+               return this.productAvailability;
+       }
+
+       @Override
+       public void setProductAvailability (final Boolean productAvailability) {
+               this.productAvailability = productAvailability;
+       }
+
+       @Override
+       public Category getProductCategory () {
+               return this.productCategory;
+       }
+
+       @Override
+       public void setProductCategory (final Category productCategory) {
+               this.productCategory = productCategory;
+       }
+
+       @Override
+       public Float getProductPrice () {
+               return this.productPrice;
+       }
+
+       @Override
+       public void setProductPrice (final Float productPrice) {
+               this.productPrice = productPrice;
+       }
+
+       @Override
+       public String getProductTitle () {
+               return this.productTitle;
+       }
+
+       @Override
+       public void setProductTitle (final String productTitle) {
+               this.productTitle = productTitle;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestController.java
new file mode 100644 (file)
index 0000000..3a9a67a
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.product;
+
+import java.util.List;
+import javax.faces.view.facelets.FaceletException;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaAdminProductWebRequestController {
+
+       /**
+        * Adds given product data from request to database
+        * <p>
+        * @throws javax.faces.view.facelets.FaceletException If something
+        * unexpected happened
+        */
+       void addProduct () throws FaceletException;
+
+       /**
+        * Some "getter" for a linked list of all products
+        * <p>
+        * @return All products
+        * <p>
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       List<Product> getAllProducts () throws FaceletException;
+
+       /**
+        * Getter for product's available property
+        * <p>
+        * @return Product's available property
+        */
+       Boolean getProductAvailability ();
+
+       /**
+        * Setter for product's available property
+        * <p>
+        * @param available Product's available property
+        */
+       void setProductAvailability (final Boolean available);
+
+       /**
+        * Getter for product's category
+        * <p>
+        * @return Product's category
+        */
+       Category getProductCategory ();
+
+       /**
+        * Setter for product's category instance
+        * <p>
+        * @param productCategory Product's category instance
+        */
+       void setProductCategory (final Category productCategory);
+
+       /**
+        * Getter for product's price property
+        * <p>
+        * @return Product's price property
+        */
+       Float getProductPrice ();
+
+       /**
+        * Setter for product's price property
+        * <p>
+        * @param price Product's price property
+        */
+       void setProductPrice (final Float price);
+
+       /**
+        * Getter for product's title property
+        * <p>
+        * @return Product's title
+        */
+       String getProductTitle ();
+
+       /**
+        * Setter for product's title property
+        * <p>
+        * @param title Product's title
+        */
+       void setProductTitle (final String title);
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java
new file mode 100644 (file)
index 0000000..7239b81
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.receipt;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jshopcore.model.customer.Customer;
+import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote;
+
+/**
+ * Checkout controller
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("receiptController")
+@SessionScoped
+public class PizzaReceiptWebSessionBean implements PizzaReceiptWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 95_723_834_783_478_781L;
+
+       /**
+        * Customer instance
+        */
+       private Customer customer;
+
+       /**
+        * Remote bean instance
+        */
+       private ReceiptBeanRemote receiptBean;
+
+       /**
+        * Default constructor
+        */
+       public PizzaReceiptWebSessionBean () {
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Get factory from JMS resource
+                       this.receiptBean = (ReceiptBeanRemote) context.lookup("ejb/stateless-receipt");
+               } catch (final NamingException e) {
+                       // Continued to throw
+                       throw new FacesException(e);
+               }
+       }
+
+       @Override
+       public String fetchAccessKey () {
+               return this.receiptBean.fetchAccessKey(this.getCustomer());
+       }
+
+       @Override
+       public Customer getCustomer () {
+               return this.customer;
+       }
+
+       @Override
+       public void setCustomer (final Customer customer) {
+               this.customer = customer;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionController.java
new file mode 100644 (file)
index 0000000..0b5fb54
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.receipt;
+
+import java.io.Serializable;
+import org.mxchange.jshopcore.model.customer.Customer;
+
+/**
+ * An interface for the shop
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaReceiptWebSessionController extends Serializable {
+
+       /**
+        * Fetches last access key for given customer instance
+        * <p>
+        * @return Access key to receipt
+        */
+       String fetchAccessKey ();
+
+       /**
+        * Getter for customer instamce
+        * <p>
+        * @return Customer instance
+        */
+       Customer getCustomer ();
+
+       /**
+        * Setter for customer instamce
+        * <p>
+        * @param customer Customer instance
+        */
+       void setCustomer (final Customer customer);
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebSessionBean.java
deleted file mode 100644 (file)
index eab1ba6..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.receipt;
-
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jshopcore.model.customer.Customer;
-import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote;
-
-/**
- * Checkout controller
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("receiptController")
-@SessionScoped
-public class ReceiptWebSessionBean implements ReceiptWebSessionController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 95_723_834_783_478_781L;
-
-       /**
-        * Customer instance
-        */
-       private Customer customer;
-
-       /**
-        * Remote bean instance
-        */
-       private ReceiptBeanRemote receiptBean;
-
-       /**
-        * Default constructor
-        */
-       public ReceiptWebSessionBean () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Get factory from JMS resource
-                       this.receiptBean = (ReceiptBeanRemote) context.lookup("ejb/stateless-receipt");
-               } catch (final NamingException e) {
-                       // Continued to throw
-                       throw new FacesException(e);
-               }
-       }
-
-       @Override
-       public String fetchAccessKey () {
-               return this.receiptBean.fetchAccessKey(this.getCustomer());
-       }
-
-       @Override
-       public Customer getCustomer () {
-               return this.customer;
-       }
-
-       @Override
-       public void setCustomer (final Customer customer) {
-               this.customer = customer;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebSessionController.java
deleted file mode 100644 (file)
index 2238bc1..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.receipt;
-
-import java.io.Serializable;
-import org.mxchange.jshopcore.model.customer.Customer;
-
-/**
- * An interface for the shop
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface ReceiptWebSessionController extends Serializable {
-
-       /**
-        * Fetches last access key for given customer instance
-        * <p>
-        * @return Access key to receipt
-        */
-       String fetchAccessKey ();
-
-       /**
-        * Getter for customer instamce
-        * <p>
-        * @return Customer instance
-        */
-       Customer getCustomer ();
-
-       /**
-        * Setter for customer instamce
-        * <p>
-        * @param customer Customer instance
-        */
-       void setCustomer (final Customer customer);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationBean.java
new file mode 100644 (file)
index 0000000..f85638b
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.shop;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.faces.FacesException;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
+import org.mxchange.jshopcore.model.product.Product;
+import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
+
+/**
+ * General shop controller
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("controller")
+@ApplicationScoped
+public class PizzaShopWebApplicationBean implements PizzaShopWebApplicationController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 58_137_539_530_279L;
+
+       /**
+        * "Cache" for all available products
+        */
+       private List<Product> availableProducts;
+
+       /**
+        * All categories
+        */
+       private List<Category> categories;
+
+       @Override
+       public void addCategory (final Category category) {
+               // Add the category
+               this.categories.add(category);
+       }
+
+       @Override
+       public void addProduct (final Product product) {
+               // Is the product available?
+               if (product.getProductAvailability()) {
+                       // Add it
+                       this.availableProducts.add(product);
+               }
+       }
+
+       @Override
+       public List<Category> getAllCategories () throws FacesException {
+               // Return it
+               // TODO Find something better here to prevent warning
+               return Collections.unmodifiableList(this.categories);
+       }
+
+       @Override
+       public List<Category> getAllCategoriesParent () throws FaceletException {
+               // Get regular list
+               List<Category> list = new LinkedList<>(this.getAllCategories());
+
+               // Return it
+               return list;
+       }
+
+       @Override
+       public List<Product> getAvailableProducts () throws FacesException {
+               // Return it
+               // TODO Find something better here to prevent warning
+               return Collections.unmodifiableList(this.availableProducts);
+       }
+
+       /**
+        * Initialization of this bean
+        */
+       @PostConstruct
+       public void init () {
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       CategorySessionBeanRemote categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
+
+                       // Get all categories
+                       this.categories = categoryBean.getAllCategories();
+
+                       // Try to lookup the bean
+                       ProductSessionBeanRemote productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
+
+                       // Get available products list
+                       this.availableProducts = productBean.getAvailableProducts();
+               } catch (final NamingException e) {
+                       // Continued to throw
+                       throw new FacesException(e);
+               }
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationController.java
new file mode 100644 (file)
index 0000000..5cbe8fc
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.shop;
+
+import java.io.Serializable;
+import java.util.List;
+import javax.faces.view.facelets.FaceletException;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * An interface for the shop
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaShopWebApplicationController extends Serializable {
+
+       /**
+        * Adds given category to the "cached" instance
+        * <p>
+        * @param category Category instance
+        */
+       void addCategory (final Category category);
+
+       /**
+        * Adds given product to the "cached" instance
+        * <p>
+        * @param product Product instance
+        */
+       void addProduct (final Product product);
+
+       /**
+        * Some "getter" for a linked list of all categories
+        * <p>
+        * @return All categories
+        * <p>
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       List<Category> getAllCategories () throws FaceletException;
+
+       /**
+        * Some "getter" for a linked list of all categories including "Has no
+        * parent" fake category.
+        * <p>
+        * @return All categories
+        * <p>
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       List<Category> getAllCategoriesParent () throws FaceletException;
+
+       /**
+        * Some "getter" for a linked list of only available products
+        * <p>
+        * @return Only available products
+        * <p>
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       List<Product> getAvailableProducts () throws FaceletException;
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebApplicationBean.java
deleted file mode 100644 (file)
index 52d6082..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.shop;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.faces.FacesException;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
-import org.mxchange.jshopcore.model.product.Product;
-import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
-
-/**
- * General shop controller
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("controller")
-@ApplicationScoped
-public class ShopWebApplicationBean implements ShopWebApplicationController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 58_137_539_530_279L;
-
-       /**
-        * "Cache" for all available products
-        */
-       private List<Product> availableProducts;
-
-       /**
-        * All categories
-        */
-       private List<Category> categories;
-
-       @Override
-       public void addCategory (final Category category) {
-               // Add the category
-               this.categories.add(category);
-       }
-
-       @Override
-       public void addProduct (final Product product) {
-               // Is the product available?
-               if (product.getProductAvailability()) {
-                       // Add it
-                       this.availableProducts.add(product);
-               }
-       }
-
-       @Override
-       public List<Category> getAllCategories () throws FacesException {
-               // Return it
-               // TODO Find something better here to prevent warning
-               return Collections.unmodifiableList(this.categories);
-       }
-
-       @Override
-       public List<Category> getAllCategoriesParent () throws FaceletException {
-               // Get regular list
-               List<Category> list = new LinkedList<>(this.getAllCategories());
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       public List<Product> getAvailableProducts () throws FacesException {
-               // Return it
-               // TODO Find something better here to prevent warning
-               return Collections.unmodifiableList(this.availableProducts);
-       }
-
-       /**
-        * Initialization of this bean
-        */
-       @PostConstruct
-       public void init () {
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the bean
-                       CategorySessionBeanRemote categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
-
-                       // Get all categories
-                       this.categories = categoryBean.getAllCategories();
-
-                       // Try to lookup the bean
-                       ProductSessionBeanRemote productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
-
-                       // Get available products list
-                       this.availableProducts = productBean.getAvailableProducts();
-               } catch (final NamingException e) {
-                       // Continued to throw
-                       throw new FacesException(e);
-               }
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebApplicationController.java b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebApplicationController.java
deleted file mode 100644 (file)
index 69ded40..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.shop;
-
-import java.io.Serializable;
-import java.util.List;
-import javax.faces.view.facelets.FaceletException;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for the shop
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface ShopWebApplicationController extends Serializable {
-
-       /**
-        * Adds given category to the "cached" instance
-        * <p>
-        * @param category Category instance
-        */
-       void addCategory (final Category category);
-
-       /**
-        * Adds given product to the "cached" instance
-        * <p>
-        * @param product Product instance
-        */
-       void addProduct (final Product product);
-
-       /**
-        * Some "getter" for a linked list of all categories
-        * <p>
-        * @return All categories
-        * <p>
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       List<Category> getAllCategories () throws FaceletException;
-
-       /**
-        * Some "getter" for a linked list of all categories including "Has no
-        * parent" fake category.
-        * <p>
-        * @return All categories
-        * <p>
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       List<Category> getAllCategoriesParent () throws FaceletException;
-
-       /**
-        * Some "getter" for a linked list of only available products
-        * <p>
-        * @return Only available products
-        * <p>
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       List<Product> getAvailableProducts () throws FaceletException;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java b/src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java
deleted file mode 100644 (file)
index 9d55184..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.servlet.receipt;
-
-import java.io.IOException;
-import javax.faces.view.facelets.FaceletException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote;
-import org.mxchange.jshopcore.model.receipt.WrapableReceipt;
-
-/**
- * A servlet for a PDF receipt (official)
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public class PdfReceiptServlet extends HttpServlet {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 497_345_834_783_781L;
-
-       /**
-        * Remote bean
-        */
-       private ReceiptBeanRemote receiptBean;
-
-       /**
-        * Public constructor
-        */
-       public PdfReceiptServlet () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Set instance
-                       this.receiptBean = (ReceiptBeanRemote) context.lookup("ejb/pdf-receipt"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-       }
-
-       @Override
-       public String getServletInfo () {
-               return "Produces a receipt as PDF file for given access key.";
-       }
-
-       @Override
-       protected void doGet (final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-               // Is the key set?
-               if (request.getParameter("key") == null) { //NOI18N
-                       // No more processing here
-                       super.doGet(request, response);
-                       return;
-               }
-
-               // Get PDF from bean
-               WrapableReceipt receipt = this.receiptBean.createReceiptFromAccessKey(request.getParameter("key")); //NOI18N
-
-               // TODO Write it's content to response output
-       }
-
-       @Override
-       protected void doPost (final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
-               // Deligate to getter method
-               this.doGet(request, response);
-       }
-
-}
diff --git a/src/java/org/mxchange/pizzaapplication/servlet/receipt/PizzaPdfReceiptServlet.java b/src/java/org/mxchange/pizzaapplication/servlet/receipt/PizzaPdfReceiptServlet.java
new file mode 100644 (file)
index 0000000..3d374cd
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.servlet.receipt;
+
+import java.io.IOException;
+import javax.faces.view.facelets.FaceletException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote;
+import org.mxchange.jshopcore.model.receipt.WrapableReceipt;
+
+/**
+ * A servlet for a PDF receipt (official)
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public class PizzaPdfReceiptServlet extends HttpServlet {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 497_345_834_783_781L;
+
+       /**
+        * Remote bean
+        */
+       private ReceiptBeanRemote receiptBean;
+
+       /**
+        * Public constructor
+        */
+       public PizzaPdfReceiptServlet () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Set instance
+                       this.receiptBean = (ReceiptBeanRemote) context.lookup("ejb/pdf-receipt"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public String getServletInfo () {
+               return "Produces a receipt as PDF file for given access key.";
+       }
+
+       @Override
+       protected void doGet (final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+               // Is the key set?
+               if (request.getParameter("key") == null) { //NOI18N
+                       // No more processing here
+                       super.doGet(request, response);
+                       return;
+               }
+
+               // Get PDF from bean
+               WrapableReceipt receipt = this.receiptBean.createReceiptFromAccessKey(request.getParameter("key")); //NOI18N
+
+               // TODO Write it's content to response output
+       }
+
+       @Override
+       protected void doPost (final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+               // Deligate to getter method
+               this.doGet(request, response);
+       }
+
+}
index 0e403f6c1f1dbc66954486a3a7bf0aa157eeb8b2..288c1c7c32c450caaae32a2f6027d272e79304c7 100644 (file)
@@ -1,36 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-       <context-param>
-               <param-name>javax.faces.PROJECT_STAGE</param-name>
-               <param-value>Development</param-value>
-       </context-param>
-       <servlet>
-               <servlet-name>Faces Servlet</servlet-name>
-               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
-               <load-on-startup>1</load-on-startup>
-       </servlet>
-       <servlet>
-               <servlet-name>pdf</servlet-name>
-               <servlet-class>org.mxchange.pizzaapplication.servlet.receipt.PdfReceiptServlet</servlet-class>
-       </servlet>
-       <servlet-mapping>
-               <servlet-name>Faces Servlet</servlet-name>
-               <url-pattern>/faces/*</url-pattern>
-       </servlet-mapping>
-       <mime-mapping>
-               <extension>tpl</extension>
-               <mime-type>text/plain</mime-type>
-       </mime-mapping>
-       <servlet-mapping>
-               <servlet-name>pdf</servlet-name>
-               <url-pattern>/customer/recipt.pdf</url-pattern>
-       </servlet-mapping>
-       <session-config>
-               <session-timeout>
+    <context-param>
+        <param-name>javax.faces.PROJECT_STAGE</param-name>
+        <param-value>Development</param-value>
+    </context-param>
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet>
+        <servlet-name>pdf</servlet-name>
+        <servlet-class>org.mxchange.pizzaapplication.servlet.receipt.PizzaPdfReceiptServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>/faces/*</url-pattern>
+    </servlet-mapping>
+    <mime-mapping>
+        <extension>tpl</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <servlet-mapping>
+        <servlet-name>pdf</servlet-name>
+        <url-pattern>/customer/recipt.pdf</url-pattern>
+    </servlet-mapping>
+    <session-config>
+        <session-timeout>
                        30
                </session-timeout>
-       </session-config>
-       <welcome-file-list>
-               <welcome-file>faces/index.xhtml</welcome-file>
-       </welcome-file-list>
+    </session-config>
+    <welcome-file-list>
+        <welcome-file>faces/index.xhtml</welcome-file>
+    </welcome-file-list>
 </web-app>