]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued with project:
authorRoland Haeder <roland@mxchange.org>
Thu, 27 Aug 2015 19:05:37 +0000 (21:05 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 27 Aug 2015 19:05:37 +0000 (21:05 +0200)
- started to refacture all JSPs towards JSFs
- this requires a lot to be rewritten
- moved some classes to better location
- deleted some old JSPs
- moved constants from FooBarConstants class to proper interface
- removed above mentioned classes
- added interface BasketTag
- updated jcore.jar
Signed-off-by:Roland Häder <roland@mxchange.org>

37 files changed:
lib/jcore.jar
nbproject/project.properties
src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java
src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java
src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java
src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java
src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java
src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java
src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java
src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java
src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java
src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java
src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java [deleted file]
src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java
src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java
src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java
web/WEB-INF/tlds/basket.tld
web/admin/category.jsp
web/admin/index.jsp
web/admin/product.jsp
web/form_handler/add_item.jsp
web/form_handler/admin/do_category.jsp
web/form_handler/admin/do_product.jsp
web/form_handler/do_order.jsp [deleted file]
web/form_handler/do_preview.jsp [deleted file]
web/index.jsp
web/static/admin/admin_category_selection_box.jsp
web/static/admin/admin_parent_category_selection_box.jsp
web/static/gender_selection_box.jsp

index 68d453786dc73ac35ef528ce3a68a76f5ba2bc4e..11b967e308d9a1e68b2d54167d9f1ae0f614b798 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index 9d9683c28031d4df67127e9c6dab8271e22fb3b7..5817b4971243aaedfe0f6dce1646c3b60b602482 100644 (file)
@@ -41,11 +41,11 @@ j2ee.compile.on.save=true
 j2ee.copy.static.files.on.save=true
 j2ee.deploy.on.save=true
 j2ee.platform=1.5
-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-osgi.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-osgi.jar
-j2ee.platform.wsimport.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-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
+j2ee.platform.wsimport.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
 j2ee.platform.wsit.classpath=
 j2ee.server.type=gfv3ee6
 jar.compress=false
index 8fe6981520b5ab4ecc1e892d429f6055154a1ef3..17c7504c163b480b3ea459bbd6f6554358cab43b 100644 (file)
@@ -34,6 +34,12 @@ public class BasePizzaServiceSystem extends BaseFrameworkSystem {
                // Trace message
                this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
 
+               // context shall not be null
+               if (null == context) {
+                       // Abort here
+                       throw new NullPointerException("context is null");
+               }
+
                // We need some properties that needs to be set
                for (final String name : this.getPropertyNames()) {
                        // Debug log
index 38d7dd4f657755a77eb80eab8bd79cfbf17c4651..dcb6060fbf0a55a02c0263802172d38c32c8fcd7 100644 (file)
@@ -118,7 +118,9 @@ public interface PizzaApplication extends Application {
         * @param request Request instance
         * @param session Session instance
         * @return Amount as string
+        * @deprecated Old code
         */
+       @Deprecated
        public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
 
        /**
index fa19b61b8676f39faaa1056382e8ef5c5f22d88f..b7f057c0c9e22d5a05c696ea079cf6428ae7add1 100644 (file)
@@ -32,12 +32,10 @@ import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
 import org.mxchange.pizzaapplication.category.Category;
-import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
 import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend;
 import org.mxchange.pizzaapplication.database.frontend.category.PizzaCategoryDatabaseFrontend;
 import org.mxchange.pizzaapplication.database.frontend.product.PizzaProductDatabaseFrontend;
 import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend;
-import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
 import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException;
 import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
 import org.mxchange.pizzaapplication.product.Product;
@@ -58,11 +56,25 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         */
        private CategoryFrontend categoryFrontend;
 
+       /**
+        * Default constructor
+        */
+       public PizzaServiceApplication () {
+               // Trace message
+               this.getLogger().trace("CALLED!");
+       }
+
        @Override
        public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException {
                // Trace message
                this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
 
+               // context should not be null
+               if (null == context) {
+                       // Abort here
+                       throw new NullPointerException("context is null");
+               }
+
                // Is the bundle initialized?
                if (!this.isBundledInitialized()) {
                        // Temporary initialize default bundle
@@ -80,12 +92,6 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                this.getLogger().trace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Default constructor
-        */
-       public PizzaServiceApplication () {
-       }
-
        /**
         * Calculates total amount of all choosen products
         *
@@ -491,6 +497,12 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         */
        @Override
        public Iterator<Product> getAvailableProducts () throws ServletException {
+               // categoryFrontend must be set
+               if (null == this.productFrontend) {
+                       // Abort here
+                       throw new NullPointerException("productFrontend is null");
+               }
+
                try {
                        // Ask frontend for a list of products
                        return this.productFrontend.getAvailableProducts();
@@ -506,6 +518,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         */
        @Override
        public Iterator<Product> getAllProducts () throws ServletException {
+               // Trace message
+               this.getLogger().trace("CALLED!");
+
+               // categoryFrontend must be set
+               if (null == this.productFrontend) {
+                       // Abort here
+                       throw new NullPointerException("productFrontend is null");
+               }
+
                try {
                        // Ask frontend for a list of products
                        return this.productFrontend.getAllProducts();
@@ -521,6 +542,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         */
        @Override
        public Iterator<Category> getCategories () throws ServletException {
+               // Trace message
+               this.getLogger().trace("CALLED!");
+
+               // categoryFrontend must be set
+               if (null == this.categoryFrontend) {
+                       // Abort here
+                       throw new NullPointerException("categoryFrontend is null");
+               }
+
                try {
                        // Ask frontend for a list of categories
                        return this.categoryFrontend.getCategories();
@@ -539,6 +569,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         * @return Amount as string
         */
        @Override
+       @Deprecated
        public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
                // Trace message
                this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N
@@ -1056,6 +1087,12 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         * @return Whether it has been found
         */
        private boolean isCategoryTitleUsed(final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+               // categoryFrontend must be set
+               if (null == this.categoryFrontend) {
+                       // Abort here
+                       throw new NullPointerException("categoryFrontend is null");
+               }
+
                // Delegate to frontend
                return this.categoryFrontend.isCategoryTitleUsed(title);
        }
@@ -1066,6 +1103,12 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         * @return Whether the product title has already been used
         */
        private boolean isProductTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+               // categoryFrontend must be set
+               if (null == this.productFrontend) {
+                       // Abort here
+                       throw new NullPointerException("productFrontend is null");
+               }
+
                // Delegate to frontend
                return this.productFrontend.isProductTitleUsed(title);
        }
@@ -1126,8 +1169,8 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                }
 
                // Get all fields
-               String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
-               String parent = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_PARENT);
+               String title = request.getParameter(CategoryFrontend.COLUMN_TITLE);
+               String parent = request.getParameter(CategoryFrontend.COLUMN_PARENT);
 
                // Debug message
                this.getLogger().debug(MessageFormat.format("title={0},parent={1}", title, parent)); //NOI18N
@@ -1138,10 +1181,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                // Check all fields
                if (null == title) {
                        // "title" not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
                } else if (title.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
                } else if ((parent != null) && (!parent.isEmpty())) {
                        // "parent" is set, so check it
                        try {
@@ -1191,10 +1234,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                }
 
                // Get title, price and category id
-               String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE);
-               String price = request.getParameter(PizzaProductDatabaseConstants.COLUMN_PRICE);
-               String category = request.getParameter(PizzaProductDatabaseConstants.COLUMN_CATEGORY);
-               String available = request.getParameter(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
+               String title = request.getParameter(ProductFrontend.COLUMN_TITLE);
+               String price = request.getParameter(ProductFrontend.COLUMN_PRICE);
+               String category = request.getParameter(ProductFrontend.COLUMN_CATEGORY);
+               String available = request.getParameter(ProductFrontend.COLUMN_AVAILABLE);
 
                // Debug message
                this.getLogger().debug(MessageFormat.format("title={0},price={1},category={2},available={3}", title, price, category, available)); //NOI18N
@@ -1206,31 +1249,31 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                // Check all fields
                if (null == title) {
                        // "title" not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N
                } else if (title.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N
                } else if (null == price) {
                        // "price" not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_PRICE)); //NOI18N
                } else if (price.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_PRICE)); //NOI18N
                } else if (null == category) {
                        // "title" not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N
                } else if (category.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N
                } else if (null == available) {
                        // "title" not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N
                } else if (available.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N
                } else if ((!"true".equals(available)) && (!"false".equals(available))) { //NOI18N
                        // Invalid value
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", ProductFrontend.COLUMN_AVAILABLE, available)); //NOI18N
                }
 
                // Parse numbers
@@ -1357,7 +1400,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
 
                // Init title
-               String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE);
+               String title = request.getParameter(ProductFrontend.COLUMN_TITLE);
 
                // request must not be null and "title" must be found and non-empty
                if (null == request) {
@@ -1365,10 +1408,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                        throw new NullPointerException("request is null"); //NOI18N
                } else if (null == title) {
                        // title is not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N
                } else if (title.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N
                }
 
                // Default is not used
@@ -1511,7 +1554,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
 
                // Init title
-               String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
+               String title = request.getParameter(CategoryFrontend.COLUMN_TITLE);
 
                // request must not be null and "title" must be found and non-empty
                if (null == request) {
@@ -1519,10 +1562,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                        throw new NullPointerException("request is null"); //NOI18N
                } else if (null == title) {
                        // title is not set
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
                } else if (title.isEmpty()) {
                        // Is left empty
-                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
                }
 
                // Default is not used
index 85daa560ea0ba8ce91d47135963b33ff39d348aa..3645d04cb1adbcdb53c039a4986cbe5b80d50669 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.pizzaapplication.basket;
 
 import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
@@ -45,6 +44,17 @@ public class BaseBasket<T extends AddableBasketItem> extends BasePizzaServiceSys
         */
        private static final long serialVersionUID = 784396762230845717L;
 
+       /**
+        * Protected constructor with session instance
+        *
+        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend has been configured
+        * @throws java.sql.SQLException If an SQL error occurs
+        */
+       protected BaseBasket () throws UnsupportedDatabaseBackendException, SQLException {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+       }
+
        @Override
        public void init (final ServletContext context, final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException {
                // Trace message
@@ -76,17 +86,6 @@ public class BaseBasket<T extends AddableBasketItem> extends BasePizzaServiceSys
                this.setFrontend(frontend);
        }
 
-       /**
-        * Protected constructor with session instance
-        * 
-        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend has been configured
-        * @throws java.sql.SQLException If an SQL error occurs
-        */
-       protected BaseBasket () throws UnsupportedDatabaseBackendException, SQLException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-       }
-
        @Override
        public void addItem (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
                // Trace call
@@ -164,29 +163,4 @@ public class BaseBasket<T extends AddableBasketItem> extends BasePizzaServiceSys
                // Return it
                return isAdded;
        }
-
-       /**
-        * Called when fields are set on deserialization
-        *
-        * @param in Object input stream
-        * @throws IOException If any IO error occurs
-        * @throws ClassNotFoundException If the class is not found
-        */
-       private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("in={0} - CALLED!", in));
-
-               try {
-                       // Init everything else
-
-                       // Init frontend
-                       BasketFrontend frontend = new BasketDatabaseFrontend();
-
-                       // Set it here
-                       this.setFrontend(frontend);
-               } catch (final UnsupportedDatabaseBackendException | SQLException ex) {
-                       // Continue to throw
-                       throw new IOException(ex);
-               }
-       }
 }
index ae34890f82dc31d76aebc0026990ced349ae7f06..51aaa0665ff3d66414f6ea157eacc2a1046dc3e3 100644 (file)
@@ -35,7 +35,6 @@ public class ItemBasket extends BaseBasket<AddableBasketItem> implements Basket<
 
        /**
         * Default constructor to be able to throw exceptions from super constructor
-        * @param context Context instance
         * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
         * @throws java.sql.SQLException If an SQL error occurs
         */
index 00188ca366dc2db36031338fedc4510c424691a6..539b0e7b46b9a8eb873b146a7e7162aada62ea03 100644 (file)
@@ -19,10 +19,13 @@ package org.mxchange.pizzaapplication.beans;
 import java.io.Serializable;
 import java.util.Iterator;
 import javax.faces.FacesException;
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import org.apache.logging.log4j.Logger;
+import org.mxchange.pizzaapplication.beans.basket.BasketBean;
 import org.mxchange.pizzaapplication.category.Category;
 import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException;
 import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
@@ -304,4 +307,31 @@ public interface PizzaBean extends Serializable {
         * @throws ServletException If something unexpected happened
         */
        public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+
+       /**
+        * Getter for logger
+        *
+        * @return Logger
+        */
+       public Logger getLogger ();
+
+       /**
+        * @return the basket
+        */
+       public BasketBean getBasket ();
+
+       /**
+        * @param basket the basket to set
+        */
+       public void setBasket (final BasketBean basket);
+
+       /**
+        * @return the application
+        */
+       public ServletContext getApplication ();
+
+       /**
+        * @param application the application to set
+        */
+       public void setApplication (final ServletContext application);
 }
index 7248b7d70e2aff29e6c05d9c228b0ae3cd3eea64..7ff4e8bab7099582d62da8713b32f0cbd3e40d16 100644 (file)
@@ -29,6 +29,8 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 import org.mxchange.pizzaapplication.application.PizzaApplication;
@@ -69,32 +71,49 @@ public class PizzaServiceBean implements PizzaBean {
         */
        private final PizzaApplication app;
 
+       /**
+        * Class' logger
+        */
+       private final Logger LOG;
+
        /**
         * Initializer block
         */
        {
                // Get new application instance
+               LOG = LogManager.getLogger(this);
+               LOG.debug("INITIALIZER!");
                this.app = new PizzaServiceApplication();
        }
 
+       /**
+        * Default constructor
+        */
+       public PizzaServiceBean () {
+               this.getLogger().trace("CALLED!");
+       }
+
        @Override
        @PostConstruct
        public void init () throws FacesException {
+               // Trace message
+               this.getLogger().trace("application=" + this.getApplication() + ",basket=" + this.getBasket() + " - CALLED!");
+
+               // Must not be null
+               if (this.getApplication() == null) {
+                       // Abort here
+                       throw new NullPointerException("application is null");
+               }
+
                try {
                        // Call init method
-                       this.app.init(this.application);
+                       this.app.init(this.getApplication());
                } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) {
                        // Continue to throw
                        throw new FacesException(ex);
                }
        }
 
-       /**
-        * Default constructor
-        */
-       public PizzaServiceBean () {
-       }
-
        /**
         * Calculates total amount of all choosen products
         *
@@ -248,6 +267,7 @@ public class PizzaServiceBean implements PizzaBean {
         * @return Amount as string
         */
        @Override
+       @Deprecated
        public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
                return this.app.getTotalPositionPriceFromRequestSession(product, request, session);
        }
@@ -381,4 +401,62 @@ public class PizzaServiceBean implements PizzaBean {
        public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
                this.app.doAdminHandleCategoryForms(request, response);
        }
+
+       /**
+        * Getter for logger
+        *
+        * @return Logger
+        */
+       @Override
+       public Logger getLogger () {
+               return this.LOG;
+       }
+
+       /**
+        * @return the basket
+        */
+       @Override
+       public BasketBean getBasket () {
+               // Trace message
+               this.getLogger().trace("basked=" + this.basket + " - EXIT!");
+
+               // Return it
+               return this.basket;
+       }
+
+       /**
+        * @param basket the basket to set
+        */
+       @Override
+       public void setBasket (final BasketBean basket) {
+               // Trace message
+               this.getLogger().trace("basked=" + basket + " - CALLED!");
+
+               // Set it here
+               this.basket = basket;
+       }
+
+       /**
+        * @return the application
+        */
+       @Override
+       public ServletContext getApplication () {
+               // Trace message
+               this.getLogger().trace("application=" + this.application + " - EXIT!");
+
+               // Return it
+               return this.application;
+       }
+
+       /**
+        * @param application the application to set
+        */
+       @Override
+       public void setApplication (final ServletContext application) {
+               // Trace message
+               this.getLogger().trace("application=" + application + " - CALLED!");
+
+               // Set it here
+               this.application = application;
+       }
 }
index 22d12224f072e2782594473e03632460c5200cbe..c37e6322b0b01d7af0ff25757af196e169da5025 100644 (file)
@@ -21,6 +21,9 @@ import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
 import javax.faces.FacesException;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import org.apache.logging.log4j.Logger;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 import org.mxchange.pizzaapplication.item.AddableBasketItem;
@@ -105,4 +108,31 @@ public interface BasketBean extends Serializable {
         * @return Human-readable message
         */
        public String getMessageStringFromKey (final String key);
+
+       /**
+        * Getter for logger
+        *
+        * @return Logger
+        */
+       public Logger getLogger ();
+
+       /**
+        * @return the application
+        */
+       public ServletContext getApplication ();
+
+       /**
+        * @param application the application to set
+        */
+       public void setApplication (final ServletContext application);
+
+       /**
+        * @return the session
+        */
+       public HttpSession getSession ();
+
+       /**
+        * @param session the session to set
+        */
+       public void setSession (final HttpSession session);
 }
index 27a074baca329dd4ddc5d1f0a3c8875f5b5ec3d1..1a8f76638a35f892ae10461912bb8e8ac8a9afa6 100644 (file)
@@ -20,13 +20,15 @@ import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
 import javax.annotation.PostConstruct;
-import javax.enterprise.context.Dependent;
+import javax.enterprise.context.SessionScoped;
 import javax.faces.FacesException;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
@@ -41,7 +43,7 @@ import org.mxchange.pizzaapplication.product.Product;
  * @author Roland Haeder
  */
 @Named("basket")
-@Dependent
+@SessionScoped
 public class ItemBasketBean implements BasketBean {
        /**
         * Serial number
@@ -60,19 +62,35 @@ public class ItemBasketBean implements BasketBean {
        @Inject
        private HttpSession session;
 
+       /**
+        * Class' logger
+        */
+       private final Logger LOG;
+
        /**
         * Instance of wrapped basket
         */
        private final Basket<AddableBasketItem> basket;
 
+       /**
+        * Initializer block
+        */
+       {
+               // Get new application instance
+               this.basket = new ItemBasket();
+               LOG = LogManager.getLogger(this);
+       }
+
        /**
         * Default constructor to be able to throw exceptions from super constructor
         * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
         * @throws java.sql.SQLException If an SQL error occurs
+        * @throws java.io.IOException If an IO Error occurs
+        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
         */
-       public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException {
-               // Get new application instance
-               this.basket = new ItemBasket();
+       public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException {
+               // Trace message
+               this.getLogger().trace("CALLED!");
        }
 
        @Override
@@ -93,9 +111,12 @@ public class ItemBasketBean implements BasketBean {
        @Override
        @PostConstruct
        public void init () throws FacesException {
+               // Trace message
+               this.getLogger().trace("application=" + this.getApplication() + ",session=" + this.getSession() + " - CALLED!");
+
                try {
                        // Init instance
-                       this.basket.init(this.application, this.session);
+                       this.basket.init(this.getApplication(), this.getSession());
                } catch (final UnsupportedDatabaseBackendException | IOException | SQLException | BadTokenException ex) {
                        // Continue to throw
                        throw new FaceletException(ex);
@@ -111,4 +132,46 @@ public class ItemBasketBean implements BasketBean {
        public boolean isItemAdded (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
                return this.basket.isItemAdded(item);
        }
+
+       /**
+        * Getter for logger
+        *
+        * @return Logger
+        */
+       @Override
+       public Logger getLogger () {
+               return this.LOG;
+       }
+
+       /**
+        * @return the application
+        */
+       @Override
+       public ServletContext getApplication () {
+               return this.application;
+       }
+
+       /**
+        * @param application the application to set
+        */
+       @Override
+       public void setApplication (final ServletContext application) {
+               this.application = application;
+       }
+
+       /**
+        * @return the session
+        */
+       @Override
+       public HttpSession getSession () {
+               return this.session;
+       }
+
+       /**
+        * @param session the session to set
+        */
+       @Override
+       public void setSession (final HttpSession session) {
+               this.session = session;
+       }
 }
index 12fc8fb659678500e0a1166653604f479cb07bd6..238c15b31a6d824596ebdcd0d94655cdccf07541 100644 (file)
  */
 package org.mxchange.pizzaapplication.beans.customer;
 
-import org.mxchange.pizzaapplication.customer.Customer;
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.contact.Gender;
 
 /**
  * An interface for customer beans
  *
  * @author Roland Haeder
  */
-public interface CustomerBean extends Customer {
+public interface CustomerBean extends Serializable {
+       /**
+        * Returns an iterator of all values from this object
+        *
+        * @return An iterator
+        * @throws java.lang.NoSuchMethodException If the invoked method was not found
+        * @throws java.lang.IllegalAccessException If the method cannot be accessed
+        * @throws java.lang.reflect.InvocationTargetException Any other problems?
+        */
+       public Iterator<Map.Entry<Field, Object>> iterator ()throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+       /**
+        * Some "getter" for translated gender of the contact
+        *
+        * @return Translated / human-readable gender
+        */
+       public String getTranslatedGender ();
+
+       /**
+        * 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);
+
+       /**
+        * 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);
+
+       /**
+        * Companyname
+        *
+        * @return the companyName
+        */
+       public String getCompanyName ();
+
+       /**
+        * Companyname
+        *
+        * @param companyName the companyName to set
+        */
+       public void setCompanyName (final String companyName);
+
+       /**
+        * 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);
+
+       /**
+        * Birth day
+        *
+        * @return the birthday
+        */
+       public String getBirthday ();
+
+       /**
+        * Birth day
+        *
+        * @param birthday the birthday to set
+        */
+       public void setBirthday (final String birthday);
+
+       /**
+        * Comments
+        *
+        * @return the comment
+        */
+       public String getComment ();
+
+       /**
+        * Comments
+        *
+        * @param comment the comment to set
+        */
+       public void setComment (final String comment);
+
+       /**
+        * Checks whether the contact is user's own data
+        *
+        * @return Own data?
+        */
+       public boolean isOwnContact ();
+
+       /**
+        * Shows the contact to the user
+        *
+        * @param client Client instance to call back
+        */
+       public void show (final Client client);
+
+       /**
+        * Some "getter for a value from given column name. This name will be
+        * translated into a method name and then this method is called.
+        *
+        * @param columnName Column name
+        * @return Value from field
+        * @throws IllegalArgumentException Some implementations may throw this
+        * @throws java.lang.NoSuchMethodException If the invoked method was not found
+        * @throws java.lang.IllegalAccessException If the method cannot be accessed
+        * @throws java.lang.reflect.InvocationTargetException Any other problems?
+        */
+       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+       /**
+        *  Some "setter" for a value from given column name. You may wish to overwrite this method in your
+        * own class.
+        * 
+        * @param columnName Column name
+        * @param value Value to set in object's field
+        * @throws IllegalArgumentException Some implementations may throw this
+        * @throws java.lang.NoSuchMethodException If the invoked method was not found
+        * @throws java.lang.IllegalAccessException If the method cannot be accessed
+        * @throws java.lang.reflect.InvocationTargetException Any other problems?
+        */
+       public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
 }
diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java
new file mode 100644 (file)
index 0000000..327a88f
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * 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.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
+import org.mxchange.pizzaapplication.beans.customer.CustomerBean;
+import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
+
+/**
+ * A customer bean which hides the customer instance
+ *
+ * @author Roland Haeder
+ */
+@Named("customer")
+@SessionScoped
+public class PizzaServiceCustomerBean implements CustomerBean {
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 543145347916L;
+
+       /**
+        * Contact instance
+        */
+       private Contact contact;
+
+       /**
+        * Default constructor
+        */
+       public PizzaServiceCustomerBean () {
+               // Instance customer
+               Contact customer = new PizzaServiceCustomer();
+
+               // Fake gender
+               customer.setGender(Gender.UNKNOWN);
+
+               // And set it here
+               this.setContact(customer);
+       }
+
+       @Override
+       public String getBirthday () {
+               // Deligate to "hidden" object
+               return this.getContact().getBirthday();
+       }
+
+       @Override
+       public void setBirthday (final String birthday) {
+               // Deligate to "hidden" object
+               this.getContact().setBirthday(birthday);
+       }
+
+       @Override
+       public String getCellphoneNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getCellphoneNumber();
+       }
+
+       @Override
+       public void setCellphoneNumber (final String cellphoneNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setCellphoneNumber(cellphoneNumber);
+       }
+
+       @Override
+       public String getCity () {
+               // Deligate to "hidden" object
+               return this.getContact().getCity();
+       }
+
+       @Override
+       public void setCity (final String city) {
+               // Deligate to "hidden" object
+               this.getContact().setCity(city);
+       }
+
+       @Override
+       public String getComment () {
+               // Deligate to "hidden" object
+               return this.getContact().getComment();
+       }
+
+       @Override
+       public void setComment (final String comment) {
+               // Deligate to "hidden" object
+               this.getContact().setComment(comment);
+       }
+
+       @Override
+       public String getCompanyName () {
+               // Deligate to "hidden" object
+               return this.getContact().getCompanyName();
+       }
+
+       @Override
+       public void setCompanyName (final String companyName) {
+               // Deligate to "hidden" object
+               this.getContact().setCompanyName(companyName);
+       }
+
+       @Override
+       public String getCountryCode () {
+               // Deligate to "hidden" object
+               return this.getContact().getCountryCode();
+       }
+
+       @Override
+       public void setCountryCode (final String countryCode) {
+               // Deligate to "hidden" object
+               this.getContact().setCountryCode(countryCode);
+       }
+
+       @Override
+       public String getEmailAddress () {
+               // Deligate to "hidden" object
+               return this.getContact().getEmailAddress();
+       }
+
+       @Override
+       public void setEmailAddress (final String emailAddress) {
+               // Deligate to "hidden" object
+               this.getContact().setEmailAddress(emailAddress);
+       }
+
+       @Override
+       public String getFamilyName () {
+               // Trace call
+               //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
+
+               // Deligate to "hidden" object
+               return this.getContact().getFamilyName();
+       }
+
+       @Override
+       public void setFamilyName (final String familyName) {
+               // Trace call
+               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
+
+               // Deligate to "hidden" object
+               this.getContact().setFamilyName(familyName);
+       }
+
+       @Override
+       public String getFaxNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getFaxNumber();
+       }
+
+       @Override
+       public void setFaxNumber (final String faxNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setFaxNumber(faxNumber);
+       }
+
+       @Override
+       public Gender getGender () {
+               // Deligate to "hidden" object
+               return this.getContact().getGender();
+       }
+
+       @Override
+       public void setGender (final Gender gender) {
+               // Deligate to "hidden" object
+               this.getContact().setGender(gender);
+       }
+
+       @Override
+       public Long getHouseNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getHouseNumber();
+       }
+
+       @Override
+       public void setHouseNumber (final Long houseNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setHouseNumber(houseNumber);
+       }
+
+       @Override
+       public String getPhoneNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getPhoneNumber();
+       }
+
+       @Override
+       public void setPhoneNumber (final String phoneNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setPhoneNumber(phoneNumber);
+       }
+
+       @Override
+       public String getStreet () {
+               // Deligate to "hidden" object
+               return this.getContact().getStreet();
+       }
+
+       @Override
+       public void setStreet (final String street) {
+               // Deligate to "hidden" object
+               this.getContact().setStreet(street);
+       }
+
+       @Override
+       public String getFirstName () {
+               // Deligate to "hidden" object
+               return this.getContact().getFirstName();
+       }
+
+       @Override
+       public void setFirstName (final String firstName) {
+               // Deligate to "hidden" object
+               this.getContact().setFirstName(firstName);
+       }
+
+       @Override
+       public String getTranslatedGender () {
+               // Deligate to "hidden" object
+               return this.getContact().getTranslatedGender();
+       }
+
+       @Override
+       public Long getZipCode () {
+               // Deligate to "hidden" object
+               return this.getContact().getZipCode();
+       }
+
+       @Override
+       public void setZipCode (final Long zipCode) {
+               // Deligate to "hidden" object
+               this.getContact().setZipCode(zipCode);
+       }
+
+       @Override
+       public boolean isOwnContact () {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public Iterator<Map.Entry<Field, Object>> iterator () throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+               // Deligate to "hidden" object
+               return this.getContact().iterator();
+       }
+
+       @Override
+       public void show (final Client client) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+               // Deligate to "hidden" object
+               return this.getContact().getValueFromColumn(columnName);
+       }
+
+       @Override
+       public void setValueFromColumn (final String columnName, final Object value) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+               // Deligate to "hidden" object
+               this.getContact().setValueFromColumn(columnName, value);
+       }
+
+       /**
+        * Setter for Contact instance
+        * @param contact Contact instance to set
+        */
+       private void setContact (final Contact contact) {
+               this.contact = contact;
+       }
+
+       /**
+        * Getter for Contact instance
+        * @return Contact instance
+        */
+       private Contact getContact () {
+               return this.contact;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java b/src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java
deleted file mode 100644 (file)
index d2fb8d7..0000000
+++ /dev/null
@@ -1,269 +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.customer.bean;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.Map;
-import org.mxchange.jcore.client.Client;
-import org.mxchange.jcore.contact.Contact;
-import org.mxchange.jcore.contact.Gender;
-import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
-import org.mxchange.pizzaapplication.beans.customer.CustomerBean;
-import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements CustomerBean {
-       /**
-        * Default constructor
-        */
-       public PizzaServiceCustomerBean () {
-               // Instance customer
-               Contact customer = new PizzaServiceCustomer();
-
-               // Fake gender
-               customer.setGender(Gender.UNKNOWN);
-
-               // And set it here
-               this.setContact(customer);
-       }
-
-       @Override
-       public String getBirthday () {
-               // Deligate to "hidden" object
-               return this.getContact().getBirthday();
-       }
-
-       @Override
-       public void setBirthday (final String birthday) {
-               // Deligate to "hidden" object
-               this.getContact().setBirthday(birthday);
-       }
-
-       @Override
-       public String getCellphoneNumber () {
-               // Deligate to "hidden" object
-               return this.getContact().getCellphoneNumber();
-       }
-
-       @Override
-       public void setCellphoneNumber (final String cellphoneNumber) {
-               // Deligate to "hidden" object
-               this.getContact().setCellphoneNumber(cellphoneNumber);
-       }
-
-       @Override
-       public String getCity () {
-               // Deligate to "hidden" object
-               return this.getContact().getCity();
-       }
-
-       @Override
-       public void setCity (final String city) {
-               // Deligate to "hidden" object
-               this.getContact().setCity(city);
-       }
-
-       @Override
-       public String getComment () {
-               // Deligate to "hidden" object
-               return this.getContact().getComment();
-       }
-
-       @Override
-       public void setComment (final String comment) {
-               // Deligate to "hidden" object
-               this.getContact().setComment(comment);
-       }
-
-       @Override
-       public String getCompanyName () {
-               // Deligate to "hidden" object
-               return this.getContact().getCompanyName();
-       }
-
-       @Override
-       public void setCompanyName (final String companyName) {
-               // Deligate to "hidden" object
-               this.getContact().setCompanyName(companyName);
-       }
-
-       @Override
-       public String getCountryCode () {
-               // Deligate to "hidden" object
-               return this.getContact().getCountryCode();
-       }
-
-       @Override
-       public void setCountryCode (final String countryCode) {
-               // Deligate to "hidden" object
-               this.getContact().setCountryCode(countryCode);
-       }
-
-       @Override
-       public String getEmailAddress () {
-               // Deligate to "hidden" object
-               return this.getContact().getEmailAddress();
-       }
-
-       @Override
-       public void setEmailAddress (final String emailAddress) {
-               // Deligate to "hidden" object
-               this.getContact().setEmailAddress(emailAddress);
-       }
-
-       @Override
-       public String getFamilyName () {
-               // Trace call
-               //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
-
-               // Deligate to "hidden" object
-               return this.getContact().getFamilyName();
-       }
-
-       @Override
-       public void setFamilyName (final String familyName) {
-               // Trace call
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
-
-               // Deligate to "hidden" object
-               this.getContact().setFamilyName(familyName);
-       }
-
-       @Override
-       public String getFaxNumber () {
-               // Deligate to "hidden" object
-               return this.getContact().getFaxNumber();
-       }
-
-       @Override
-       public void setFaxNumber (final String faxNumber) {
-               // Deligate to "hidden" object
-               this.getContact().setFaxNumber(faxNumber);
-       }
-
-       @Override
-       public Gender getGender () {
-               // Deligate to "hidden" object
-               return this.getContact().getGender();
-       }
-
-       @Override
-       public void setGender (final Gender gender) {
-               // Deligate to "hidden" object
-               this.getContact().setGender(gender);
-       }
-
-       @Override
-       public Long getHouseNumber () {
-               // Deligate to "hidden" object
-               return this.getContact().getHouseNumber();
-       }
-
-       @Override
-       public void setHouseNumber (final Long houseNumber) {
-               // Deligate to "hidden" object
-               this.getContact().setHouseNumber(houseNumber);
-       }
-
-       @Override
-       public String getPhoneNumber () {
-               // Deligate to "hidden" object
-               return this.getContact().getPhoneNumber();
-       }
-
-       @Override
-       public void setPhoneNumber (final String phoneNumber) {
-               // Deligate to "hidden" object
-               this.getContact().setPhoneNumber(phoneNumber);
-       }
-
-       @Override
-       public String getStreet () {
-               // Deligate to "hidden" object
-               return this.getContact().getStreet();
-       }
-
-       @Override
-       public void setStreet (final String street) {
-               // Deligate to "hidden" object
-               this.getContact().setStreet(street);
-       }
-
-       @Override
-       public String getFirstName () {
-               // Deligate to "hidden" object
-               return this.getContact().getFirstName();
-       }
-
-       @Override
-       public void setFirstName (final String firstName) {
-               // Deligate to "hidden" object
-               this.getContact().setFirstName(firstName);
-       }
-
-       @Override
-       public String getTranslatedGender () {
-               // Deligate to "hidden" object
-               return this.getContact().getTranslatedGender();
-       }
-
-       @Override
-       public Long getZipCode () {
-               // Deligate to "hidden" object
-               return this.getContact().getZipCode();
-       }
-
-       @Override
-       public void setZipCode (final Long zipCode) {
-               // Deligate to "hidden" object
-               this.getContact().setZipCode(zipCode);
-       }
-
-       @Override
-       public boolean isOwnContact () {
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
-       @Override
-       public Iterator<Map.Entry<Field, Object>> iterator () throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate to "hidden" object
-               return this.getContact().iterator();
-       }
-
-       @Override
-       public void show (final Client client) {
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
-       @Override
-       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate to "hidden" object
-               return this.getContact().getValueFromColumn(columnName);
-       }
-
-       @Override
-       public void setValueFromColumn (final String columnName, final Object value) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate to "hidden" object
-               this.getContact().setValueFromColumn(columnName, value);
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java
deleted file mode 100644 (file)
index 4fde31e..0000000
+++ /dev/null
@@ -1,45 +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.database.category;
-
-/**
- * Holder class for database columns for product frontend
- *
- * @author Roland Haeder
- */
-public final class PizzaCategoryDatabaseConstants {
-       /**
-        * Column name for "id"
-        */
-       public static final String COLUMN_ID = "category_id"; //NOI18N
-
-       /**
-        * Column name for "parent"
-        */
-       public static final String COLUMN_PARENT = "parent"; //NOI18N
-
-       /**
-        * Column name for "title"
-        */
-       public static final String COLUMN_TITLE = "title"; //NOI18N
-
-       /**
-        * No instance from this class
-        */
-       private PizzaCategoryDatabaseConstants () {
-       }
-}
index f6d8b3805a6c88feb4715c79310ea6d94f4d2a7c..82c65396084e6d5c0086a15ad0e7522b69826c5a 100644 (file)
@@ -32,6 +32,18 @@ import org.mxchange.pizzaapplication.product.Product;
  * @author Roland Häder
  */
 public interface CategoryFrontend extends DatabaseFrontend {
+       /**
+        * Column name for "parent"
+        */
+       public static final String COLUMN_PARENT = "parent"; //NOI18N
+       /**
+        * Column name for "title"
+        */
+       public static final String COLUMN_TITLE = "title"; //NOI18N
+       /**
+        * Column name for "id"
+        */
+       public static final String COLUMN_ID = "category_id"; //NOI18N
 
        /**
         * Adds given category title as new category, parent may be null if not
index aea4841652c8de2c3c5e938ab7e101cc556760e3..081484f5c2b15b8ec97e31e284100ab5b9e9e7a2 100644 (file)
@@ -34,7 +34,6 @@ import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 import org.mxchange.pizzaapplication.category.Category;
 import org.mxchange.pizzaapplication.category.product.ProductCategory;
-import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
 import org.mxchange.pizzaapplication.product.Product;
 
 /**
@@ -83,8 +82,8 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                this.clearDataSet();
 
                // Add title and parent
-               this.addToDataSet(PizzaCategoryDatabaseConstants.COLUMN_TITLE, title);
-               this.addToDataSet(PizzaCategoryDatabaseConstants.COLUMN_PARENT, parent);
+               this.addToDataSet(CategoryFrontend.COLUMN_TITLE, title);
+               this.addToDataSet(CategoryFrontend.COLUMN_PARENT, parent);
 
                // Handle this over to the backend
                // @todo Nothing is done yet!
@@ -134,7 +133,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                if ((value instanceof String) && ("".equals(value))) { //NOI18N
                        // This value may need to be changed
                        switch (key) {
-                               case PizzaCategoryDatabaseConstants.COLUMN_PARENT: // Convert this
+                               case CategoryFrontend.COLUMN_PARENT: // Convert this
                                        v = null;
                                        break;
                        }
@@ -196,7 +195,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                SearchableCriteria criteria = new SearchCriteria();
 
                // Add id to it
-               criteria.addCriteria(PizzaCategoryDatabaseConstants.COLUMN_ID, id);
+               criteria.addCriteria(CategoryFrontend.COLUMN_ID, id);
 
                // Only one entry is find
                criteria.setLimit(1);
@@ -235,7 +234,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
        @Override
        public String getIdName () {
                // Return column id
-               return PizzaCategoryDatabaseConstants.COLUMN_ID;
+               return CategoryFrontend.COLUMN_ID;
        }
 
        /**
@@ -259,9 +258,9 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                // "Walk" through all entries
                while (resultSet.next()) {
                        // Get id, title and parent id
-                       Long id = resultSet.getLong(PizzaCategoryDatabaseConstants.COLUMN_ID);
-                       String title = resultSet.getString(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
-                       Long parent = resultSet.getLong(PizzaCategoryDatabaseConstants.COLUMN_PARENT);
+                       Long id = resultSet.getLong(CategoryFrontend.COLUMN_ID);
+                       String title = resultSet.getString(CategoryFrontend.COLUMN_TITLE);
+                       Long parent = resultSet.getLong(CategoryFrontend.COLUMN_PARENT);
 
                        // Debug message
                        this.getLogger().debug(MessageFormat.format("id={0},title={1},parent={2}", id, title, parent)); //NOI18N
@@ -303,7 +302,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen
                SearchableCriteria criteria = new SearchCriteria();
 
                // Add criteria
-               criteria.addCriteria(PizzaCategoryDatabaseConstants.COLUMN_TITLE, title);
+               criteria.addCriteria(CategoryFrontend.COLUMN_TITLE, title);
 
                // Only one entry is find
                criteria.setLimit(1);
index 6059cf4630bbdf86299ba045fb48eb69e9ae0e74..1c9008a9b36c6266dfdf61a38eef9eb3931a3b05 100644 (file)
@@ -32,7 +32,6 @@ import org.mxchange.jcore.database.storage.Storeable;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
 import org.mxchange.pizzaapplication.product.Product;
 import org.mxchange.pizzaapplication.product.pizza.PizzaProduct;
 
@@ -91,10 +90,10 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                this.clearDataSet();
                
                // Add title and parent
-               this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_TITLE, title);
-               this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_PRICE, price);
-               this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_CATEGORY, category);
-               this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available);
+               this.addToDataSet(ProductFrontend.COLUMN_TITLE, title);
+               this.addToDataSet(ProductFrontend.COLUMN_PRICE, price);
+               this.addToDataSet(ProductFrontend.COLUMN_CATEGORY, category);
+               this.addToDataSet(ProductFrontend.COLUMN_AVAILABLE, available);
                
                // Handle this over to the backend
                // @todo Nothing is done yet!
@@ -197,7 +196,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                SearchableCriteria criteria = new SearchCriteria();
 
                // Add criteria
-               criteria.addCriteria(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, true);
+               criteria.addCriteria(ProductFrontend.COLUMN_AVAILABLE, true);
                
                // Run the query
                Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria);
@@ -218,7 +217,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
        @Override
        public String getIdName () {
                // Return column id
-               return PizzaProductDatabaseConstants.COLUMN_ITEM_ID;
+               return ProductFrontend.COLUMN_ITEM_ID;
        }
 
        /**
@@ -242,11 +241,11 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                // "Walk" through all entries
                while (resultSet.next()) {
                        // Get id, title and parent id
-                       Long id = resultSet.getLong(PizzaProductDatabaseConstants.COLUMN_ITEM_ID);
-                       String title = resultSet.getString(PizzaProductDatabaseConstants.COLUMN_TITLE);
-                       Float price = resultSet.getFloat(PizzaProductDatabaseConstants.COLUMN_PRICE);
-                       Long category = resultSet.getLong(PizzaProductDatabaseConstants.COLUMN_CATEGORY);
-                       Boolean available = resultSet.getBoolean(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
+                       Long id = resultSet.getLong(ProductFrontend.COLUMN_ITEM_ID);
+                       String title = resultSet.getString(ProductFrontend.COLUMN_TITLE);
+                       Float price = resultSet.getFloat(ProductFrontend.COLUMN_PRICE);
+                       Long category = resultSet.getLong(ProductFrontend.COLUMN_CATEGORY);
+                       Boolean available = resultSet.getBoolean(ProductFrontend.COLUMN_AVAILABLE);
 
                        // Debug message
                        this.getLogger().debug(MessageFormat.format("id={0},title={1},category={2},available={3}", id, title, category, available)); //NOI18N
@@ -291,7 +290,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement
                SearchableCriteria criteria = new SearchCriteria();
                
                // Add criteria
-               criteria.addCriteria(PizzaProductDatabaseConstants.COLUMN_TITLE, title);
+               criteria.addCriteria(ProductFrontend.COLUMN_TITLE, title);
                
                // Only one entry is find
                criteria.setLimit(1);
index cb4146a3e54ffd89f3e3286ec6609731ad2ad304..6cc261497d8b9854f96f5ab41116849a714eed20 100644 (file)
@@ -31,6 +31,26 @@ import org.mxchange.pizzaapplication.product.Product;
  * @author Roland Häder
  */
 public interface ProductFrontend extends DatabaseFrontend {
+       /**
+        * Column name for "item_id"
+        */
+       public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N
+       /**
+        * Column name for "available"
+        */
+       public static final String COLUMN_AVAILABLE = "available"; //NOI18N
+       /**
+        * Column name for "price"
+        */
+       public static final String COLUMN_PRICE = "price"; //NOI18N
+       /**
+        * Column name for "category"
+        */
+       public static final String COLUMN_CATEGORY = "category"; //NOI18N
+       /**
+        * Column name for "title"
+        */
+       public static final String COLUMN_TITLE = "title"; //NOI18N
 
        /**
         * Adds product to database by given title, price and category id
diff --git a/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java
deleted file mode 100644 (file)
index d10a80e..0000000
+++ /dev/null
@@ -1,55 +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.database.product;
-
-/**
- * Holder class for database columns for product frontend
- *
- * @author Roland Haeder
- */
-public final class PizzaProductDatabaseConstants {
-       /**
-        * Column name for "available"
-        */
-       public static final String COLUMN_AVAILABLE = "available"; //NOI18N
-
-       /**
-        * Column name for "category"
-        */
-       public static final String COLUMN_CATEGORY = "category"; //NOI18N
-
-       /**
-        * Column name for "item_id"
-        */
-       public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N
-
-       /**
-        * Column name for "price"
-        */
-       public static final String COLUMN_PRICE = "price"; //NOI18N
-
-       /**
-        * Column name for "title"
-        */
-       public static final String COLUMN_TITLE = "title"; //NOI18N
-
-       /**
-        * No instance from this class
-        */
-       private PizzaProductDatabaseConstants () {
-       }
-}
index 08d4ceaa7f4740b654d1f3fcb45309d4d20d422b..5295d62c2be60450ecccf7e0d0b422b53fdb4e5b 100644 (file)
@@ -18,7 +18,7 @@ package org.mxchange.pizzaapplication.exceptions;
 
 import java.text.MessageFormat;
 import javax.servlet.http.HttpServletRequest;
-import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
+import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend;
 
 /**
  * An exception thrown when the given title is already used
@@ -34,7 +34,6 @@ public class CategoryTitleAlreadyUsedException extends Exception {
         */
        public CategoryTitleAlreadyUsedException (final HttpServletRequest request) {
                // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE))); //NOI18N
+               super(MessageFormat.format("Title {0} is already used.", request.getParameter(CategoryFrontend.COLUMN_TITLE))); //NOI18N
        }
-       
 }
index 568ba3910458cf364b334a5b97a99ea0f12370dc..c36c59f520ca982daf7f5bea3184d6aaa4175782 100644 (file)
@@ -18,7 +18,7 @@ package org.mxchange.pizzaapplication.exceptions;
 
 import java.text.MessageFormat;
 import javax.servlet.http.HttpServletRequest;
-import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
+import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend;
 
 /**
  * An exception thrown when the given title is already used
@@ -34,7 +34,6 @@ public class ProductTitleAlreadyUsedException extends Exception {
         */
        public ProductTitleAlreadyUsedException (final HttpServletRequest request) {
                // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE))); //NOI18N
+               super(MessageFormat.format("Title {0} is already used.", request.getParameter(ProductFrontend.COLUMN_TITLE))); //NOI18N
        }
-       
 }
diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java
new file mode 100644 (file)
index 0000000..645f0b2
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2015 quix0r
+ *
+ * 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.tags.basket;
+
+import javax.servlet.jsp.tagext.BodyTag;
+import org.mxchange.pizzaapplication.beans.basket.BasketBean;
+
+/**
+ *
+ * @author quix0r
+ */
+public interface BasketTag extends BodyTag {
+
+       /**
+        * @return the basket
+        */
+       public BasketBean getBasket ();
+
+       /**
+        * @param basket the basket to set
+        */
+       public void setBasket (final BasketBean basket);
+}
index d3c36ba4f8ba5d6826829c68d04a490a72432d98..1ec420a3766f0aef2b1b0b9b4a741692c6eb220c 100644 (file)
@@ -19,8 +19,6 @@ package org.mxchange.pizzaapplication.tags.basket;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
 import org.mxchange.jcore.exceptions.BadTokenException;
@@ -32,12 +30,15 @@ import org.mxchange.pizzaapplication.beans.basket.BasketBean;
  *
  * @author Roland Haeder
  */
-@SessionScoped
-public class MiniBasketTag extends BodyTagSupport {
+public class MiniBasketTag extends BodyTagSupport implements BasketTag {
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 457415727452384L;
+
        /**
         * Basket instance
         */
-       @Inject
        private BasketBean basket;
 
        /**
@@ -53,17 +54,17 @@ public class MiniBasketTag extends BodyTagSupport {
                StringBuilder out = new StringBuilder("<div class=\"mini_basket\">\n");
 
                // basket should not be null
-               if (this.basket == null) {
+               if (this.getBasket() == null) {
                        // Not set
                        throw new NullPointerException("basket instance is null");
                }
 
                try {
                        // Some entries found?
-                       if (this.basket.isEmpty()) {
+                       if (this.getBasket().isEmpty()) {
                                // Empty basket
                                out.append("<div class=\"mini_basket_info\">\n");
-                               out.append(this.basket.getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n");
+                               out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n");
                                out.append("</div>\n");
                        } else {
                                // Some times were found
@@ -79,7 +80,7 @@ public class MiniBasketTag extends BodyTagSupport {
 
                try {
                        // Get output instance and write it
-                       pageContext.getOut().print(out.toString());
+                       this.pageContext.getOut().print(out.toString());
                } catch (final IOException ex) {
                        // Continue to throw
                        throw new JspException(ex);
@@ -88,4 +89,20 @@ public class MiniBasketTag extends BodyTagSupport {
                // Don't process any body
                return SKIP_BODY;
        }
+
+       /**
+        * @return the basket
+        */
+       @Override
+       public BasketBean getBasket () {
+               return this.basket;
+       }
+
+       /**
+        * @param basket the basket to set
+        */
+       @Override
+       public void setBasket (final BasketBean basket) {
+               this.basket = basket;
+       }
 }
index 6eed62f3bf7c8134bb236e3896b195bc5683fc1e..cd63a914a12b8d88ce8f35c15c850a2a062b4012 100644 (file)
@@ -9,5 +9,12 @@
                <name>mini_basket</name>
                <description>A mini basket showing latest added item and a link to the full basket web page</description>
                <tag-class>org.mxchange.pizzaapplication.tags.basket.MiniBasketTag</tag-class>
+               <attribute>
+                       <name>basket</name>
+                       <description>Basket instance, should be the same as the bean</description>
+                       <required>true</required>
+                       <rtexprvalue>true</rtexprvalue>
+                       <type>org.mxchange.pizzaapplication.beans.basket.BasketBean</type>
+               </attribute>
        </tag>
 </taglib>
index 3f9c0369718fd3624d711897946a94313060308a..03817a1350a30a618bf7a9c821762806e110c765 100644 (file)
@@ -7,15 +7,11 @@
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page import="org.mxchange.pizzaapplication.category.Category"%>
-<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
                                                </thead>
 
                                                <tbody>
-                                                       <c:forEach var="category" items="<%=app.getCategories()%>">
+                                                       <c:forEach var="category" items="<%=controller.getCategories()%>">
                                                        <tr>
                                                                <td>
-                                                                       <input class="input" type="checkbox" name="<%=PizzaCategoryDatabaseConstants.COLUMN_ID%>[${category.getCategoryId()}]" value="1" />
+                                                                       <input class="input" type="checkbox" name="<%=CategoryFrontend.COLUMN_ID%>[${category.getCategoryId()}]" value="1" />
                                                                </td>
                                                                <td>
                                                                        ${category.decodedTitle()}
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <input class="input" type="text" name="<%=PizzaCategoryDatabaseConstants.COLUMN_TITLE%>" size="10" maxlength="255" />
+                                                                       <input class="input" type="text" name="<%=CategoryFrontend.COLUMN_TITLE%>" size="10" maxlength="255" />
                                                                </div>
 
                                                                <div class="clear"></div>
index 778b6b21174862315fb2d0ffd38a6edf9f56bc92..d60e08def4f36635deb63df41a874615a1eaa2fc 100644 (file)
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
-<%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-%>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
        <head>
index cac2d9d93c9062c2955e1bfe843f804b6ac0e4ab..399fe98f82292a9b98b827874193ce41ce8d056c 100644 (file)
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
-<%@page import="org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
-<%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-%>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
        <head>
@@ -66,7 +63,7 @@
                                                </thead>
 
                                                <tbody>
-                                                       <c:forEach var="product" items="<%=app.getAllProducts()%>">
+                                                       <c:forEach var="product" items="<%=controller.getAllProducts()%>">
                                                        <tr>
                                                                <td>
                                                                        ${product.getItemId()}:
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <input class="input" type="text" name="<%=PizzaProductDatabaseConstants.COLUMN_TITLE%>" size="10" maxlength="255" />
+                                                                       <input class="input" type="text" name="<%=ProductFrontend.COLUMN_TITLE%>" size="10" maxlength="255" />
                                                                </div>
 
                                                                <div class="clear"></div>
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <input class="input" type="text" name="<%=PizzaProductDatabaseConstants.COLUMN_PRICE%>" size="10" maxlength="255" />
+                                                                       <input class="input" type="text" name="<%=ProductFrontend.COLUMN_PRICE%>" size="10" maxlength="255" />
                                                                </div>
 
                                                                <div class="clear"></div>
index 4a9fb126f592808f4d9069f680f7519546ebaa2e..aa07ebf68b51a284b8c02567d93040f43e63ca70 100644 (file)
@@ -4,24 +4,24 @@
        Author     : Roland Haeder
 --%>
 
+<%@page import="org.mxchange.jcore.BaseFrameworkSystem"%>
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
 
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+
 <jsp:useBean id="item" scope="request" class="org.mxchange.pizzaapplication.item.basket.BasketItem" type="AddableBasketItem" />
 <jsp:setProperty name="item" property="*" />
 
 <%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-
        // Get amount from item
        Long amount = item.getAmount();
 
        // Debug message
-       app.getLogger().debug("amount=" + amount);
+       BaseFrameworkSystem.getInstance().getLogger().debug("amount=" + amount);
 
        // Is amount null or zero?
        if ((null == amount) || (amount == 0)) {
index ca3fa53162e3e2923bb5f8753d1c94e22df4aa69..c4cf37df2dc1787b6f1b1262c297b2b3dd52d87b 100644 (file)
@@ -8,16 +8,14 @@
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 <%@page import="org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
 <%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-
        // Handle forms
-       app.doAdminHandleCategoryForms(request, response);
+       controller.doAdminHandleCategoryForms(request, response);
 %>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
index f806c8740859ee4385740f77ea32f007c103b09a..d912531bb13e1d84cf17aef7b709a7ed72966ca1 100644 (file)
@@ -8,15 +8,13 @@
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
 <%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-
        // Handle forms
-       app.doAdminHandleProductForms(request, response);
+       controller.doAdminHandleProductForms(request, response);
 %>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
diff --git a/web/form_handler/do_order.jsp b/web/form_handler/do_order.jsp
deleted file mode 100644 (file)
index a600660..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<%-- 
-       Document   : order
-       Created on : 07.08.2015, 14:58:21
-       Author     : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-
-<%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-
-       // Is it post?
-       if ("POST".equals(request.getMethod())) { //NOI18N
-               // @TODO Handle saving customer data and such things
-
-               // Mark all choosen products as ordered
-               app.markAllChoosenProductsAsOrdered(request, session);
-
-               // Redirect to proper URL
-               // @TODO Commented out for developing:
-               //response.sendRedirect(request.getContextPath() + "/finished.jsp");
-%>
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:setProperty name="customer" property="*" />
-<jsp:forward page="../finished.jsp" />
-<%
-       }
-%>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-       <head>
-               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-               <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
-               <title>Pizza-Service - Form-Handler</title>
-       </head>
-
-       <body>
-               <div id="title">
-                       <h1>Pizza-Service - Form-Handler</h1>
-               </div>
-
-               <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
-               <jsp:include page="/static/error/direct_call.jsp" flush="false" />
-       </body>
-</html>
diff --git a/web/form_handler/do_preview.jsp b/web/form_handler/do_preview.jsp
deleted file mode 100644 (file)
index f4b7f13..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<%-- 
-       Document   : order
-       Created on : 04.08.2015, 10:55:10
-       Author     : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="java.util.Iterator"%>
-<%@page import="java.util.Map"%>
-<%@page import="org.mxchange.jcore.contact.Gender"%>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<%
-       // Init application instance
-       PizzaBean app = PizzaServiceBean.getInstance(application);
-
-       // Is it post?
-       if ("POST".equals(request.getMethod())) { //NOI18N
-               // Get Iterator
-               Iterator<Product> iterator = app.getAvailableProducts();
-
-               // "Walk" through all products and unmark them as ordered
-               while (iterator.hasNext()) {
-                       // Get product instance
-                       Product product = iterator.next();
-
-                       // Mark product as not ordered
-                       app.unmarkProductAsOrdered(product, session);
-
-                       // Is it choosen and amount set?
-                       if (app.isProductChoosen(product, request, session)) {
-                               // Then mark it as choosen
-                               app.markProductAsChoosen(product, session);
-                       } else {
-                               // Unmark it
-                               app.unmarkProductAsChoosen(product, session);
-                       }
-               }
-
-               // Redirect to proper URL
-               // @TODO Commented out for developing:
-               //response.sendRedirect(request.getContextPath() + "/finished.jsp");
-%>
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:setProperty name="customer" property="*" />
-<jsp:forward page="../preview.jsp" />
-<%
-       }
-%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-       <head>
-               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-               <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
-               <title>Pizza-Service - Form-Handler</title>
-       </head>
-
-       <body>
-               <div id="title">
-                       <h1>Pizza-Service - Form-Handler</h1>
-               </div>
-
-               <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
-               <jsp:include page="/static/error/direct_call.jsp" flush="false" />
-       </body>
-</html>
index f3c27c5a7979f5b48248aaf916f157a20d65049d..b5e641aafd7bde9ce0d5b63cf94faa28636fa104 100644 (file)
@@ -4,10 +4,10 @@
        Author     : Roland Haeder
 --%>
 
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 <%@page import="org.mxchange.pizzaapplication.basket.Basket"%>
@@ -16,8 +16,7 @@
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <%@taglib prefix="basket" uri="http://mxchange.org/pizza-service/tags/basket" %>
-<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
-<jsp:useBean id="basket" scope="session" class="org.mxchange.pizzaapplication.beans.basket.ItemBasketBean" type="org.mxchange.pizzaapplication.beans.basket.BasketBean" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
@@ -42,7 +41,7 @@
                        </div>
 
                        <div id="content">
-                               <basket:mini_basket />
+                               <basket:mini_basket basket="${controller.basket}" />
 
                                <table class="table">
                                        <tr>
@@ -63,7 +62,7 @@
 
                                <%
                                // Get Iterator
-                               Iterator<Product> iterator = service.getAvailableProducts();
+                               Iterator<Product> iterator = controller.getAvailableProducts();
 
                                // "Walk" through all products and unmark them as ordered
                                while (iterator.hasNext()) {
@@ -74,7 +73,7 @@
                                        product.getLogger().debug("product.itemId=" + product.getItemId());
 
                                        // Create an item instance form this product
-                                       AddableBasketItem item = basket.getItem(product);
+                                       AddableBasketItem item = controller.getBasket().getItem(product);
 
                                        // Debug message
                                        product.getLogger().debug("item=" + item);
                                                // Then skip this item
                                                continue;
                                        }
-
-                                       // Unmark as ordered
-                                       service.unmarkProductAsOrdered(product, session);
                                        %>
                                <form action="<%=request.getContextPath()%>/form_handler/add_item.jsp" accept-charset="utf-8" id="form" method="post">
                                <table class="table">
index 908bc07290e5437422e61e4dcbe09e1ceffe9ad3..5d7672b2ec6fa75f0915ef2c7caf069c073c9b03 100644 (file)
@@ -5,13 +5,13 @@
 --%>
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
-<select class="select" name="category" size="1">
-       <c:forEach var="category" items="<%=service.getCategories()%>">
+<select class="select" name="<%=CategoryFrontend.COLUMN_ID%>" size="1">
+       <c:forEach var="category" items="<%=controller.getCategories()%>">
                <option value="${category.getCategoryId()}">${category.decodedTitle()}</option>
        </c:forEach>
 </select>
index 877396a6820149499757f539e4b1dc497c894043..845dcae4561dd0dc8dc36d474eb53272d3926362 100644 (file)
@@ -5,14 +5,14 @@
 --%>
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
-<select class="select" name="<%=PizzaCategoryDatabaseConstants.COLUMN_PARENT%>" size="1">
+<select class="select" name="<%=CategoryFrontend.COLUMN_PARENT%>" size="1">
        <option value="">Ist oberste Kategorie</option>
-       <c:forEach var="category" items="<%=service.getCategories()%>">
+       <c:forEach var="category" items="<%=controller.getCategories()%>">
                <option value="${category.getCategoryId()}">${category.decodedTitle()}</option>
        </c:forEach>
 </select>
index 615ef9e9a090b8672eaee56f2d57f938b0ff16f5..09379be6fb2300a548152bcc8ee508eed86ed9b2 100644 (file)
@@ -9,9 +9,9 @@
 <%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %>
 
 <jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
 
-<select class="select" name="gender" id="gender" size="1" <%=service.getDisabledHtmlFromSession(request, session)%>>
+<select class="select" name="gender" id="gender" size="1" <%=controller.getDisabledHtmlFromSession(request, session)%>>
        <%
        // "Walk" through all genders and output them
        for (final Gender gender : Gender.values()) {