]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Wed, 9 Sep 2015 20:14:33 +0000 (22:14 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 9 Sep 2015 20:14:33 +0000 (22:14 +0200)
- update jcore.jar, jcoreee.jar, jshop-core.jar, jshop-ee-lib.jar
- applied naming convention: Bean interfaces ends with Controller, Bean classes with Bean and "Web" must be pre-last word
- a lot fixes applied
Signed-off-by:Roland Häder <roland@mxchange.org>

30 files changed:
lib/jcore-ee-logger.jar
lib/jcore.jar
lib/jcoreee.jar
lib/jshop-core.jar
lib/jshop-ee-lib.jar
nbproject/project.properties
src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaServiceBasketWebBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaShopWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaShopWebController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerWebBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebBean.java
src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/gender/PizzaServiceGenderController.java [deleted file]
web/WEB-INF/templates/admin/admin_category_selection_box.tpl
web/WEB-INF/templates/admin/admin_menu.tpl
web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl
web/WEB-INF/templates/generic/gender_selection_box.tpl
web/WEB-INF/web.xml
web/admin/category.xhtml
web/admin/product.xhtml
web/index.xhtml

index 2fd44525778ddad6faab520733226aa324db45e8..0b6d194d9b6f30825848d1fcb339b4521158b6fb 100644 (file)
Binary files a/lib/jcore-ee-logger.jar and b/lib/jcore-ee-logger.jar differ
index ea3515c96b5fe0ab8f981b9c09375db1f072dacb..54ec8aa1e442410ca76ed01ee3d087eede4a0823 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index 543a51b16610043a6e1c4b9ce0f2033e856b66ab..e78b86d53671343d014cd29f7841d59fb7bc02e6 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
index fde0104cd477c033317fa104fade752d6ad111cf..f182f19dedeec92ab3a6934f5ac39c64ad03ae86 100644 (file)
Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ
index e477017bc5d2b3ac3061dd6335327d59c69325dd..f8d5b590ba306a46844bc11ebae66c7b19461d6b 100644 (file)
Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ
index 71fed62f545e39da2be0d37cf160284678579878..b904f9340511d55c5db598d94579ba0b3743d317 100644 (file)
@@ -50,7 +50,7 @@ j2ee.compile.on.save=true
 j2ee.copy.static.files.on.save=true
 j2ee.deploy.on.save=true
 j2ee.platform=1.7
-j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar
+j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/javax.persistence.jar
 j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
 j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
 j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebBean.java
new file mode 100644 (file)
index 0000000..ce78221
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.basket;
+
+import java.rmi.RemoteException;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * A bean for the basket
+ *
+ * @author Roland Haeder
+ */
+@Named("basket")
+@SessionScoped
+public class BasketWebBean extends BaseFrameworkBean implements BasketWebController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_476_347_320_198L;
+
+       /**
+        *  Basket bean
+        */
+       private final BasketSessionBeanRemote basketBean;
+
+       /**
+        * Current product instance
+        */
+       private Product currentProduct;
+
+       /**
+        * Default constructor
+        *
+        * @throws javax.naming.NamingException If something happened?
+        */
+       public BasketWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup
+               this.basketBean = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
+       }
+
+       @Override
+       public boolean isEmpty () {
+               try {
+                       // Call remote bean
+                       return this.getBasketBean().isEmpty();
+               } catch (final RemoteException ex) {
+                       // Continued to throw
+                       throw new FacesException(ex);
+               }
+       }
+
+       @Override
+       public boolean hasItems () {
+               // Call above and invert it
+               return (!this.isEmpty());
+       }
+
+       @PostConstruct
+       public void init () throws RuntimeException {
+               // Call super init first
+               super.genericInit();
+       }
+
+       @Override
+       public void setCurrentProduct (final Product product) {
+               this.currentProduct = product;
+       }
+
+       /**
+        * Getter for basket bean instance
+        * 
+        * @return Basket bean instance
+        */
+       private BasketSessionBeanRemote getBasketBean () {
+               return basketBean;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java
new file mode 100644 (file)
index 0000000..3f78e54
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * An interface for a basket
+ *
+ * @author Roland Haeder
+ */
+public interface BasketWebController extends Serializable {
+       /**
+        * Checks whether the basket is empty
+        *
+        * @return Whether the basket is empty
+        */
+       public boolean isEmpty ();
+
+       /**
+        * Checks whether the basket has items in it. This method is wrapper to isEmpty()
+        *
+        * @return Whether the basket is empty
+        */
+       public boolean hasItems ();
+
+       /**
+        * Setter for current product instance
+        * 
+        * @param product Product instance
+        */
+       public void setCurrentProduct (final Product product);
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebBean.java
deleted file mode 100644 (file)
index 12b55bc..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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 org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for a basket
- *
- * @author Roland Haeder
- */
-public interface PizzaBasketWebBean extends Serializable {
-       /**
-        * Checks whether the basket is empty
-        *
-        * @return Whether the basket is empty
-        */
-       public boolean isEmpty ();
-
-       /**
-        * Checks whether the basket has items in it. This method is wrapper to isEmpty()
-        *
-        * @return Whether the basket is empty
-        */
-       public boolean hasItems ();
-
-       /**
-        * Setter for current product instance
-        * 
-        * @param product Product instance
-        */
-       public void setCurrentProduct (final Product product);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaServiceBasketWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaServiceBasketWebBean.java
deleted file mode 100644 (file)
index eca1f9e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.basket;
-
-import java.rmi.RemoteException;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.inject.Named;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
-import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * A bean for the basket
- *
- * @author Roland Haeder
- */
-@Named("basket")
-@SessionScoped
-public class PizzaServiceBasketWebBean extends BaseFrameworkBean implements PizzaBasketWebBean {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 5_476_347_320_198L;
-
-       /**
-        *  Basket bean
-        */
-       private final BasketSessionBeanRemote basket;
-
-       /**
-        * Current product instance
-        */
-       private Product currentProduct;
-
-       /**
-        * Default constructor
-        *
-        * @throws javax.naming.NamingException If something happened?
-        */
-       public PizzaServiceBasketWebBean () throws NamingException {
-               // Get initial context
-               InitialContext context = new InitialContext();
-
-               // Try to lookup
-               this.basket = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
-       }
-
-       @Override
-       public boolean isEmpty () {
-               try {
-                       // Call remote bean
-                       return this.basket.isEmpty();
-               } catch (final RemoteException ex) {
-                       // Continued to throw
-                       throw new FacesException(ex);
-               }
-       }
-
-       @Override
-       public boolean hasItems () {
-               // Call above and invert it
-               return (!this.isEmpty());
-       }
-
-       @PostConstruct
-       public void init () throws RuntimeException {
-               // Call super init first
-               super.genericInit();
-       }
-
-       @Override
-       public void setCurrentProduct (final Product product) {
-               this.currentProduct = product;
-       }
-}
index 9d76d3d9361ba0c64601e0e528afcbe95545a963..dccb3b3a42fff05ce296bcbfe2882c708539d423 100644 (file)
@@ -26,6 +26,7 @@ import org.mxchange.jcoreee.beans.BaseFrameworkBean;
 import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException;
 import org.mxchange.jshopcore.model.category.Category;
 import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
+import org.mxchange.jshopcore.model.category.ProductCategory;
 
 /**
  * Main application class
@@ -43,7 +44,17 @@ public class AdminCategoryWebBean extends BaseFrameworkBean implements AdminCate
        /**
         * Remote bean for categories
         */
-       private final CategorySessionBeanRemote category;
+       private final CategorySessionBeanRemote categoryBean;
+
+       /**
+        * Category title
+        */
+       private String title;
+
+       /**
+        * Parent id
+        */
+       private Long parentId;
 
        /**
         * Default constructor
@@ -55,17 +66,42 @@ public class AdminCategoryWebBean extends BaseFrameworkBean implements AdminCate
                InitialContext context = new InitialContext();
 
                // Try to lookup the bean
-               this.category = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
+               this.categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
        }
 
        @Override
-       public void addCategory (final Category category) throws FaceletException {
+       public void addCategory () throws FaceletException {
                try {
+                       // Create category
+                       Category category = new ProductCategory();
+                       category.setParentId(this.getParentId());
+                       category.setTitle(this.getTitle());
+
                        // Deligate to bean
-                       this.category.doAdminAddCategory(category);
+                       this.categoryBean.doAdminAddCategory(category);
                } catch (final CategoryTitleAlreadyUsedException | RemoteException ex) {
                        // Continue to throw
                        throw new FaceletException(ex);
                }
        }
+
+       @Override
+       public String getTitle () {
+               return this.title;
+       }
+
+       @Override
+       public void setTitle (final String title) {
+               this.title = title;
+       }
+
+       @Override
+       public Long getParentId () {
+               return this.parentId;
+       }
+
+       @Override
+       public void setTitle (final Long parentId) {
+               this.parentId = parentId;
+       }
 }
index 934c2dc3c8c08b9a1ef53b515666d4b3f4d553e1..2db0eb353000b493cda3c129f0bd1aa937a75a6c 100644 (file)
@@ -17,7 +17,6 @@
 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
@@ -29,8 +28,35 @@ public interface AdminCategoryWebController {
        /**
         * Adds given category data from request to database
         *
-        * @param category Category instance
         * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
         */
-       public void addCategory (final Category category) throws FaceletException;
+       public void addCategory () throws FaceletException;
+
+       /**
+        * Getter for title
+        *
+        * @return the title
+        */
+       public String getTitle ();
+
+       /**
+        * Setter for title
+        *
+        * @param title the title to set
+        */
+       public void setTitle (final String title);
+
+       /**
+        * Getter for parent id
+        *
+        * @return Parent id
+        */
+       public Long getParentId ();
+
+       /**
+        * Setter for parent id
+        *
+        * @param parentId Parent id to set
+        */
+       public void setTitle (final Long parentId);
 }
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java
deleted file mode 100644 (file)
index c184dbc..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.controller;
-
-import java.rmi.RemoteException;
-import java.sql.SQLException;
-import java.util.Deque;
-import java.util.Queue;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.inject.Named;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
-import org.mxchange.jshopcore.model.category.ProductCategory;
-import org.mxchange.jshopcore.model.product.Product;
-import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
-
-/**
- * Main application class
- *
- * @author Roland Haeder
- */
-@Named("controller")
-@SessionScoped
-public class PizzaServiceWebBean extends BaseFrameworkBean implements PizzaWebBean {
-       /**
-        * Serial id
-        */
-       private static final long serialVersionUID = 58_137_539_530_279L;
-
-       /**
-        * Remote bean for categories
-        */
-       private final CategorySessionBeanRemote category;
-
-       /**
-        * Remote bean for products
-        */
-       private final ProductSessionBeanRemote product;
-
-       /**
-        * Default constructor
-        * 
-        * @throws javax.naming.NamingException Something happened here?
-        */
-       public PizzaServiceWebBean () throws NamingException {
-               // Get initial context
-               InitialContext context = new InitialContext();
-
-               // Try to lookup the bean
-               this.category = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
-
-               // Try to lookup the bean
-               this.product = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
-       }
-
-       @PostConstruct
-       public void init () throws RuntimeException {
-               // Call super init first
-               super.genericInit();
-       }
-
-       @Override
-       public Queue<Product> getAvailableProducts () throws FacesException {
-               try {
-                       return this.getProduct().getAvailableProducts();
-               } catch (final RemoteException ex) {
-                       // Continue to throw
-                       throw new FacesException(ex);
-               }
-       }
-
-       @Override
-       public Queue<Category> getAllCategories () throws FacesException {
-               try {
-                       // Fake zero category
-                       Category c = new ProductCategory(0L, "Ist oberste Kategorie", 0L);
-
-                       // Get List back
-                       Deque<Category> deque = this.getCategory().getAllCategories();
-
-                       // Add fake category
-                       deque.addFirst(c);
-
-                       // Return it
-                       return deque;
-               } catch (final SQLException ex) {
-                       // Continue to throw
-                       throw new FacesException(ex);
-               }
-       }
-
-       /**
-        * Getter for shop remote bean
-        *
-        * @return Remote shop bean
-        */
-       private CategorySessionBeanRemote getCategory () {
-               return this.category;
-       }
-
-       /**
-        * Getter for shop remote bean
-        *
-        * @return Remote shop bean
-        */
-       private ProductSessionBeanRemote getProduct () {
-               return this.product;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaShopWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaShopWebBean.java
new file mode 100644 (file)
index 0000000..211e86c
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.controller;
+
+import java.rmi.RemoteException;
+import java.sql.SQLException;
+import java.util.Deque;
+import java.util.Queue;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
+import org.mxchange.jshopcore.model.category.ProductCategory;
+import org.mxchange.jshopcore.model.product.Product;
+import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
+
+/**
+ * Main application class
+ *
+ * @author Roland Haeder
+ */
+@Named("controller")
+@SessionScoped
+public class PizzaShopWebBean extends BaseFrameworkBean implements PizzaShopWebController {
+       /**
+        * Serial id
+        */
+       private static final long serialVersionUID = 58_137_539_530_279L;
+
+       /**
+        * Remote bean for categories
+        */
+       private final CategorySessionBeanRemote categoryBean;
+
+       /**
+        * Remote bean for products
+        */
+       private final ProductSessionBeanRemote productBean;
+
+       /**
+        * Default constructor
+        * 
+        * @throws javax.naming.NamingException Something happened here?
+        */
+       public PizzaShopWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup the bean
+               this.categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
+
+               // Try to lookup the bean
+               this.productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
+       }
+
+       @PostConstruct
+       public void init () throws RuntimeException {
+               // Call super init first
+               super.genericInit();
+       }
+
+       @Override
+       public Queue<Product> getAvailableProducts () throws FacesException {
+               try {
+                       return this.getProductBean().getAvailableProducts();
+               } catch (final RemoteException ex) {
+                       // Continue to throw
+                       throw new FacesException(ex);
+               }
+       }
+
+       @Override
+       public Queue<Category> getAllCategories () throws FacesException {
+               try {
+                       // Fake zero categoryBean
+                       Category c = new ProductCategory(0L, "Ist oberste Kategorie", 0L);
+
+                       // Get List back
+                       Deque<Category> deque = this.getCategoryBean().getAllCategories();
+
+                       // Add fake categoryBean
+                       deque.addFirst(c);
+
+                       // Return it
+                       return deque;
+               } catch (final SQLException ex) {
+                       // Continue to throw
+                       throw new FacesException(ex);
+               }
+       }
+
+       /**
+        * Getter for shop remote bean
+        *
+        * @return Remote shop bean
+        */
+       private CategorySessionBeanRemote getCategoryBean () {
+               return this.categoryBean;
+       }
+
+       /**
+        * Getter for shop remote bean
+        *
+        * @return Remote shop bean
+        */
+       private ProductSessionBeanRemote getProductBean () {
+               return this.productBean;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaShopWebController.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaShopWebController.java
new file mode 100644 (file)
index 0000000..4998aa4
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.controller;
+
+import java.io.Serializable;
+import java.util.Queue;
+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
+ *
+ * @author Roland Haeder
+ */
+public interface PizzaShopWebController extends Serializable {
+
+       /**
+        * Some "getter" for a linked list of only available products
+        * 
+        * @return Only available products
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       public Queue<Product> getAvailableProducts () throws FaceletException;
+
+       /**
+        * Some "getter" for a linked list of all categories
+        *
+        * @return All categories
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       public Queue<Category> getAllCategories () throws FaceletException;
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java
deleted file mode 100644 (file)
index 2411752..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.controller;
-
-import java.io.Serializable;
-import java.util.Queue;
-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
- *
- * @author Roland Haeder
- */
-public interface PizzaWebBean extends Serializable {
-
-       /**
-        * Some "getter" for a linked list of only available products
-        * 
-        * @return Only available products
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       public Queue<Product> getAvailableProducts () throws FaceletException;
-
-       /**
-        * Some "getter" for a linked list of all categories
-        *
-        * @return All categories
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       public Queue<Category> getAllCategories () throws FaceletException;
-}
index f2934771dd15f309721b3db266aa6013a6961798..703a87dccfa1088b75f7a74284f0bb3de553836c 100644 (file)
  */
 package org.mxchange.pizzaapplication.beans.customer;
 
-import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcore.model.contact.gender.Gender;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote;
 
 /**
- * An interface for customer beans
+ * A customer bean which hides the customer instance
  *
  * @author Roland Haeder
  */
-public interface CustomerWebBean extends Serializable {
+@Named("customer")
+@SessionScoped
+public class CustomerWebBean extends BaseFrameworkBean implements CustomerWebController {
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_916L;
+
+       /**
+        * Remote customer bean
+        */
+       private final CustomerSessionBeanRemote customerBean;
+
+       /**
+        * Cellphone number
+        */
+       private String cellphoneNumber;
+
+       /**
+        * City
+        */
+       private String city;
+
+       /**
+        * Optional comments
+        */
+       private String comment;
+
+       /**
+        * Company name
+        */
+       private String companyName;
+
+       /**
+        * Country code
+        */
+       private String countryCode;
+
+       /**
+        * Email address
+        */
+       private String emailAddress;
+
+       /**
+        * Gender instance
+        */
+       private Gender gender;
+
+       /**
+        * Family name
+        */
+       private String familyName;
+
+       /**
+        * Fax number
+        */
+       private String faxNumber;
+
+       /**
+        * First name
+        */
+       private String firstName;
+
+       /**
+        * House number
+        */
+       private Long houseNumber;
+
+       /**
+        * Phone number
+        */
+       private String phoneNumber;
+
+       /**
+        * Street
+        */
+       private String street;
+
+       /**
+        * ZIP code
+        */
+       private Long zipCode;
+
+       /**
+        * Default constructor
+        *
+        * @throws javax.naming.NamingException If something happens?
+        */
+       public CustomerWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Set gender to UNKNOWN
+               this.gender = Gender.UNKNOWN;
+
+               // Try to lookup
+               this.customerBean = (CustomerSessionBeanRemote) context.lookup("ejb/stateless-customer");
+       }
+
+       @PostConstruct
+       public void init () throws RuntimeException {
+               // Call super init first
+               super.genericInit();
+       }
+
+       @Override
+       public Gender getGender () {
+               return this.gender;
+       }
+
+       @Override
+       public void setGender (final Gender gender) {
+               this.gender = gender;
+       }
+
+       @Override
+       public String getCompanyName () {
+               return this.companyName;
+       }
+
+       @Override
+       public void setCompanyName (final String companyName) {
+               this.companyName = companyName;
+       }
+
+       @Override
+       public String getFirstName () {
+               return this.firstName;
+       }
+
+       @Override
+       public void setFirstName (final String firstName) {
+               this.firstName = firstName;
+       }
+
+       @Override
+       public String getFamilyName () {
+               return this.familyName;
+       }
+
+       @Override
+       public void setFamilyName (final String familyName) {
+               this.familyName = familyName;
+       }
+
+       @Override
+       public String getStreet () {
+               return this.street;
+       }
+
+       @Override
+       public void setStreet (final String street) {
+               this.street = street;
+       }
+
+       @Override
+       public Long getHouseNumber () {
+               return this.houseNumber;
+       }
+
+       @Override
+       public void setHouseNumber (final Long houseNumber) {
+               this.houseNumber = houseNumber;
+       }
+
+       @Override
+       public Long getZipCode () {
+               return this.zipCode;
+       }
+
+       @Override
+       public void setZipCode (final Long zipCode) {
+               this.zipCode = zipCode;
+       }
+
+       @Override
+       public String getCity () {
+               return this.city;
+       }
+
+       @Override
+       public void setCity (final String city) {
+               this.city = city;
+       }
+
+       @Override
+       public String getCountryCode () {
+               return this.countryCode;
+       }
+
+       @Override
+       public void setCountryCode (final String countryCode) {
+               this.countryCode = countryCode;
+       }
+
+       @Override
+       public String getEmailAddress () {
+               return this.emailAddress;
+       }
+
+       @Override
+       public void setEmailAddress (final String emailAddress) {
+               this.emailAddress = emailAddress;
+       }
+
+       @Override
+       public String getPhoneNumber () {
+               return this.phoneNumber;
+       }
+
+       @Override
+       public void setPhoneNumber (final String phoneNumber) {
+               this.phoneNumber = phoneNumber;
+       }
+
+       @Override
+       public String getFaxNumber () {
+               return this.faxNumber;
+       }
+
+       @Override
+       public void setFaxNumber (final String faxNumber) {
+               this.faxNumber = faxNumber;
+       }
+
+       @Override
+       public String getCellphoneNumber () {
+               return this.cellphoneNumber;
+       }
+
+       @Override
+       public void setCellphoneNumber (final String cellphoneNumber) {
+               this.cellphoneNumber = cellphoneNumber;
+       }
 }
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java
new file mode 100644 (file)
index 0000000..6ee25f7
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.jcore.model.contact.gender.Gender;
+
+/**
+ * An interface for customer beans
+ *
+ * @author Roland Haeder
+ */
+public interface CustomerWebController extends Serializable {
+
+       /**
+        * Gender of the contact
+        *
+        * @return the gender
+        */
+       public Gender getGender ();
+
+       /**
+        * Gender of the contact
+        *
+        * @param gender the gender to set
+        */
+       public void setGender (final Gender gender);
+
+       /**
+        * Company name
+        *
+        * @return the companyName
+        */
+       public String getCompanyName ();
+
+       /**
+        * Company name
+        *
+        * @param companyName the companyName to set
+        */
+       public void setCompanyName (final String companyName);
+
+       /**
+        * First name
+        *
+        * @return the first name
+        */
+       public String getFirstName ();
+
+       /**
+        * First name
+        *
+        * @param firstName the first name to set
+        */
+       public void setFirstName (final String firstName);
+
+       /**
+        * Family name
+        *
+        * @return the familyName
+        */
+       public String getFamilyName ();
+
+       /**
+        * Family name
+        *
+        * @param familyName the familyName to set
+        */
+       public void setFamilyName (final String familyName);
+
+       /**
+        * Street
+        *
+        * @return the street
+        */
+       public String getStreet ();
+
+       /**
+        * Street
+        *
+        * @param street the street to set
+        */
+       public void setStreet (final String street);
+
+       /**
+        * House number
+        *
+        * @return the houseNumber
+        */
+       public Long getHouseNumber ();
+
+       /**
+        * House number
+        *
+        * @param houseNumber the houseNumber to set
+        */
+       public void setHouseNumber (final Long houseNumber);
+
+       /**
+        * ZIP code
+        *
+        * @return the zipCode
+        */
+       public Long getZipCode ();
+
+       /**
+        * ZIP code
+        *
+        * @param zipCode the zipCode to set
+        */
+       public void setZipCode (final Long zipCode);
+
+       /**
+        * City
+        *
+        * @return the city
+        */
+       public String getCity ();
+
+       /**
+        * City
+        *
+        * @param city the city to set
+        */
+       public void setCity (final String city);
+
+       /**
+        * Country code
+        *
+        * @return the countryCode
+        */
+       public String getCountryCode ();
+
+       /**
+        * Country code
+        *
+        * @param countryCode the countryCode to set
+        */
+       public void setCountryCode (final String countryCode);
+
+       /**
+        * Email address
+        *
+        * @return the emailAddress
+        */
+       public String getEmailAddress ();
+
+       /**
+        * Email address
+        *
+        * @param emailAddress the emailAddress to set
+        */
+       public void setEmailAddress (final String emailAddress);
+
+       /**
+        * Phone number
+        *
+        * @return the phoneNumber
+        */
+       public String getPhoneNumber ();
+
+       /**
+        * Phone number
+        *
+        * @param phoneNumber the phoneNumber to set
+        */
+       public void setPhoneNumber (final String phoneNumber);
+
+       /**
+        * Fax number
+        *
+        * @return the faxNumber
+        */
+       public String getFaxNumber ();
+
+       /**
+        * Fax number
+        *
+        * @param faxNumber the faxNumber to set
+        */
+       public void setFaxNumber (final String faxNumber);
+
+       /**
+        * Cellphone number
+        *
+        * @return the cellphoneNumber
+        */
+       public String getCellphoneNumber ();
+
+       /**
+        * Cellphone number
+        *
+        * @param cellphoneNumber the cellphoneNumber to set
+        */
+       public void setCellphoneNumber (final String cellphoneNumber);
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerWebBean.java
deleted file mode 100644 (file)
index 089590f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.customer;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Named;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
-import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-@Named("customer")
-@SessionScoped
-public class PizzaServiceCustomerWebBean extends BaseFrameworkBean implements CustomerWebBean {
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /**
-        * Remote customer bean
-        */
-       private final CustomerSessionBeanRemote customer;
-
-       /**
-        * Default constructor
-        *
-        * @throws javax.naming.NamingException If something happens?
-        */
-       public PizzaServiceCustomerWebBean () throws NamingException {
-               // Get initial context
-               InitialContext context = new InitialContext();
-
-               // Try to lookup
-               this.customer = (CustomerSessionBeanRemote) context.lookup("ejb/stateless-consumer");
-       }
-
-       @PostConstruct
-       public void init () throws RuntimeException {
-               // Call super init first
-               super.genericInit();
-       }
-}
index e6c440815687b56a06e03085523fe508d299d6da..b993c1a4db6fdb587fc455adf2deb03322feaa44 100644 (file)
  */
 package org.mxchange.pizzaapplication.beans.gender;
 
-import java.io.Serializable;
 import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import org.mxchange.jcore.model.contact.gender.Gender;
+import org.mxchange.jcore.model.contact.gender.GenderSessionBeanRemote;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
 
 /**
- * An interface for data beans
+ * A customer bean which hides the customer instance
  *
  * @author Roland Haeder
  */
-public interface GenderWebBean extends Serializable {
+@Named ("gender")
+@ApplicationScoped
+public class GenderWebBean extends BaseFrameworkBean implements GenderWebController {
 
        /**
-        * Getter for all genders as array
-        *
-        * @return All genders as array
+        * Serial number
+        */
+       private static final long serialVersionUID = 835_482_364_189L;
+
+       /**
+        * Remote bean
         */
-       public Gender[] allGenders ();
+       private final GenderSessionBeanRemote genderBean;
+
+       /**
+        * Default constructor
+        * 
+        * @throws javax.naming.NamingException If something happens?
+        */
+       public GenderWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup bean
+               this.genderBean = (GenderSessionBeanRemote) context.lookup("ejb/stateful-gender"); //NOI18N
+       }
+
+       @Override
+       public Gender[] getAllGenders () {
+               // Return it
+               return this.getGenderBean().allGenders();
+       }
+
+       @Override
+       public List<Gender> getSelectableGenders () {
+               // Init array
+               // TODO Call EJB here?
+               List<Gender> genders = this.getGenderBean().selectableGenders();
+
+               // Return it
+               return genders;
+       }
 
        /**
-        * Getter for only selectable genders as array, UNKNOWN is not selectable
+        * Getter for data remote bean
         *
-        * @return All genders as array
+        * @return data remote bean
         */
-       public List<Gender> selectableGenders ();
+       private GenderSessionBeanRemote getGenderBean () {
+               return this.genderBean;
+       }
 }
diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebController.java b/src/java/org/mxchange/pizzaapplication/beans/gender/GenderWebController.java
new file mode 100644 (file)
index 0000000..48e2e8a
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.jcore.model.contact.gender.Gender;
+
+/**
+ * An interface for data beans
+ *
+ * @author Roland Haeder
+ */
+public interface GenderWebController extends Serializable {
+
+       /**
+        * Getter for all genders as array
+        *
+        * @return All genders as array
+        */
+       public Gender[] getAllGenders ();
+
+       /**
+        * Getter for only selectable genders as array, UNKNOWN is not selectable
+        *
+        * @return All genders as array
+        */
+       public List<Gender> getSelectableGenders ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaServiceGenderController.java b/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaServiceGenderController.java
deleted file mode 100644 (file)
index 49c2c4d..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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 javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jcore.model.contact.gender.GenderSessionBeanRemote;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-@Named ("data")
-@ApplicationScoped
-public class PizzaServiceGenderController extends BaseFrameworkBean implements GenderWebBean {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 835_482_364_189L;
-
-       /**
-        * Remote bean
-        */
-       private final GenderSessionBeanRemote gender;
-
-       /**
-        * Default constructor
-        * 
-        * @throws javax.naming.NamingException If something happens?
-        */
-       public PizzaServiceGenderController () throws NamingException {
-               // Get initial context
-               InitialContext context = new InitialContext();
-
-               // Try to lookup bean
-               this.gender = (GenderSessionBeanRemote) context.lookup("ejb/stateless-data"); //NOI18N
-       }
-
-       @Override
-       public Gender[] allGenders () {
-               // Return it
-               return this.getGender().allGenders();
-       }
-
-       @Override
-       public List<Gender> selectableGenders () {
-               // Init array
-               // TODO Call EJB here?
-               List<Gender> genders = this.getGender().selectableGenders();
-
-               // Return it
-               return genders;
-       }
-
-       /**
-        * Getter for data remote bean
-        *
-        * @return data remote bean
-        */
-       private GenderSessionBeanRemote getGender () {
-               return this.gender;
-       }
-}
index 8783f813a8bb3e6d5b32962afc1d17cd41d76b08..e986ccec17c3338dc17f1a89642c334ce6f6702a 100644 (file)
@@ -4,7 +4,7 @@
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
 
-       <h:selectOneMenu class="select" id="category_id">
-               <f:selectItems value="#{controller.allCategories}" var="categoryId" itemValue="#{categoryId.categoryId}" itemLabel="#{categoryId.title}" />
+       <h:selectOneMenu class="select" id="category">
+               <f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat.categoryId}" itemLabel="#{cat.title}" />
        </h:selectOneMenu>
 </ui:composition>
index 9e984152f8854f6b22c734fa75a3537eb48a92e5..ab15a72f486f394a0108e98a83768998aad84aa6 100644 (file)
@@ -8,7 +8,7 @@
                <ul>
                        <li><h:link title="Zur Willkommensseite" outcome="admin_index" value="Home" /></li>
                        <li><h:link title="Kategorie" outcome="admin_category" value="Kategorie" /></li>
-                       <li><h:link title="Produkt" outcome="admin_product" value="Produkt" /></li>
+                       <li><h:link title="Produkt" outcome="admin_product" value="Produkte" /></li>
                </ul>
 
                <ul>
index e3c4ad2657fa410ceaa8d712da84b0133a832ca8..8b6d8815993ae642830bd7ffb979b4ce452ef6a8 100644 (file)
@@ -4,7 +4,7 @@
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
 
-       <h:selectOneMenu class="select" id="parent_id">
+       <h:selectOneMenu class="select" id="parentId">
                <f:selectItems value="#{controller.allCategories}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.title}" />
        </h:selectOneMenu>
 </ui:composition>
index a6fff29acc1c453b3fc21410968fe6ee275bee37..940d90e2de7dbf2ce2682dc8909671ab2e18403e 100644 (file)
@@ -4,10 +4,7 @@
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
 
-       <!--
-       TODO: Missing pre-select of chosen gender?
-       //-->
-       <h:selectOneMenu class="select" id="gender" value="#{customer.gender}">
-               <f:selectItems value="#{data.selectableGenders}" var="gender" itemValue="#{gender}" itemLabel="#{msg[gender.messageKey]}" />
+       <h:selectOneMenu class="select" id="gender_selection" value="#{customer.gender}">
+               <f:selectItems value="#{gender.selectableGenders}" var="g" itemValue="#{g}" itemLabel="#{msg[g.messageKey]}" />
        </h:selectOneMenu>
 </ui:composition>
index 83bfa265b745dcb32cba8ea458681f2aa39f9fb0..496a039e6fa7c58accfa5e98b8efdbda10d7c97d 100644 (file)
@@ -4,18 +4,6 @@
                <param-name>javax.faces.PROJECT_STAGE</param-name>
                <param-value>Development</param-value>
        </context-param>
-       <!--
-       TODO: No longer used
-       <filter>
-               <description>A filter for handling added basket items</description>
-               <filter-name>BasketItemAddedFilter</filter-name>
-               <filter-class>org.mxchange.jshopejb.filter.servlet.basket.BasketItemAddedFilter</filter-class>
-       </filter>
-       <filter-mapping>
-               <filter-name>BasketItemAddedFilter</filter-name>
-               <url-pattern>/form_handler/add_item.jsp</url-pattern>
-       </filter-mapping>
-       //-->
        <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
index 2cd077e36f614c9cb308bd0046ab67e50e535f1d..d00596f537e1555f2cb98072a5ec29aae5988f72 100644 (file)
                <ui:define name="content">
                        <div class="para">
                                <h:form acceptcharset="utf-8" id="form">
-                               <table class="table">
-                                       <thead>
-                                               <tr>
-                                                       <th class="table_header_column">
-                                                               Auswählen:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Bezeichnung:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Elternkategorie:
-                                                       </th>
-                                               </tr>
-                                       </thead>
-
-                                       <tbody>
-                                               <ui:repeat var="category" value="#{controller.allCategories}" rendered="#{category != null}">
-                                                       <h:outputText value="#{category}" />
-                                                       <!--
-                                                       <tr>
-                                                               <td>
-                                                                       #{category.categoryId}:
-                                                                       <h:selectBooleanCheckbox class="input" id="categoryId" binding="#{category.categoryId}" value="true" />
-                                                               </td>
-                                                               <td>
-                                                                       #{category.title}
-                                                               </td>
-                                                               <td>
-                                                                       #{controller.generateLinkForParent(category)}
-                                                               </td>
-                                                       </tr>
-                                                       //-->
-                                               </ui:repeat>
-
-                                               <tr>
-                                                       <td colspan="3" class="table_footer">
-                                                               <h:commandButton class="reset" type="reset" value="Formular zurücksetzen" />
-                                                               <h:commandButton class="submit" type="submit" id="edit" action="#{admin_category.editCategory(category)}" value="Ändern" />
-                                                               <h:commandButton class="delete" type="submit" id="delete" action="#{admin_category.deleteCategory(category)}" value="Löschen" />
-                                                       </td>
-                                               </tr>
-                                       </tbody>
-                               </table>
+                                       <h:dataTable headerClass="table_header_column" rowClasses="table_row" styleClass="table" id="categories" value="#{controller.allCategories}" var="cat" rendered="#{cat != null}">
+                                               <h:column>
+                                                       <f:facet name="header">Auswählen:</f:facet>
+                                                       #{cat.categoryId}:
+                                                       <h:selectBooleanCheckbox class="input" value="true" />
+                                               </h:column>
+
+                                               <h:column>
+                                                       <f:facet name="header">Bezeichnung:</f:facet>
+                                                       #{cat.title}
+                                               </h:column>
+
+                                               <h:column>
+                                                       <f:facet name="header">Elternkategorie:</f:facet>
+                                                       #{cat.categoryId}:
+                                                       #{controller.generateLinkForParent(cat)}
+                                               </h:column>
+                                       </h:dataTable>
+
+                                       <div class="table_footer">
+                                               <h:commandButton class="reset" type="reset" value="Formular zurücksetzen" />
+                                               <h:commandButton class="submit" type="submit" id="edit" action="#{admin_category.editCategory(category)}" value="Ändern" />
+                                               <h:commandButton class="delete" type="submit" id="delete" action="#{admin_category.deleteCategory(category)}" value="Löschen" />
+                                       </div>
                                </h:form>
                        </div>
 
index cfb743a5f60e1f2735e1ecaa6fa393461465fee7..30039b91a9c652961cc641458b07f5a473007acd 100644 (file)
                <ui:define name="content">
                        <div class="para">
                                <h:form acceptcharset="utf-8" id="form">
-                               <table class="table">
-                                       <thead>
-                                               <tr>
-                                                       <th class="table_header_column">
-                                                               Produktnummer:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Produktbezeichnung:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Einzelpreis:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Kategorie:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Verfügbar:
-                                                       </th>
-                                               </tr>
-                                       </thead>
-
-                                       <tbody>
-                                               <ui:repeat var="product" value="#{admin_product.allProducts}" rendered="#{product != null}">
-                                               <tr>
-                                                       <td>
-                                                               #{product.itemId}:
-                                                               <h:selectBooleanCheckbox class="input" id="item_id" binding="#{product.itemId}" value="true" />
-                                                       </td>
-                                                       <td>
-                                                               #{product.title}
-                                                       </td>
-                                                       <td>
-                                                               #{product.price}
-                                                       </td>
-                                                       <td>
-                                                               ${controller.getPrintableProduktCategory(product)}
-                                                       </td>
-                                                       <td>
-                                                               ${controller.getPrintableProductAvailability(product)}
-                                                       </td>
-                                               </tr>
-                                               </ui:repeat>
-                                               <tr>
-                                                       <td colspan="5" class="table_footer">
-                                                               <h:commandButton class="reset" type="reset" value="Formular zurücksetzen" />
-                                                               <h:commandButton class="submit" type="submit" id="edit" action="#{admin_product.ediProduct(product)}" value="Ändern" />
-                                                               <h:commandButton class="delete" type="submit" id="delete" action="#{admin_category.deleteProduct(product)}" value="Löschen" />
-                                                       </td>
-                                               </tr>
-                                       </tbody>
-                               </table>
+                                       <h:dataTable columnClasses="table_row" headerClass="table_header_column" id="product_table" var="pro" value="#{admin_product.allProducts}">
+                                               <h:column>
+                                                       <f:facet name="header">Produktnummer:</f:facet>
+                                                       #{pro.id}:
+                                                       <h:selectBooleanCheckbox class="input" value="true" />
+                                               </h:column>
+
+                                               <h:column>
+                                                       <f:facet name="header">Produktbezeichnung:</f:facet>
+                                                       #{pro.title}
+                                               </h:column>
+                                               <h:column>
+                                                       <f:facet name="header">Einzelpreis:</f:facet>
+                                                       #{pro.price}
+                                               </h:column>
+                                               <h:column>
+                                                       <f:facet name="header">Kategorie:</f:facet>
+                                                       ${controller.getPrintableProduktCategory(product)}
+                                               </h:column>
+                                               <h:column>
+                                                       <f:facet name="header">Verfügbar:</f:facet>
+                                                       ${controller.getPrintableProductAvailability(product)}
+                                               </h:column>
+                                       </h:dataTable>
+
+                                       <div  class="table_footer">
+                                               <h:commandButton class="reset" type="reset" value="Formular zurücksetzen" />
+                                               <h:commandButton class="submit" type="submit" id="edit" action="#{admin_product.ediProduct(product)}" value="Ändern" />
+                                               <h:commandButton class="delete" type="submit" id="delete" action="#{admin_category.deleteProduct(product)}" value="Löschen" />
+                                       </div>
                                </h:form>
                        </div>
 
                                        </fieldset>
 
                                        <div class="table_footer">
-                                               <input class="reset" type="reset" value="Formular zurücksetzen" />
-                                               <input class="submit" type="submit" name="add" value="Hinzufügen" />
+                                               <h:commandButton class="reset" type="reset" value="Formular zurücksetzen" />
+                                               <h:commandButton class="submit" type="submit" id="add" action="#{admin_product.addProduct()}" value="Hinzufügen" />
                                        </div>
                                </div>
                                </h:form>
index c7f13834f3a419a6b7dd47fd74713bccf4ca9074..c8f01264c467f0bca3b3791f1c93fc4b08b10e7f 100644 (file)
                                                                <tr>
                                                                        <td class="table_data_column">
                                                                                <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{basket.addToBasket(product)}" />
-                                                                               <h:inputHidden id="itemId" value="#{product.itemId}" />
+                                                                               <h:inputHidden id="itemId" value="#{product.id}" />
                                                                                <h:inputHidden id="itemType" value="Product" />
                                                                        </td>