]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Refacturing:
authorRoland Haeder <roland@mxchange.org>
Fri, 28 Aug 2015 20:07:27 +0000 (22:07 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 28 Aug 2015 20:07:27 +0000 (22:07 +0200)
- introduced new sub-project "jshop" which will be a generic shop library for
  JSF-based web applications.
- therefore a lot has been moved to there and new packages needs to be set.

Signed-off-by: Roland Häder <roland@mxchange.org>
56 files changed:
lib/jcore.jar
lib/jsfcore.jar
lib/jshop.jar [new file with mode: 0644]
nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.properties
nbproject/project.xml
src/java/org/mxchange/localization/bundle_en_US.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 [deleted file]
src/java/org/mxchange/pizzaapplication/basket/Basket.java [deleted file]
src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java
src/java/org/mxchange/pizzaapplication/beans/item/BasketItemBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/item/ItemBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/category/BaseCategory.java [deleted file]
src/java/org/mxchange/pizzaapplication/category/Category.java [deleted file]
src/java/org/mxchange/pizzaapplication/category/product/ProductCategory.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/basket/BasketDatabaseConstants.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketDatabaseFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java [deleted file]
src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java [deleted file]
src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java
src/java/org/mxchange/pizzaapplication/item/AddableBasketItem.java [deleted file]
src/java/org/mxchange/pizzaapplication/item/BaseItem.java [deleted file]
src/java/org/mxchange/pizzaapplication/item/basket/BasketItem.java [deleted file]
src/java/org/mxchange/pizzaapplication/product/BaseProduct.java [deleted file]
src/java/org/mxchange/pizzaapplication/product/Product.java [deleted file]
src/java/org/mxchange/pizzaapplication/product/pizza/PizzaProduct.java [deleted file]
src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java
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/bye.jsp
web/customer/login.jsp
web/customer/register.jsp
web/form_handler/add_item.jsp
web/index.jsp
web/static/admin/admin_category_selection_box.jsp
web/static/admin/admin_parent_category_selection_box.jsp

index adc5c6d62b12352d537c21cf4551a8411d51a901..5c344f84657d28ec66405902cd7958f977fe36e6 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index c68585ba7aa74968c525c6c45052674811ea37ca..9865324731046e90d011318d24eab563bc7c392d 100644 (file)
Binary files a/lib/jsfcore.jar and b/lib/jsfcore.jar differ
diff --git a/lib/jshop.jar b/lib/jshop.jar
new file mode 100644 (file)
index 0000000..9df42b3
Binary files /dev/null and b/lib/jshop.jar differ
index 31465cbd90f71a2e8c020adc0cf8ef1b0e8fee1a..7cc63684134fb280c934b862bfb02e98b5c4bc89 100644 (file)
@@ -1031,6 +1031,7 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.jsfcore.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.cdi-api.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.commons-lang3-3.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.jshop.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <mkdir dir="${build.web.dir}/META-INF"/>
         <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
     </target>
@@ -1044,6 +1045,7 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.jsfcore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.cdi-api.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.commons-lang3-3.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.jshop.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
     </target>
     <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
         <delete dir="${build.web.dir}/WEB-INF/lib"/>
index 88d3fe8f9d4455252bd1b33261d003d53d36b8ad..d76800cb9c777509958ff155aaa9868dea4c6e31 100644 (file)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=45780b08
+build.xml.data.CRC32=183b4b56
 build.xml.script.CRC32=a6f5a733
 build.xml.stylesheet.CRC32=651128d4@1.68.1.1
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=45780b08
-nbproject/build-impl.xml.script.CRC32=0bccd313
+nbproject/build-impl.xml.data.CRC32=183b4b56
+nbproject/build-impl.xml.script.CRC32=6164077b
 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
index 5817b4971243aaedfe0f6dce1646c3b60b602482..851aac70e7598dc377f6c841c3b685b1e96aa50a 100644 (file)
@@ -32,6 +32,7 @@ file.reference.cdi-api.jar=lib\\cdi-api.jar
 file.reference.commons-codec-1.10.jar=lib/commons-codec-1.10.jar
 file.reference.commons-lang3-3.4.jar=lib\\commons-lang3-3.4.jar
 file.reference.jsfcore.jar=lib/jsfcore.jar
+file.reference.jshop.jar=lib/jshop.jar
 file.reference.log4j-api-2.3.jar=lib/log4j-api-2.3.jar
 file.reference.log4j-core-2.3.jar=lib/log4j-core-2.3.jar
 file.reference.jcore.jar=lib/jcore.jar
@@ -58,7 +59,8 @@ javac.classpath=\
     ${file.reference.log4j-web-2.3.jar}:\
     ${file.reference.jsfcore.jar}:\
     ${file.reference.cdi-api.jar}:\
-    ${file.reference.commons-lang3-3.4.jar}
+    ${file.reference.commons-lang3-3.4.jar}:\
+    ${file.reference.jshop.jar}
 # Space-separated list of extra javac options
 javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
 javac.debug=true
index a09112297a151be0c4773918c1dac08fcb039d64..7468c7595e3dab99e5600402ef7f3e0e9a8ca14e 100644 (file)
                     <file>${file.reference.commons-lang3-3.4.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
+                <library dirs="200">
+                    <file>${file.reference.jshop.jar}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
             </web-module-libraries>
             <web-module-additional-libraries/>
             <source-roots>
index 07e8210fff04912b6dfe91ee9511a9b9d69a5367..646cd4e427a8e021f1ab32b520d88b5162989a91 100644 (file)
@@ -16,7 +16,7 @@ BaseContact.gender.unknown.text=Unknown
 BaseContact.gender.male.text=Mr.
 BaseContact.gender.female.text=Mrs.
 BaseContact.gender.company.text=Company
-MiniBasketTag.basket_is_empty=Der Warenkorb ist leer.
-MiniBasketTag.last_item=Zuletzt hinzugef&uuml;gt: {0}
-MiniBasketTag.additional_items=Es befinden sich noch {0} weitere Produkte im Warenkorb.
-MiniBasketTag.to_basket=Zum Warenkorb
+MiniBasketTag.basket_is_empty=The basket is empty.
+MiniBasketTag.last_item=Last added item: {0}
+MiniBasketTag.additional_items=There are {0} items in the basket.
+MiniBasketTag.to_basket=To basket
index 17c7504c163b480b3ea459bbd6f6554358cab43b..aac7e6eedcb962219ac2233e95dbfc0d6c23f5ea 100644 (file)
  */
 package org.mxchange.pizzaapplication;
 
-import java.text.MessageFormat;
-import javax.servlet.ServletContext;
-import org.mxchange.jcore.BaseFrameworkSystem;
+import org.mxchange.jshop.BaseShopSystem;
 
 /**
  * A general class for whole pizza application.
  *
  * @author Roland Haeder
  */
-public class BasePizzaServiceSystem extends BaseFrameworkSystem {
-       /**
-        * Initializes properties from given servlet configuration
-        * @param context Servlet context instance
-        */
-       protected void initProperties (final ServletContext context) {
-               // 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
-                       this.getLogger().debug(MessageFormat.format("name={0}", name)); //NOI18N
-
-                       // Get value
-                       String value = context.getInitParameter(name);
-
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("value={0}", value)); //NOI18N
-
-                       // Is it null?
-                       if (null == value) {
-                               // Value is null
-                               throw new NullPointerException(MessageFormat.format("value for {0} is null, maybe invalid context parameter?", name)); //NOI18N
-                       } else if (name.equals("database.backend.storagepath")) { //NOI18N
-                               // Need to expand this path
-                               value = context.getRealPath(String.format("../../%s", value.trim())); //NOI18N
-                       }
-
-                       // Debug log
-                       this.getLogger().debug(MessageFormat.format("{0}={1}", name, value)); //NOI18N
-
-                       // Set property
-                       this.setProperty(name, value);
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
+public class BasePizzaServiceSystem extends BaseShopSystem {
 }
index 9f72fb876923a4147148cf66b0430eee7c21bb90..738ac7b09b3e3f92053d32b2d04f78c748f1f84f 100644 (file)
@@ -27,11 +27,11 @@ import javax.servlet.http.HttpSession;
 import org.mxchange.jcore.application.Application;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.category.Category;
-import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException;
-import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
+import org.mxchange.jshop.category.Category;
+import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.jshop.item.AddableBasketItem;
+import org.mxchange.jshop.product.Product;
 
 /**
  *
index 7d27ca191ac46762dc1fc6b42939d7ced015e7d4..96c368642488de762a9506b556af4c2253306714 100644 (file)
@@ -30,16 +30,16 @@ import javax.servlet.http.HttpSession;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
+import org.mxchange.jshop.category.Category;
+import org.mxchange.jshop.database.frontend.category.CategoryDatabaseFrontend;
+import org.mxchange.jshop.database.frontend.category.CategoryFrontend;
+import org.mxchange.jshop.database.frontend.product.ProductDatabaseFrontend;
+import org.mxchange.jshop.database.frontend.product.ProductFrontend;
+import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.jshop.item.AddableBasketItem;
+import org.mxchange.jshop.product.Product;
 import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
-import org.mxchange.pizzaapplication.category.Category;
-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.exceptions.CategoryTitleAlreadyUsedException;
-import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
 
 /**
  * Main application class
@@ -1072,10 +1072,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Product frontend
-               this.productFrontend = new PizzaProductDatabaseFrontend();
+               this.productFrontend = new ProductDatabaseFrontend();
 
                // Category frontend
-               this.categoryFrontend = new PizzaCategoryDatabaseFrontend();
+               this.categoryFrontend = new CategoryDatabaseFrontend();
 
                // Trace message
                this.getLogger().trace("EXIT!"); //NOI18N
diff --git a/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java b/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java
deleted file mode 100644 (file)
index 58ff9cf..0000000
+++ /dev/null
@@ -1,195 +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.basket;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import java.util.Map;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
-import org.mxchange.pizzaapplication.database.frontend.basket.BasketDatabaseFrontend;
-import org.mxchange.pizzaapplication.database.frontend.basket.BasketFrontend;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * A general basket class
- *
- * @author Roland Haeder
- * @param <T> Any instance that implements AddableBasketItem
- */
-public class BaseBasket<T extends AddableBasketItem> extends BasePizzaServiceSystem implements Basket<T>, Serializable {
-       /**
-        * Serial number
-        */
-       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
-               this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
-
-               // Is the bundle initialized?
-               if (!this.isBundledInitialized()) {
-                       // Temporary initialize default bundle
-                       // @TODO The enum Gender uses this
-                       this.initBundle();
-               }
-
-               // Initialize properties from context
-               this.initProperties(context);
-
-               // Create frontend instance
-               BasketFrontend frontend = new BasketDatabaseFrontend();
-
-               // Set session id here
-               this.setSessionId(session.getId());
-
-               // Set it in frontend, too
-               frontend.setSessionId(session.getId());
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("frontend={0} being set ...", frontend)); //NOI18N
-
-               // Instance it here
-               this.setFrontend(frontend);
-       }
-
-       @Override
-       public void addItem (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace call
-               this.getLogger().trace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
-
-               // item must not be null
-               if (null == item) {
-                       // Then abort here
-                       throw new NullPointerException("item is null"); //NOI18N
-               } else if (this.isItemAdded(item)) {
-                       // Already been added
-                       throw new IllegalArgumentException("item has already been added. Did you miss to call isItemAdded()?"); //NOI18N
-               }
-
-               // Add item to database
-               ((BasketFrontend) this.getFrontend()).addItem(item, this.getSessionId());
-
-               // Trace call
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       @Override
-       public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
-
-               // product must not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("Product {0} has id {1},frontend={2}", product.getTitle(), product.getItemId(), this.getFrontend())); //NOI18N
-
-               // Get item instance from map by product's id number (both are the same)
-               AddableBasketItem item = ((BasketFrontend) this.getFrontend()).getItem(product, this.getSessionId());
-
-               // Is it null?
-               if (null == item) {
-                       // Trace message
-                       this.getLogger().trace("item=null - EXIT!"); //NOI18N
-               } else {
-                       // Trace message
-                       this.getLogger().trace(MessageFormat.format("item={0} with id={1},amount={2} - EXIT!", item, item.getItemId(), item.getAmount())); //NOI18N
-               }
-
-               // Return it
-               return item;
-       }
-
-       @Override
-       public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate call to frontend
-               return ((BasketFrontend) this.getFrontend()).isEmpty();
-       }
-
-       @Override
-       public boolean isItemAdded (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace call
-               this.getLogger().trace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
-
-               // item must not be null
-               if (null == item) {
-                       // Then abort here
-                       throw new NullPointerException("item is null"); //NOI18N
-               }
-
-               // Call map's method
-               boolean isAdded = ((BasketFrontend) this.getFrontend()).isItemAdded(item, this.getSessionId());
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("isAdded={0} - EXIT!", isAdded)); //NOI18N
-
-               // Return it
-               return isAdded;
-       }
-
-       @Override
-       public Map<Long, T> getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-
-               // Init map
-               @SuppressWarnings("unchecked")
-               Map<Long, T> map = (Map<Long, T>) ((BasketFrontend) this.getFrontend()).getAll();
-
-               // Trace message
-               this.getLogger().trace("map=" + map);
-
-               // Return it
-               return map;
-       }
-
-       @Override
-       public AddableBasketItem getLast () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate to frontend
-               return ((BasketFrontend) this.getFrontend()).getLast();
-       }
-
-       @Override
-       public int getLastNumRows () {
-               // Deligate to frontend
-               return this.getFrontend().getLastNumRows();
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/basket/Basket.java b/src/java/org/mxchange/pizzaapplication/basket/Basket.java
deleted file mode 100644 (file)
index 462d466..0000000
+++ /dev/null
@@ -1,146 +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.basket;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.util.Map;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import org.mxchange.jcore.FrameworkInterface;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * An interface for baskets
- *
- * @author Roland Haeder
- * @param <T> Any addable basket items
- */
-public interface Basket<T extends AddableBasketItem> extends Serializable, FrameworkInterface {
-
-       /**
-        * Adds given item instance to this basket
-        * @param item Item instance to add
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public void addItem (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Checks if the basket is empty
-        *
-        * @return Whether the basket is empty
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Checks whether the given item as already been added. Mostly
-        * implementations may check the id number as this is mostly believed being
-        * unique.
-        *
-        * @param item Item instance to check
-        * @return Whether the given item has been found
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public boolean isItemAdded (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Returns an item for given product instance or null if not found.
-        * 
-        * @param product Product instance
-        * @return Item instance or null
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Initializes this instance with given ServletContext
-        *
-        * @param context Servlet context
-        * @param session Session instance
-        * @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 void init (final ServletContext context, final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException;
-
-       /**
-        * Some "getter" for all entries in this basket
-        *
-        * @return Map on all basket items
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public Map<Long, T> getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Getter for last entry
-        *
-        * @return Last added item in basket
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public AddableBasketItem getLast () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Getter for last num rows
-        * 
-        * @return Last num rows
-        */
-       public int getLastNumRows ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java b/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java
deleted file mode 100644 (file)
index 51aaa06..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.basket.item;
-
-import java.sql.SQLException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.basket.BaseBasket;
-import org.mxchange.pizzaapplication.basket.Basket;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-
-/**
- * A basket for orderable items
- *
- * @author Roland Haeder
- */
-public class ItemBasket extends BaseBasket<AddableBasketItem> implements Basket<AddableBasketItem> {
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 4384123923163957L;
-
-       /**
-        * 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
-        */
-       public ItemBasket () throws UnsupportedDatabaseBackendException, SQLException {
-               // Call super constructor
-               super();
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java b/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java
deleted file mode 100644 (file)
index 142e678..0000000
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans;
-
-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;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- *
- * @author Roland Haeder
- */
-public interface PizzaBean extends Serializable {
-       /**
-        * Some "getter" for amount from session
-        *
-        * @param product Product instance
-        * @param session Session instance
-        * @return Amount as string
-        * @deprecated Old code
-        */
-       @Deprecated
-       public String getAmountFromSession (final Product product, final HttpSession session);
-
-       /**
-        * Some "getter" for choose from session
-        *
-        * @param product Product instance
-        * @param session Session instance
-        * @return Choose as string
-        * @deprecated Old code
-        */
-       @Deprecated
-       public String getChooseFromSession (final Product product, final HttpSession session);
-
-       /**
-        * Handler for amount from session
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Amount as string
-        * @deprecated Old code
-        */
-       @Deprecated
-       public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
-
-       /**
-        * Some "getter" for printable choosen (checkbox) from request or session
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Amount as string
-        * @deprecated Old code
-        */
-       @Deprecated
-       public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
-
-       /**
-        * Some "getter" for total price of position from request or session.
-        * Single price and amount is multiplyed.
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Amount as string
-        */
-       public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
-
-       /**
-        * Initializes this instance
-        * 
-        * @throws FacesException If something was wrong
-        */
-       public void init () throws FacesException;
-
-       /**
-        * Checks whether the given product is choosen, request overules session.
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Whether the product is choosen
-        * @deprecated Old lost code
-        */
-       @Deprecated
-       public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session);
-
-       /**
-        * Calculates total price of all choosen products
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @return Total price of all choosen products
-        * @throws javax.servlet.ServletException If something unexpected happened
-        */
-       public float calculateTotalPrice (final HttpServletRequest request, final HttpSession session) throws ServletException;
-
-       /**
-        * Calculates total amount of all choosen products
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @return Total amount of all choosen products
-        * @throws javax.servlet.ServletException If something unexpected happened
-        */
-       public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException;
-
-       /**
-        * Some "getter" for HTML code 'checked="checked"' if the product is choosen
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Whether the product is choosen
-        */
-       public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session);
-
-       /**
-        * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @return Whether the product is choosen
-        * @throws javax.servlet.ServletException If something unexpected happened
-        */
-       public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException;
-
-       /**
-        * Marks given product as ordered in session
-        *
-        * @param product Product to mark as ordered
-        * @param session Session instance
-        * @deprecated Old code
-        */
-       @Deprecated
-       public void markProductAsOrdered(final Product product, final HttpSession session);
-
-       /**
-        * Marks given product as choosen in session
-        *
-        * @param product Product to mark as ordered
-        * @param session Session instance
-        * @deprecated Old code
-        */
-       @Deprecated
-       public void markProductAsChoosen(final Product product, final HttpSession session);
-
-       /**
-        * Unmarks given product as ordered in session
-        *
-        * @param product Product to unmark as ordered
-        * @param session Session instance
-        * @deprecated Old code
-        */
-       @Deprecated
-       public void unmarkProductAsOrdered(final Product product, final HttpSession session);
-
-       /**
-        * Unmarks given product as choosen in session
-        *
-        * @param product Product to unmark as choosen
-        * @param session Session instance
-        * @deprecated Old code
-        */
-       @Deprecated
-       public void unmarkProductAsChoosen(final Product product, final HttpSession session);
-
-       /**
-        * Some getter for printable value from session or an empty string for null.
-        *
-        * @param session Session instance
-        * @param key Key to get
-        * @return Value from key, empty string for null
-        */
-       public Object getPrintableValeFromSession (final HttpSession session, final String key);
-
-       /**
-        * Somewhat setter in session
-        *
-        * @param session Session instance
-        * @param key Session key to set
-        * @param value Value to set
-        */
-       public void setValueInSession (final HttpSession session, final String key, final Object value);
-
-       /**
-        * Some "getter" for a an array of only available products
-        * 
-        * @return Only available products
-        * @throws javax.servlet.ServletException If anything went wrong
-        */
-       public Iterator<Product> getAvailableProducts () throws ServletException;
-
-       /**
-        * Some "getter" for a an array of all products
-        *
-        * @return All products
-        * @throws javax.servlet.ServletException If anything went wrong
-        */
-       public Iterator<Product> getAllProducts () throws ServletException;
-
-       /**
-        * Some "getter" for a an array of all categories
-        *
-        * @return All categories
-        * @throws javax.servlet.ServletException If anything went wrong
-        */
-       public Iterator<Category> getAllCategories () throws ServletException;
-
-       /**
-        * Checks if given Product instance is available and returns a printable
-        * (human-readable) string.
-        * 
-        * @param product Product instance to check
-        * @return Human-readable version of product availability
-        */
-       public String getPrintableProduktAvailability (final Product product);
-
-       /**
-        * Returns a printable (human-readable) string of product's category
-        * 
-        * @param product Product instance to check
-        * @return Human-readable version of product availability
-        * @throws javax.servlet.ServletException If something unexpected happened
-        */
-       public String getPrintableProduktCategory (final Product product) throws ServletException;
-
-       /**
-        * Marks all choosen products as ordered
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @throws javax.servlet.ServletException If something unexpected happened
-        * @deprecated Old code
-        */
-       @Deprecated
-       public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException;
-
-       /**
-        * Adds given category data from request to database
-        *
-        * @param request Request instance
-        * @throws javax.servlet.ServletException If something unexpected happened
-        * @throws org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException If the given title is already used
-        */
-       public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
-
-       /**
-        * Adds given product data from request to database
-        *
-        * @param request Request instance
-        * @throws javax.servlet.ServletException If something unexpected happened
-        * @throws org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException If the given product title is already used
-        */
-       public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
-
-       /**
-        * Generates link HTML code for given category's parent id, if set. This
-        * link then points to products.jsp?category_id=x
-        *
-        * @param category Category instance
-        * @return HTML code
-        */
-       public String generateLinkForParent (final Category category);
-
-       /**
-        * Handles admin product form requests
-        *
-        * @param request Request instance
-        * @param response Response instance
-        * @throws ServletException If something unexpected happened
-        */
-       public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
-
-       /**
-        * Handles admin category form requests
-        * 
-        * @param request Request instance
-        * @param response Response instance
-        * @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);
-
-       /**
-        * Some "getter" for a product from given item
-        * @param item Item instance
-        * @return A Product instance
-        * @throws javax.servlet.ServletException If something bad happens
-        */
-       public Product getProduct (final AddableBasketItem item) throws ServletException;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java
deleted file mode 100644 (file)
index 17843ba..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.inject.Inject;
-import javax.inject.Named;
-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.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;
-import org.mxchange.pizzaapplication.application.PizzaServiceApplication;
-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;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * Main application class
- *
- * @author Roland Haeder
- */
-@Named("controller")
-@SessionScoped
-public class PizzaServiceBean implements PizzaBean {
-       /**
-        * Serial id
-        */
-       private static final long serialVersionUID = 58137539530279L;
-
-       /**
-        * Servlet context
-        */
-       @Inject
-       private ServletContext application;
-
-       /**
-        * Basket instance
-        */
-       @Inject
-       private BasketBean basket;
-
-       /**
-        * Pizza application
-        */
-       private final PizzaApplication app;
-
-       /**
-        * Class' logger
-        */
-       private final Logger LOG;
-
-       /**
-        * Initializer block
-        */
-       {
-               // Get new application instance
-               this.LOG = LogManager.getLogger(this);
-               this.LOG.debug("INITIALIZER!"); //NOI18N
-               this.app = new PizzaServiceApplication();
-       }
-
-       /**
-        * Default constructor
-        */
-       public PizzaServiceBean () {
-               this.getLogger().trace("CALLED!"); //NOI18N
-       }
-
-       @Override
-       @PostConstruct
-       public void init () throws FacesException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("application={0},basket={1} - CALLED!", this.getApplication(), this.getBasket())); //NOI18N
-
-               // Must not be null
-               if (this.getApplication() == null) {
-                       // Abort here
-                       throw new NullPointerException("application is null"); //NOI18N
-               }
-
-               try {
-                       // Call init method
-                       this.app.init(this.getApplication());
-               } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) {
-                       // Continue to throw
-                       throw new FacesException(ex);
-               }
-       }
-
-       /**
-        * Calculates total amount of all choosen products
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @return Total amount of all choosen products
-        */
-       @Override
-       public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException {
-               return this.app.calculateTotalAmount(request, session);
-       }
-
-       /**
-        * Calculates total price of all choosen products
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @return Total price of all choosen products
-        */
-       @Override
-       public float calculateTotalPrice (final HttpServletRequest request, final HttpSession session) throws ServletException {
-               return this.app.calculateTotalPrice(request, session);
-       }
-
-       /**
-        * Some "getter" for amount from session
-        *
-        * @param product Product instance
-        * @param session Session instance
-        * @return Amount as string
-        */
-       @Override
-       @Deprecated
-       public String getAmountFromSession (final Product product, final HttpSession session) {
-               return this.app.getAmountFromSession(product, session);
-       }
-
-       /**
-        * Some "getter" for HTML code 'checked="checked"' if the product is choosen
-        * 
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Whether the product is choosen
-        */
-       @Override
-       public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session) {
-               return this.app.getCheckedHtmlFromProduct(product, request, session);
-       }
-
-       /**
-        * Some "getter" for choose from session
-        * 
-        * @param product Product instance
-        * @param session Session instance
-        * @return Choose as string
-        */
-       @Override
-       @Deprecated
-       public String getChooseFromSession (final Product product, final HttpSession session) {
-               return this.app.getChooseFromSession(product, session);
-       }
-
-       /**
-        * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
-        *
-        * @param request Request instance
-        * @param session Session instance
-        * @return Whether the product is choosen
-        */
-       @Override
-       public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException {
-               return this.app.getDisabledHtmlFromSession(request, session);
-       }
-
-       /**
-        * Some "getter" for choosen (checkbox) from session
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Amount as string
-        */
-       @Override
-       @Deprecated
-       public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
-               return this.app.getPrintableChoosenFromRequestSession(product, request, session);
-       }
-
-       /**
-        * Checks if given Product instance is available and returns a printable
-        * (human-readable) string.
-        * 
-        * @param product Product instance to check
-        * @return Human-readable version of product availability
-        */
-       @Override
-       public String getPrintableProduktAvailability (final Product product) {
-               return this.app.getPrintableProduktAvailability(product);
-       }
-
-       /**
-        * Some getter for printable value from session or an empty string for null.
-        *
-        * @param session Session instance
-        * @param key Key to get
-        * @return Value from key, empty string for null
-        */
-       @Override
-       public Object getPrintableValeFromSession (final HttpSession session, final String key) {
-               return this.app.getPrintableValeFromSession(session, key);
-       }
-
-       /**
-        * Some "getter" for a an array of only available products
-        *
-        * @return All products
-        */
-       @Override
-       public Iterator<Product> getAvailableProducts () throws ServletException {
-               return this.app.getAvailableProducts();
-       }
-
-       /**
-        * Some "getter" for a an array of all products
-        *
-        * @return All products
-        */
-       @Override
-       public Iterator<Product> getAllProducts () throws ServletException {
-               return this.app.getAllProducts();
-       }
-
-       /**
-        * Some "getter" for a an array of all categories
-        *
-        * @return All categories
-        */
-       @Override
-       public Iterator<Category> getAllCategories () throws ServletException {
-               return this.app.getAllCategories();
-       }
-
-       /**
-        * Some "getter" for total price of position from request or session.
-        * Single price and amount is multiplyed.
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @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);
-       }
-
-       /**
-        * Handler for amount from request or session
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Amount as string
-        */
-       @Override
-       @Deprecated
-       public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
-               return this.app.handleAmountFromRequestSession(product, request, session);
-       }
-
-       /**
-        * Checks whether the given product is choosen, request overules session.
-        *
-        * @param product Product instance
-        * @param request Request instance
-        * @param session Session instance
-        * @return Whether the product is choosen
-        */
-       @Override
-       @Deprecated
-       public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session) {
-               return this.app.isProductChoosen(product, request, session);
-       }
-
-       /**
-        * Marks all choosen products as ordered
-        *
-        * @param request Request instance
-        * @param session Session instance
-        */
-       @Override
-       @Deprecated
-       public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException {
-               this.app.markAllChoosenProductsAsOrdered(request, session);
-       }
-
-       /**
-        * Marks given product as choosen in session
-        *
-        * @param product Product to mark as ordered
-        * @param session Session instance
-        */
-       @Override
-       @Deprecated
-       public void markProductAsChoosen (final Product product, final HttpSession session) {
-               this.app.markProductAsChoosen(product, session);
-       }
-
-       /**
-        * Marks given product as ordered in session
-        *
-        * @param product Product to mark as ordered
-        * @param session Session instance
-        */
-       @Override
-       @Deprecated
-       public void markProductAsOrdered (final Product product, final HttpSession session) {
-               this.app.markProductAsOrdered(product, session);
-       }
-
-       /**
-        * Somewhat setter in session
-        *
-        * @param session Session instance
-        * @param key Session key to set
-        * @param value Value to set
-        */
-       @Override
-       public void setValueInSession (final HttpSession session, final String key, final Object value) {
-               this.app.setValueInSession(session, key, value);
-       }
-
-       /**
-        * Unmarks given product as choosen in session
-        *
-        * @param product Product to unmark as choosen
-        * @param session Session instance
-        */
-       @Override
-       @Deprecated
-       public void unmarkProductAsChoosen (final Product product, final HttpSession session) {
-               this.app.unmarkProductAsChoosen(product, session);
-       }
-
-       /**
-        * Unmarks given product as ordered in session
-        *
-        * @param product Product to unmark as ordered
-        * @param session Session instance
-        */
-       @Override
-       @Deprecated
-       public void unmarkProductAsOrdered (final Product product, final HttpSession session) {
-               this.app.unmarkProductAsOrdered(product, session);
-       }
-
-       @Override
-       public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
-               this.app.doAdminAddCategory(request);
-       }
-
-       @Override
-       public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
-               this.app.doAdminAddProduct(request);
-       }
-
-       @Override
-       public String generateLinkForParent (final Category category) {
-               return this.app.generateLinkForParent(category);
-       }
-
-       @Override
-       public String getPrintableProduktCategory (final Product product) throws ServletException {
-               return this.app.getPrintableProduktCategory(product);
-       }
-
-       @Override
-       public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
-               this.app.doAdminHandleProductForms(request, response);
-       }
-
-       @Override
-       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
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("basket={0} - EXIT!", this.basket)); //NOI18N
-
-               // Return it
-               return this.basket;
-       }
-
-       /**
-        * @param basket the basket to set
-        */
-       @Override
-       public void setBasket (final BasketBean basket) {
-               // Trace message
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("basket={0} - CALLED!", basket)); //NOI18N
-
-               // Set it here
-               this.basket = basket;
-       }
-
-       /**
-        * @return the application
-        */
-       @Override
-       public ServletContext getApplication () {
-               // Trace message
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("application={0} - EXIT!", this.application)); //NOI18N
-
-               // Return it
-               return this.application;
-       }
-
-       /**
-        * @param application the application to set
-        */
-       @Override
-       public void setApplication (final ServletContext application) {
-               // Trace message
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N
-
-               // Set it here
-               this.application = application;
-       }
-
-       @Override
-       public Product getProduct (final AddableBasketItem item) throws ServletException {
-               // Deligate to application
-               return this.app.getProduct(item);
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java
deleted file mode 100644 (file)
index 2365701..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.basket;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.util.Map;
-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;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * An interface for a basket bean
- *
- * @author Roland Haeder
- */
-public interface BasketBean extends Serializable {
-       /**
-        * Initializes this instance
-        * 
-        * @throws FacesException If something was wrong
-        */
-       public void init () throws FacesException;
-
-       /**
-        * Adds given item instance to this basket
-        * @param item Item instance to add
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public void addItem (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Checks if the basket is empty
-        *
-        * @return Whether the basket is empty
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Checks whether the given item as already been added. Mostly
-        * implementations may check the id number as this is mostly believed being
-        * unique.
-        *
-        * @param item Item instance to check
-        * @return Whether the given item has been found
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public boolean isItemAdded (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Returns an item for given product instance or null if the basket doesn't
-        * contain such item. Every product has an item id which is unique to it.
-        * The basket stores a session->itemId reference along with
-        * amount of the ordered item (aka. product).
-        * 
-        * @param product Product instance
-        * @return Item instance or null
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Getter for human-readable string from given key
-        *
-        * @param key Key to return
-        * @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);
-
-       /**
-        * Some "getter" for all entries in this basket
-        *
-        * @return Map on all basket items
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public Map<Long, AddableBasketItem> getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Getter for last entry
-        *
-        * @return Last added item in basket
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public AddableBasketItem getLast () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Getter for last num rows
-        * 
-        * @return Last num rows
-        */
-       public int getLastNumRows ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java
deleted file mode 100644 (file)
index ce19d15..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.basket;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.util.Map;
-import javax.annotation.PostConstruct;
-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;
-import org.mxchange.pizzaapplication.basket.Basket;
-import org.mxchange.pizzaapplication.basket.item.ItemBasket;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * A basket for orderable items
- *
- * @author Roland Haeder
- */
-@Named("basket")
-@SessionScoped
-public class ItemBasketBean implements BasketBean {
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 4384123923163957L;
-
-       /**
-        * Servlet context
-        */
-       @Inject
-       private ServletContext application;
-
-       /**
-        * Session
-        */
-       @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, IOException, BadTokenException {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-       }
-
-       @Override
-       public void addItem (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               this.basket.addItem(item);
-       }
-
-       @Override
-       public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               return this.basket.getItem(product);
-       }
-
-       @Override
-       public String getMessageStringFromKey (final String key) {
-               return this.basket.getMessageStringFromKey(key);
-       }
-
-       @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.getApplication(), this.getSession());
-               } catch (final UnsupportedDatabaseBackendException | IOException | SQLException | BadTokenException ex) {
-                       // Continue to throw
-                       throw new FaceletException(ex);
-               }
-       }
-
-       @Override
-       public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               return this.basket.isEmpty();
-       }
-
-       @Override
-       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;
-       }
-
-       @Override
-       public Map<Long, AddableBasketItem> getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate to basket instance
-               return this.basket.getAll();
-       }
-
-       @Override
-       public AddableBasketItem getLast () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Deligate to basket instance
-               return this.basket.getLast();
-       }
-
-       @Override
-       public int getLastNumRows () {
-               // Delegate to basket
-               return this.basket.getLastNumRows();
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java
new file mode 100644 (file)
index 0000000..ce1e6dd
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.controller;
+
+import java.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.jshop.beans.FrameworkBean;
+import org.mxchange.jshop.beans.basket.BasketBean;
+import org.mxchange.jshop.category.Category;
+import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.jshop.item.AddableBasketItem;
+import org.mxchange.jshop.product.Product;
+
+/**
+ *
+ * @author Roland Haeder
+ */
+public interface PizzaBean extends FrameworkBean {
+       /**
+        * Some "getter" for amount from session
+        *
+        * @param product Product instance
+        * @param session Session instance
+        * @return Amount as string
+        * @deprecated Old code
+        */
+       @Deprecated
+       public String getAmountFromSession (final Product product, final HttpSession session);
+
+       /**
+        * Some "getter" for choose from session
+        *
+        * @param product Product instance
+        * @param session Session instance
+        * @return Choose as string
+        * @deprecated Old code
+        */
+       @Deprecated
+       public String getChooseFromSession (final Product product, final HttpSession session);
+
+       /**
+        * Handler for amount from session
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Amount as string
+        * @deprecated Old code
+        */
+       @Deprecated
+       public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
+
+       /**
+        * Some "getter" for printable choosen (checkbox) from request or session
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Amount as string
+        * @deprecated Old code
+        */
+       @Deprecated
+       public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
+
+       /**
+        * Some "getter" for total price of position from request or session.
+        * Single price and amount is multiplyed.
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Amount as string
+        */
+       public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
+
+       /**
+        * Initializes this instance
+        * 
+        * @throws FacesException If something was wrong
+        */
+       public void init () throws FacesException;
+
+       /**
+        * Checks whether the given product is choosen, request overules session.
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Whether the product is choosen
+        * @deprecated Old lost code
+        */
+       @Deprecated
+       public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session);
+
+       /**
+        * Calculates total price of all choosen products
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @return Total price of all choosen products
+        * @throws javax.servlet.ServletException If something unexpected happened
+        */
+       public float calculateTotalPrice (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+       /**
+        * Calculates total amount of all choosen products
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @return Total amount of all choosen products
+        * @throws javax.servlet.ServletException If something unexpected happened
+        */
+       public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+       /**
+        * Some "getter" for HTML code 'checked="checked"' if the product is choosen
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Whether the product is choosen
+        */
+       public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session);
+
+       /**
+        * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @return Whether the product is choosen
+        * @throws javax.servlet.ServletException If something unexpected happened
+        */
+       public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+       /**
+        * Marks given product as ordered in session
+        *
+        * @param product Product to mark as ordered
+        * @param session Session instance
+        * @deprecated Old code
+        */
+       @Deprecated
+       public void markProductAsOrdered(final Product product, final HttpSession session);
+
+       /**
+        * Marks given product as choosen in session
+        *
+        * @param product Product to mark as ordered
+        * @param session Session instance
+        * @deprecated Old code
+        */
+       @Deprecated
+       public void markProductAsChoosen(final Product product, final HttpSession session);
+
+       /**
+        * Unmarks given product as ordered in session
+        *
+        * @param product Product to unmark as ordered
+        * @param session Session instance
+        * @deprecated Old code
+        */
+       @Deprecated
+       public void unmarkProductAsOrdered(final Product product, final HttpSession session);
+
+       /**
+        * Unmarks given product as choosen in session
+        *
+        * @param product Product to unmark as choosen
+        * @param session Session instance
+        * @deprecated Old code
+        */
+       @Deprecated
+       public void unmarkProductAsChoosen(final Product product, final HttpSession session);
+
+       /**
+        * Some getter for printable value from session or an empty string for null.
+        *
+        * @param session Session instance
+        * @param key Key to get
+        * @return Value from key, empty string for null
+        */
+       public Object getPrintableValeFromSession (final HttpSession session, final String key);
+
+       /**
+        * Somewhat setter in session
+        *
+        * @param session Session instance
+        * @param key Session key to set
+        * @param value Value to set
+        */
+       public void setValueInSession (final HttpSession session, final String key, final Object value);
+
+       /**
+        * Some "getter" for a an array of only available products
+        * 
+        * @return Only available products
+        * @throws javax.servlet.ServletException If anything went wrong
+        */
+       public Iterator<Product> getAvailableProducts () throws ServletException;
+
+       /**
+        * Some "getter" for a an array of all products
+        *
+        * @return All products
+        * @throws javax.servlet.ServletException If anything went wrong
+        */
+       public Iterator<Product> getAllProducts () throws ServletException;
+
+       /**
+        * Some "getter" for a an array of all categories
+        *
+        * @return All categories
+        * @throws javax.servlet.ServletException If anything went wrong
+        */
+       public Iterator<Category> getAllCategories () throws ServletException;
+
+       /**
+        * Checks if given Product instance is available and returns a printable
+        * (human-readable) string.
+        * 
+        * @param product Product instance to check
+        * @return Human-readable version of product availability
+        */
+       public String getPrintableProduktAvailability (final Product product);
+
+       /**
+        * Returns a printable (human-readable) string of product's category
+        * 
+        * @param product Product instance to check
+        * @return Human-readable version of product availability
+        * @throws javax.servlet.ServletException If something unexpected happened
+        */
+       public String getPrintableProduktCategory (final Product product) throws ServletException;
+
+       /**
+        * Marks all choosen products as ordered
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @throws javax.servlet.ServletException If something unexpected happened
+        * @deprecated Old code
+        */
+       @Deprecated
+       public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+       /**
+        * Adds given category data from request to database
+        *
+        * @param request Request instance
+        * @throws javax.servlet.ServletException If something unexpected happened
+        * @throws org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException If the given title is already used
+        */
+       public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
+
+       /**
+        * Adds given product data from request to database
+        *
+        * @param request Request instance
+        * @throws javax.servlet.ServletException If something unexpected happened
+        * @throws org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException If the given product title is already used
+        */
+       public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
+
+       /**
+        * Generates link HTML code for given category's parent id, if set. This
+        * link then points to products.jsp?category_id=x
+        *
+        * @param category Category instance
+        * @return HTML code
+        */
+       public String generateLinkForParent (final Category category);
+
+       /**
+        * Handles admin product form requests
+        *
+        * @param request Request instance
+        * @param response Response instance
+        * @throws ServletException If something unexpected happened
+        */
+       public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+
+       /**
+        * Handles admin category form requests
+        * 
+        * @param request Request instance
+        * @param response Response instance
+        * @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);
+
+       /**
+        * Some "getter" for a product from given item
+        * @param item Item instance
+        * @return A Product instance
+        * @throws javax.servlet.ServletException If something bad happens
+        */
+       public Product getProduct (final AddableBasketItem item) throws ServletException;
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java
new file mode 100644 (file)
index 0000000..115632a
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.controller;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.MessageFormat;
+import java.util.Iterator;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.inject.Named;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
+import org.mxchange.jshop.beans.BaseFrameworkBean;
+import org.mxchange.jshop.category.Category;
+import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.jshop.item.AddableBasketItem;
+import org.mxchange.jshop.product.Product;
+import org.mxchange.pizzaapplication.application.PizzaApplication;
+import org.mxchange.pizzaapplication.application.PizzaServiceApplication;
+
+/**
+ * Main application class
+ *
+ * @author Roland Haeder
+ */
+@Named("controller")
+@SessionScoped
+public class PizzaServiceBean extends BaseFrameworkBean implements PizzaBean {
+       /**
+        * Serial id
+        */
+       private static final long serialVersionUID = 58137539530279L;
+
+       /**
+        * Pizza application
+        */
+       private final PizzaApplication app;
+
+       /**
+        * Initializer block
+        */
+       {
+               // Get new application instance
+               this.getLogger().debug("INITIALIZER!"); //NOI18N
+               this.app = new PizzaServiceApplication();
+       }
+
+       /**
+        * Default constructor
+        */
+       public PizzaServiceBean () {
+               this.getLogger().trace("CALLED!"); //NOI18N
+       }
+
+       @Override
+       @PostConstruct
+       public void init () throws FacesException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("application={0},basket={1} - CALLED!", this.getApplication(), this.getBasket())); //NOI18N
+
+               // Must not be null
+               if (this.getApplication() == null) {
+                       // Abort here
+                       throw new NullPointerException("application is null"); //NOI18N
+               }
+
+               try {
+                       // Call init method
+                       this.app.init(this.getApplication());
+               } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) {
+                       // Continue to throw
+                       throw new FacesException(ex);
+               }
+       }
+
+       /**
+        * Calculates total amount of all choosen products
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @return Total amount of all choosen products
+        */
+       @Override
+       public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException {
+               return this.app.calculateTotalAmount(request, session);
+       }
+
+       /**
+        * Calculates total price of all choosen products
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @return Total price of all choosen products
+        */
+       @Override
+       public float calculateTotalPrice (final HttpServletRequest request, final HttpSession session) throws ServletException {
+               return this.app.calculateTotalPrice(request, session);
+       }
+
+       /**
+        * Some "getter" for amount from session
+        *
+        * @param product Product instance
+        * @param session Session instance
+        * @return Amount as string
+        */
+       @Override
+       @Deprecated
+       public String getAmountFromSession (final Product product, final HttpSession session) {
+               return this.app.getAmountFromSession(product, session);
+       }
+
+       /**
+        * Some "getter" for HTML code 'checked="checked"' if the product is choosen
+        * 
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Whether the product is choosen
+        */
+       @Override
+       public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session) {
+               return this.app.getCheckedHtmlFromProduct(product, request, session);
+       }
+
+       /**
+        * Some "getter" for choose from session
+        * 
+        * @param product Product instance
+        * @param session Session instance
+        * @return Choose as string
+        */
+       @Override
+       @Deprecated
+       public String getChooseFromSession (final Product product, final HttpSession session) {
+               return this.app.getChooseFromSession(product, session);
+       }
+
+       /**
+        * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
+        *
+        * @param request Request instance
+        * @param session Session instance
+        * @return Whether the product is choosen
+        */
+       @Override
+       public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException {
+               return this.app.getDisabledHtmlFromSession(request, session);
+       }
+
+       /**
+        * Some "getter" for choosen (checkbox) from session
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Amount as string
+        */
+       @Override
+       @Deprecated
+       public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
+               return this.app.getPrintableChoosenFromRequestSession(product, request, session);
+       }
+
+       /**
+        * Checks if given Product instance is available and returns a printable
+        * (human-readable) string.
+        * 
+        * @param product Product instance to check
+        * @return Human-readable version of product availability
+        */
+       @Override
+       public String getPrintableProduktAvailability (final Product product) {
+               return this.app.getPrintableProduktAvailability(product);
+       }
+
+       /**
+        * Some getter for printable value from session or an empty string for null.
+        *
+        * @param session Session instance
+        * @param key Key to get
+        * @return Value from key, empty string for null
+        */
+       @Override
+       public Object getPrintableValeFromSession (final HttpSession session, final String key) {
+               return this.app.getPrintableValeFromSession(session, key);
+       }
+
+       /**
+        * Some "getter" for a an array of only available products
+        *
+        * @return All products
+        */
+       @Override
+       public Iterator<Product> getAvailableProducts () throws ServletException {
+               return this.app.getAvailableProducts();
+       }
+
+       /**
+        * Some "getter" for a an array of all products
+        *
+        * @return All products
+        */
+       @Override
+       public Iterator<Product> getAllProducts () throws ServletException {
+               return this.app.getAllProducts();
+       }
+
+       /**
+        * Some "getter" for a an array of all categories
+        *
+        * @return All categories
+        */
+       @Override
+       public Iterator<Category> getAllCategories () throws ServletException {
+               return this.app.getAllCategories();
+       }
+
+       /**
+        * Some "getter" for total price of position from request or session.
+        * Single price and amount is multiplyed.
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @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);
+       }
+
+       /**
+        * Handler for amount from request or session
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Amount as string
+        */
+       @Override
+       @Deprecated
+       public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
+               return this.app.handleAmountFromRequestSession(product, request, session);
+       }
+
+       /**
+        * Checks whether the given product is choosen, request overules session.
+        *
+        * @param product Product instance
+        * @param request Request instance
+        * @param session Session instance
+        * @return Whether the product is choosen
+        */
+       @Override
+       @Deprecated
+       public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session) {
+               return this.app.isProductChoosen(product, request, session);
+       }
+
+       /**
+        * Marks all choosen products as ordered
+        *
+        * @param request Request instance
+        * @param session Session instance
+        */
+       @Override
+       @Deprecated
+       public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException {
+               this.app.markAllChoosenProductsAsOrdered(request, session);
+       }
+
+       /**
+        * Marks given product as choosen in session
+        *
+        * @param product Product to mark as ordered
+        * @param session Session instance
+        */
+       @Override
+       @Deprecated
+       public void markProductAsChoosen (final Product product, final HttpSession session) {
+               this.app.markProductAsChoosen(product, session);
+       }
+
+       /**
+        * Marks given product as ordered in session
+        *
+        * @param product Product to mark as ordered
+        * @param session Session instance
+        */
+       @Override
+       @Deprecated
+       public void markProductAsOrdered (final Product product, final HttpSession session) {
+               this.app.markProductAsOrdered(product, session);
+       }
+
+       /**
+        * Somewhat setter in session
+        *
+        * @param session Session instance
+        * @param key Session key to set
+        * @param value Value to set
+        */
+       @Override
+       public void setValueInSession (final HttpSession session, final String key, final Object value) {
+               this.app.setValueInSession(session, key, value);
+       }
+
+       /**
+        * Unmarks given product as choosen in session
+        *
+        * @param product Product to unmark as choosen
+        * @param session Session instance
+        */
+       @Override
+       @Deprecated
+       public void unmarkProductAsChoosen (final Product product, final HttpSession session) {
+               this.app.unmarkProductAsChoosen(product, session);
+       }
+
+       /**
+        * Unmarks given product as ordered in session
+        *
+        * @param product Product to unmark as ordered
+        * @param session Session instance
+        */
+       @Override
+       @Deprecated
+       public void unmarkProductAsOrdered (final Product product, final HttpSession session) {
+               this.app.unmarkProductAsOrdered(product, session);
+       }
+
+       @Override
+       public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
+               this.app.doAdminAddCategory(request);
+       }
+
+       @Override
+       public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
+               this.app.doAdminAddProduct(request);
+       }
+
+       @Override
+       public String generateLinkForParent (final Category category) {
+               return this.app.generateLinkForParent(category);
+       }
+
+       @Override
+       public String getPrintableProduktCategory (final Product product) throws ServletException {
+               return this.app.getPrintableProduktCategory(product);
+       }
+
+       @Override
+       public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
+               this.app.doAdminHandleProductForms(request, response);
+       }
+
+       @Override
+       public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
+               this.app.doAdminHandleCategoryForms(request, response);
+       }
+
+       @Override
+       public Product getProduct (final AddableBasketItem item) throws ServletException {
+               // Deligate to application
+               return this.app.getProduct(item);
+       }
+}
index 238c15b31a6d824596ebdcd0d94655cdccf07541..ffe424ab282040705ceb9c7b5bcabe1857c17618 100644 (file)
  */
 package org.mxchange.pizzaapplication.beans.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;
+import org.mxchange.jshop.beans.FrameworkBean;
 
 /**
  * An interface for customer beans
  *
  * @author Roland Haeder
  */
-public interface CustomerBean extends Serializable {
+public interface CustomerBean extends FrameworkBean {
        /**
         * Returns an iterator of all values from this object
         *
index 327a88f91750479866b1091149f199d580e594e0..901ac079dc3c1510438996176820c10983c946f6 100644 (file)
@@ -25,7 +25,7 @@ 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.jshop.beans.BaseFrameworkBean;
 import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
 
 /**
@@ -35,7 +35,7 @@ import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
  */
 @Named("customer")
 @SessionScoped
-public class PizzaServiceCustomerBean implements CustomerBean {
+public class PizzaServiceCustomerBean extends BaseFrameworkBean implements CustomerBean {
        /**
         * Serial number
         */
diff --git a/src/java/org/mxchange/pizzaapplication/beans/item/BasketItemBean.java b/src/java/org/mxchange/pizzaapplication/beans/item/BasketItemBean.java
deleted file mode 100644 (file)
index 458ede0..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.basket;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-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.beans.item.ItemBean;
-
-/**
- * A bean for basket items
- *
- * @author Roland Haeder
- */
-@Named("item")
-@SessionScoped
-public class BasketItemBean implements ItemBean {
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 324813539158845L;
-
-       /**
-        * Class' logger
-        */
-       private final Logger LOG;
-
-       /**
-        * Instance of wrapped basket
-        */
-       @Inject
-       private BasketBean basket;
-
-       /**
-        * Initializer block
-        */
-       {
-               // Get logger
-               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 BasketItemBean () throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-       }
-
-       /**
-        * Getter for logger
-        *
-        * @return Logger
-        */
-       @Override
-       public Logger getLogger () {
-               return this.LOG;
-       }
-
-       /**
-        * @return the basket
-        */
-       @Override
-       public BasketBean getBasket () {
-               // Trace message
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("basket={0} - EXIT!", this.basket)); //NOI18N
-
-               // Return it
-               return this.basket;
-       }
-
-       /**
-        * @param basket the basket to set
-        */
-       @Override
-       public void setBasket (final BasketBean basket) {
-               // Trace message
-               //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("basket={0} - CALLED!", basket)); //NOI18N
-
-               // Set it here
-               this.basket = basket;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/item/ItemBean.java b/src/java/org/mxchange/pizzaapplication/beans/item/ItemBean.java
deleted file mode 100644 (file)
index 05fcaf9..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.beans.item;
-
-import java.io.Serializable;
-import org.apache.logging.log4j.Logger;
-import org.mxchange.pizzaapplication.beans.basket.BasketBean;
-
-/**
- * An interface for an item bean
- *
- * @author Roland Haeder
- */
-public interface ItemBean extends Serializable {
-       /**
-        * @return the basket
-        */
-       public BasketBean getBasket ();
-
-       /**
-        * @param basket the basket to set
-        */
-       public void setBasket (final BasketBean basket);
-
-       /**
-        * Getter for logger
-        *
-        * @return Logger
-        */
-       public Logger getLogger ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/category/BaseCategory.java b/src/java/org/mxchange/pizzaapplication/category/BaseCategory.java
deleted file mode 100644 (file)
index 337504b..0000000
+++ /dev/null
@@ -1,191 +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.category;
-
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Objects;
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- * A general product category class
- *
- * @author Roland Haeder
- */
-public class BaseCategory extends BaseFrameworkSystem implements Category {
-       /**
-        * Id number of category
-        */
-       private Long categoryId;
-
-       /**
-        * Parent category categoryId
-        */
-       private Long parent;
-
-       /**
-        * Title of category
-        */
-       private String title;
-
-       /**
-        * Constructor which accepts all database fields
-        * @param id Id number of database record
-        * @param title Category title
-        * @param parent Parent categoryId
-        */
-       protected BaseCategory (final Long id, final String title, final Long parent) {
-               // Set all here
-               this.setCategoryId(id);
-               this.setTitle(title);
-               this.setParent(parent);
-       }
-
-       /**
-        * Default constructor
-        */
-       protected BaseCategory () {
-       }
-
-       /**
-        * Compares two categories with each other
-        *
-        * @param category Category comparator
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final Category category) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N
-               
-               // category should not be null
-               if (null == category) {
-                       throw new NullPointerException("category is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("this.id={0},category.id={1}", this.getCategoryId(), category.getCategoryId())); //NOI18N
-
-               // Is the categoryId the same?
-               if (Objects.equals(this.getCategoryId(), category.getCategoryId())) {
-                       // Same categoryId, means same category
-                       return 0;
-               } else if (this.getCategoryId() > category.getCategoryId()) {
-                       // This categoryId is larger than compared to
-                       return -1;
-               }
-
-               // The other categoryId is larger
-               return 1;
-       }
-
-       /**
-        * Decodes the UTF8-encoded title
-        *
-        * @return Decoded title
-        */
-       @Override
-       public final String getDecodedTitle () throws UnsupportedEncodingException {
-               // Get title
-               byte[] t = this.getTitle().getBytes();
-               
-               // Decode it
-               return new String(t, "UTF-8"); //NOI18N
-       }
-
-       /**
-        * Id number of category
-        * @return the categoryId
-        */
-       @Override
-       public final Long getCategoryId () {
-               return this.categoryId;
-       }
-
-       /**
-        * Id number of category
-        * @param categoryId the categoryId to set
-        */
-       @Override
-       public final void setCategoryId (final Long categoryId) {
-               this.categoryId = categoryId;
-       }
-
-       /**
-        * Parent category categoryId
-        * @return the parent
-        */
-       @Override
-       public final Long getParent () {
-               return this.parent;
-       }
-
-       /**
-        * Parent category categoryId
-        * @param parent the parent to set
-        */
-       @Override
-       public final void setParent (final Long parent) {
-               this.parent = parent;
-       }
-
-       /**
-        * Title of category
-        * @return the title
-        */
-       @Override
-       public final String getTitle () {
-               return this.title;
-       }
-
-       /**
-        * Title of category
-        * @param title the title to set
-        */
-       @Override
-       public final void setTitle (final String title) {
-               this.title = title;
-       }
-
-       @Override
-       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N
-
-               // Call super method
-               Object value = this.getValueInStorableFromColumn(this, "BaseCategory", columnName); //NOI18N
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value)); //NOI18N
-
-               // Return value
-               return value;
-       }
-
-       @Override
-       public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value)); //NOI18N
-               
-               // Call super method
-               this.setValueInStorableFromColumn(this, "BaseCategory", columnName, value); //NOI18N
-               
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/category/Category.java b/src/java/org/mxchange/pizzaapplication/category/Category.java
deleted file mode 100644 (file)
index d04f2ec..0000000
+++ /dev/null
@@ -1,80 +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.category;
-
-import java.io.UnsupportedEncodingException;
-import org.mxchange.jcore.database.storage.Storable;
-
-/**
- * An interface for categories
- *
- * @author Roland Haeder
- */
-public interface Category extends Storable, Comparable<Category> {
-
-       /**
-        * Id number of category
-        * @return the id
-        */
-       public Long getCategoryId ();
-
-       /**
-        * Id number of category
-        * @param id the id to set
-        */
-       public void setCategoryId (final Long id);
-
-       /**
-        * Parent category id
-        * @return the parent
-        */
-       public Long getParent ();
-
-       /**
-        * Parent category id
-        * @param parent the parent to set
-        */
-       public void setParent (final Long parent);
-
-       /**
-        * Title of category
-        * @return the title
-        */
-       public String getTitle ();
-
-       /**
-        * Title of category
-        * @param title the title to set
-        */
-       public void setTitle (final String title);
-
-       /**
-        * Compare method
-        * @param category Category to compare to
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final Category category);
-
-       /**
-        * Decodes the UTF8-encoded title
-        *
-        * @return Decoded title
-        * @throws java.io.UnsupportedEncodingException If the encoding UTF-8 is not supported
-        */
-       public String getDecodedTitle () throws UnsupportedEncodingException ;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/category/product/ProductCategory.java b/src/java/org/mxchange/pizzaapplication/category/product/ProductCategory.java
deleted file mode 100644 (file)
index 8cf7844..0000000
+++ /dev/null
@@ -1,42 +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.category.product;
-
-import org.mxchange.pizzaapplication.category.BaseCategory;
-
-/**
- * A product category
- * @author Roland Haeder
- */
-public class ProductCategory extends BaseCategory {
-       /**
-        * Constructor which accepts all database fields
-        * @param id Id number of database record
-        * @param title Category title
-        * @param parent Parent id
-        */
-       public ProductCategory (final Long id, final String title, final Long parent) {
-               // Call parent constructor
-               super(id, title, parent);
-       }
-
-       /**
-        * Default constructor
-        */
-       public ProductCategory () {
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/basket/BasketDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/database/basket/BasketDatabaseConstants.java
deleted file mode 100644 (file)
index 91ede81..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.basket;
-
-/**
- * Constants for table "basket".
- *
- * @author Roland Haeder
- */
-public final class BasketDatabaseConstants {
-       /**
-        * Column for id
-        */
-       public static final String COLUMN_ID = "id"; //NOI18N
-
-       /**
-        * Column for amount
-        */
-       public static final String COLUMN_AMOUNT = "amount"; //NOI18N
-
-       /**
-        * Column for product id
-        */
-       public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N
-
-       /**
-        * Column for product type
-        */
-       public static final String COLUMN_ITEM_TYPE = "item_type"; //NOI18N
-
-       /**
-        * Column for session id or any unique identifier
-        */
-       public static final String COLUMN_SESSION_ID = "session_id"; //NOI18N
-
-       /**
-        * No instance from this class
-        */
-       private BasketDatabaseConstants () {
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketDatabaseFrontend.java
deleted file mode 100644 (file)
index 9b7f643..0000000
+++ /dev/null
@@ -1,547 +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.frontend.basket;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import org.mxchange.jcore.criteria.logical.and.AndLogicalMatcher;
-import org.mxchange.jcore.criteria.searchable.SearchCriteria;
-import org.mxchange.jcore.criteria.searchable.SearchableCriteria;
-import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
-import org.mxchange.jcore.database.result.Result;
-import org.mxchange.jcore.database.storage.Storable;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.database.basket.BasketDatabaseConstants;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.item.basket.BasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * A database frontend for baskets
- *
- * @author Roland Haeder
- */
-public class BasketDatabaseFrontend extends BaseDatabaseFrontend implements BasketFrontend {
-       /**
-        * General constructor
-        * 
-        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend was configured
-        * @throws java.sql.SQLException If any SQL error occurs
-        */
-       public BasketDatabaseFrontend () throws UnsupportedDatabaseBackendException, SQLException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Set "table" name
-               this.setTableName("basket"); //NOI18N
-
-               // Initalize backend
-               this.initBackend();
-       }
-
-       @Override
-       public void addItem (final AddableBasketItem item, final String sessionId) throws SQLException, IOException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("item={0},sessionId={1} - CALLED!", item, sessionId));
-
-               // Both must not be null
-               if (null == item) {
-                       // Product is null
-                       throw new NullPointerException("item is null"); //NOI18N
-               } else if (null == sessionId) {
-                       // Session id is null
-                       throw new NullPointerException("sessionId is null"); //NOI18N
-               } else if (sessionId.isEmpty()) {
-                       // Session id should not be empty
-                       throw new IllegalArgumentException("sessionId is empty."); //NOI18N
-               }
-
-               // Clear previous data set
-               this.clearDataSet();
-
-               // Add item it and session
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_ID, item.getItemId());
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_AMOUNT, item.getAmount());
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_TYPE, item.getItemType());
-
-               // Handle this over to the backend
-               // @todo Nothing is done yet!
-               Result<? extends Storable> result = this.doInsertDataSet();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Shuts down the database layer
-        *
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws java.io.IOException If any IO error occurs
-        */
-       @Override
-       public void doShutdown () throws SQLException, IOException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Shutdown backend
-               this.getBackend().doShutdown();
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Depending on column, an empty value may be converted to null
-        *
-        * @param key Key to check
-        * @param value Value to check
-        * @return Possible previous value or null
-        * @todo Nothing will be changed now
-        */
-       @Override
-       public Object emptyStringToNull (final String key, final Object value) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
-
-               // Copy value
-               Object v = value;
-
-               // Is the value empty?
-               if ((value instanceof String) && ("".equals(value))) { //NOI18N
-                       // This value may need to be changed
-                       switch (key) {
-                       }
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("v={0} - EXIT!", v)); //NOI18N
-
-               // Return it
-               return v;
-       }
-
-       @Override
-       public String getIdName () {
-               return BasketDatabaseConstants.COLUMN_ID;
-       }
-
-       @Override
-       public AddableBasketItem getItem (final Product product, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("product={0},sessionId={1} - CALLED!", product, sessionId)); //NOI18N
-
-               // Now search for it
-               Result<? extends Storable> result = this.getResultFromProduct(product, sessionId);
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result({0})={1}", result.size(), result)); //NOI18N
-
-               // Init item variable
-               AddableBasketItem item = null;
-
-               // Was an entry found?
-               if (result.hasNext()) {
-                       // Found one entry
-                       Storable storeable = result.next();
-
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("storeable={0}", storeable)); //NOI18N
-
-                       // Is it instance of Category?
-                       if (storeable instanceof AddableBasketItem) {
-                               // Then cast it
-                               item = (AddableBasketItem) storeable;
-                       }
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("item={0} - EXIT!", item)); //NOI18N
-
-               // Return item
-               return item;
-       }
-
-/*
-               // Clear data set
-               this.clearDataSet();
-
-               // Add data to set
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_ID, id);
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
-*/
-
-       @Override
-       public Storable getStorableAtRow (final int rowIndex) {
-               throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: rowIndex={0}", rowIndex));
-       }
-
-       @Override
-       public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-
-               // Session should be set here
-               if (this.getSessionId() == null) {
-                       // Abort here
-                       throw new NullPointerException("sessionId is null");
-               }
-
-               // Init search instance
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add session id and product id and limit to 1
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, this.getSessionId());
-               criteria.setLimit(1);
-
-               // Get result back
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Is it empty?
-               boolean isEmpty = (!result.hasNext());
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("isEmpty={0} - EXIT!", isEmpty));
-
-               // Return it
-               return isEmpty;
-       }
-
-       @Override
-       public boolean isItemAdded (final AddableBasketItem item, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("item={0},sessionId={1} - CALLED!", item, sessionId)); //NOI18N
-
-               // Get result back
-               Result<? extends Storable> result = this.getResultFromItem(item, sessionId);
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("result.hasNext()={0} - EXIT!", result.hasNext())); //NOI18N
-
-               // Return hasNext()
-               return result.hasNext();
-       }
-
-       @Override
-       public Storable toStorable (final Map<String, String> map) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("map={0} - CALLED!", map)); //NOI18N
-
-               // Is map null?
-               if (null == map) {
-                       // Is null
-                       throw new NullPointerException("map is null"); //NOI18N
-               } else if (map.isEmpty()) {
-                       // Map is empty
-                       throw new IllegalArgumentException("map is empty."); //NOI18N
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("Has to handle {0} entries", map.size())); //NOI18N
-
-               // Get iterator on all entries
-               Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
-
-               // Init object instance
-               Storable instance = new BasketItem();
-
-               // Iterate over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       Map.Entry<String, String> entry = iterator.next();
-
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("entry:{0}={1}", entry.getKey(), entry.getValue())); //NOI18N
-
-                       // Try to set value
-                       instance.setValueFromColumn(entry.getKey(), entry.getValue());
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("instance={0} - EXIT!", instance)); //NOI18N
-
-               // Return it
-               return instance;
-       }
-
-       /**
-        * Some "getter" for a result instance from given product and session id
-        *
-        * @param product Product instance
-        * @param sessionId Session id or any unique identifier
-        * @return Result instance
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       private Result<? extends Storable> getResultFromProduct (final Product product, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("product={0},sessionId={1} - CALLED!", product, sessionId)); //NOI18N
-
-               // Both must not be null
-               if (null == product) {
-                       // Product is null
-                       throw new NullPointerException("product is null"); //NOI18N
-               } else if (null == sessionId) {
-                       // Session id is null
-                       throw new NullPointerException("sessionId is null"); //NOI18N
-               } else if (sessionId.isEmpty()) {
-                       // Session id should not be empty
-                       throw new IllegalArgumentException("sessionId is empty."); //NOI18N
-               }
-
-               // Get product id
-               Long id = product.getItemId();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("id={0}", id)); //NOI18N
-
-               // Id should be > 0 here
-               assert(id > 0) : MessageFormat.format("Id for product {0} is below zero: {1}", product, id); //NOI18N
-
-               // Prepare search instance
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add session id and product id and limit to 1
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_ITEM_ID, id);
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
-               criteria.setLimit(1);
-
-               // Set AND logical matcher
-               criteria.setLogical(new AndLogicalMatcher());
-
-               // Now search for it
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Trace message
-               this.getLogger().debug(MessageFormat.format("result={0} - EXIT!", result)); //NOI18N
-
-               // Return it
-               return result;
-       }
-
-       /**
-        * Some "getter" for a result instance from given item and session id
-        *
-        * @param item Item instance
-        * @param sessionId Session id or any unique identifier
-        * @return Result instance
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       private Result<? extends Storable> getResultFromItem (final AddableBasketItem item, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("item={0},sessionId={1} - CALLED!", item, sessionId)); //NOI18N
-
-               // Both must not be null
-               if (null == item) {
-                       // Item is null
-                       throw new NullPointerException("item is null"); //NOI18N
-               } else if (null == sessionId) {
-                       // Session id is null
-                       throw new NullPointerException("sessionId is null"); //NOI18N
-               } else if (sessionId.isEmpty()) {
-                       // Session id should not be empty
-                       throw new IllegalArgumentException("sessionId is empty."); //NOI18N
-               }
-
-               // Get product id
-               Long id = item.getItemId();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("id={0}", id)); //NOI18N
-
-               // Id should be > 0 here
-               assert(id > 0) : MessageFormat.format("Id for item {0} is below zero: {1}", item, id); //NOI18N
-
-               // Prepare search instance
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add session id and product id and limit to 1
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_ITEM_ID, id);
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
-               criteria.setLimit(1);
-
-               // Add logical matcher
-               criteria.setLogical(new AndLogicalMatcher());
-
-               // Now search for it
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Trace message
-               this.getLogger().debug(MessageFormat.format("result={0} - EXIT!", result)); //NOI18N
-
-               // Return it
-               return result;
-       }
-
-       @Override
-       public Map<Long, AddableBasketItem> getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-
-               // Session should be set here
-               if (this.getSessionId() == null) {
-                       // Abort here
-                       throw new NullPointerException("sessionId is null");
-               }
-
-               // Init seaerch instance
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add only session id
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, this.getSessionId());
-
-               // Now run it on backend
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Now convert it to a map
-               Set<? extends Storable> set = result.resultSet();
-
-               // Debug message
-               this.getLogger().debug("set=" + set);
-
-               // Init map
-               Map<Long, AddableBasketItem> map = new LinkedHashMap<>(set.size());
-
-               // Add all entries
-               for (final Storable storeable : set) {
-                       // Debug message
-                       this.getLogger().debug("storeable=" + storeable);
-
-                       // Check on AddableBasketItem
-                       if (!(storeable instanceof AddableBasketItem)) {
-                               // Not correct instance
-                               throw new IllegalStateException("storeable=" + storeable + " does not implement AddableBasketItem.");
-                       }
-
-                       // Get id
-                       Long id = ((AddableBasketItem) storeable).getItemId();
-
-                       // Debug message
-                       this.getLogger().debug("id=" + id);
-
-                       // Add it
-                       map.put(id, (AddableBasketItem) storeable);
-               }
-
-               // Trace message
-               this.getLogger().trace("map=" + map + " - EXIT!");
-
-               // Return it
-               return map;
-       }
-
-       @Override
-       public AddableBasketItem getLast () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-
-               // Session should be set here
-               if (this.getSessionId() == null) {
-                       // Abort here
-                       throw new NullPointerException("sessionId is null");
-               }
-
-               // Init seaerch instance
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add only session id
-               criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, this.getSessionId());
-
-               // Get number of rows
-               int rows = this.getBackend().numRows(criteria);
-
-               // Debug message
-               this.getLogger().debug("rows=" + rows);
-
-               // Nothing found?
-               if (rows == 0) {
-                       // Debug message
-                       this.getLogger().debug("Nothing found, returning null ... - EXIT!");
-
-                       // Return null
-                       return null;
-               }
-
-               // Debug message
-               this.getLogger().debug("rows=" + rows);
-
-               // Set last num rows
-               this.setLastNumRows(rows);
-
-               // Now set this -1 as skip value and limit to 1
-               criteria.setSkip(rows);
-               criteria.setLimit(1);
-
-               // And run it ...
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug message
-               this.getLogger().debug("result=" + result);
-
-               // Init instance
-               AddableBasketItem item;
-
-               // There should be something!
-               if (!result.hasNext()) {
-                       // Something isn't working here ...
-                       throw new IllegalStateException("result has zero entries, but rows=" + rows);
-               }
-
-               // Get next element
-               Storable storeable = result.next();
-
-               // Is it still castable?
-               if (!(storeable instanceof AddableBasketItem)) {
-                       // Opps!
-                       throw new IllegalStateException("storeable=" + storeable + " does not implement AddableBasketItem.");
-               }
-
-               // Cast it
-               item = (AddableBasketItem) storeable;
-
-               // Trace message
-               this.getLogger().trace("item=" + item + " - EXIT!");
-
-               // Return it
-               return item;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketFrontend.java
deleted file mode 100644 (file)
index 75391e8..0000000
+++ /dev/null
@@ -1,119 +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.frontend.basket;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.util.Map;
-import org.mxchange.jcore.database.frontend.DatabaseFrontend;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * An interface for basket database frontends
- *
- * @author Roland Haeder
- */
-public interface BasketFrontend extends DatabaseFrontend {
-       /**
-        * Adds given item instance to database. Please note that the item's id
-        * comes from product table.
-        *
-        * @param item Item instance to add
-        * @param sessionId Session id or any other unique identifier
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        */
-       public void addItem (final AddableBasketItem item, final String sessionId) throws IOException, SQLException;
-
-       /**
-        * Gets an item instance for given Product instance
-        *
-        * @param product Prodduct instance
-        * @param sessionId Session id or any other unique identifier
-        * @return An item instance
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public AddableBasketItem getItem (final Product product, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Checks if the basket is empty
-        *
-        * @return Whether the basket is empty
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Checks if given item instance is found in basket by its id number.
-        *
-        * @param item Item instance to check
-        * @param sessionId Session id or any other unique identifier
-        * @return Whether the item is already added to the basket
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public boolean isItemAdded (final AddableBasketItem item, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Some "getter" for all entries in this basket
-        *
-        * @return Map on all basket items
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public Map<Long, AddableBasketItem> getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Getter for last entry
-        *
-        * @return Last added item in basket
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the invoked method is not public
-        * @throws java.lang.reflect.InvocationTargetException If anything else happened?
-        */
-       public AddableBasketItem getLast () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java
deleted file mode 100644 (file)
index 43a2cdc..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Häder
- *
- * 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.frontend.category;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.util.Iterator;
-import org.mxchange.jcore.database.frontend.DatabaseFrontend;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.pizzaapplication.category.Category;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * An interface for product database frontends
- *
- * @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
-        * selected.
-        *
-        * @param title Title of category
-        * @param parent Parent id or null if not selected
-        * @throws java.sql.SQLException If any SQL error occurs
-        * @throws java.io.IOException If an IO error occurs
-        */
-       public void addCategory (final String title, final Integer parent) throws SQLException, IOException;
-
-       /**
-        * An iterator on all categories
-        *
-        * @return Iterator on all categories
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public Iterator<Category> getAllCategories () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-
-       /**
-        * Checks if given category title is already used
-        *
-        * @param title Title to check
-        * @return Whether the title has been used
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-
-       /**
-        * Gets a Category instance for given Product instance.
-        *
-        * @param product Product instance
-        * @return A category instance
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL error occurs
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public Category getCategory (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java
deleted file mode 100644 (file)
index 0afecbc..0000000
+++ /dev/null
@@ -1,377 +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.frontend.category;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.Map;
-import org.mxchange.jcore.criteria.searchable.SearchCriteria;
-import org.mxchange.jcore.criteria.searchable.SearchableCriteria;
-import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
-import org.mxchange.jcore.database.result.DatabaseResult;
-import org.mxchange.jcore.database.result.Result;
-import org.mxchange.jcore.database.storage.Storable;
-import org.mxchange.jcore.exceptions.BadTokenException;
-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.product.Product;
-
-/**
- * Stores and retrieves Contact instances
- *
- * @author Roland Haeder
- */
-public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implements CategoryFrontend {
-
-       /**
-        * Default constrcutor
-        *
-        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the configured backend is not supported
-        * @throws java.sql.SQLException If any SQL error occurs
-        */
-       public PizzaCategoryDatabaseFrontend () throws UnsupportedDatabaseBackendException, SQLException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Set "table" name
-               this.setTableName("category"); //NOI18N
-
-               // Initalize backend
-               this.initBackend();
-       }
-
-       /**
-        * Adds given category title as new category, parent may be null if not
-        * selected.
-        *
-        * @param title Title of category
-        * @param parent Parent id or null if not selected
-        */
-       @Override
-       public void addCategory (final String title, final Integer parent) throws SQLException, IOException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("title={0},parent={1} - CALLED!", title, parent)); //NOI18N
-
-               // Title should not be null
-               if (null == title) {
-                       // Abort here
-                       throw new NullPointerException("title is null"); //NOI18N
-               }
-
-               // Clear dataset from previous usage
-               this.clearDataSet();
-
-               // Add title and parent
-               this.addToDataSet(CategoryFrontend.COLUMN_TITLE, title);
-               this.addToDataSet(CategoryFrontend.COLUMN_PARENT, parent);
-
-               // Handle this over to the backend
-               // @todo Nothing is done yet!
-               Result<? extends Storable> result = this.doInsertDataSet();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Shuts down the database layer
-        *
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws java.io.IOException If any IO error occurs
-        */
-       @Override
-       public void doShutdown () throws SQLException, IOException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Shutdown backend
-               this.getBackend().doShutdown();
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Depending on column, an empty value may be converted to null
-        *
-        * @param key Key to check
-        * @param value Value to check
-        * @return Possible previous value or null
-        */
-       @Override
-       public Object emptyStringToNull (final String key, final Object value) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
-
-               // Copy value
-               Object v = value;
-
-               // Is the value empty?
-               if ((value instanceof String) && ("".equals(value))) { //NOI18N
-                       // This value may need to be changed
-                       switch (key) {
-                               case CategoryFrontend.COLUMN_PARENT: // Convert this
-                                       v = null;
-                                       break;
-                       }
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("v={0} - EXIT!", v)); //NOI18N
-
-               // Return it
-               return v;
-       }
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public Iterator<Category> getAllCategories () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Instance search criteria
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Run the query
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Get iterator
-               Iterator<?> iterator = result.iterator();
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("iterator={0} - EXIT!", iterator)); //NOI18N
-
-               // Get iterator and return it
-               return (Iterator<Category>) iterator;
-       }
-
-       @Override
-       public Category getCategory (final Product product) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
-
-               // product must not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-
-               // Get category id from it
-               Long id = product.getCategory();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("id={0}", id)); //NOI18N
-
-               // It should be >0 here
-               assert (id > 0) : MessageFormat.format("id={0} must be larger zero", id); //NOI18N
-
-               // Then construct a search instance
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add id to it
-               criteria.addCriteria(CategoryFrontend.COLUMN_ID, id);
-
-               // Only one entry is find
-               criteria.setLimit(1);
-
-               // Run it on backend
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug log
-               this.getLogger().debug(MessageFormat.format("result({0})={1}", result, result.size())); //NOI18N
-
-               // Init category instance
-               Category category = null;
-
-               // Is there one entry?
-               if (result.hasNext()) {
-                       // Read result from it
-                       Storable storeable = result.next();
-
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("storeable={0}", storeable)); //NOI18N
-
-                       // Is it instance of Category?
-                       if (storeable instanceof Category) {
-                               // Then cast it
-                               category = (Category) storeable;
-                       }
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("category={0} - EXIT!", category)); //NOI18N
-
-               // Return it
-               return category;
-       }
-
-       @Override
-       public String getIdName () {
-               // Return column id
-               return CategoryFrontend.COLUMN_ID;
-       }
-
-       /**
-        * Gets a Result back from given ResultSet instance
-        *
-        * @param resultSet ResultSet instance from SQL driver
-        * @return A typorized Result instance
-        * @throws java.sql.SQLException If any SQL error occurs
-        */
-       @Override
-       public Result<? extends Storable> getResultFromSet (final ResultSet resultSet) throws SQLException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("resultSet={0} - CALLED!", resultSet)); //NOI18N
-
-               // Init result instance
-               Result<? extends Storable> result = new DatabaseResult();
-
-               // Reset result set before first row
-               resultSet.beforeFirst();
-
-               // "Walk" through all entries
-               while (resultSet.next()) {
-                       // Get id, title and parent id
-                       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
-
-                       // Instance new object
-                       Category category = new ProductCategory(id, title, parent);
-
-                       // Debug log
-                       this.getLogger().debug(MessageFormat.format("category={0}", category)); //NOI18N
-
-                       // Add it to result
-                       result.add(category);
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("result({0})={1} - EXIT!", result.size(), result)); //NOI18N
-
-               // Return result
-               return result;
-       }
-
-       @Override
-       public Storable getStorableAtRow (final int rowIndex) {
-               throw new UnsupportedOperationException("Not supported yet: rowIndex=" + rowIndex);
-       }
-
-       /**
-        * Checks if given category title is already used
-        *
-        * @param title Title to check
-        * @return Whether the title has been used
-        */
-       @Override
-       public boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title)); //NOI18N
-
-               // Get search criteria
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add criteria
-               criteria.addCriteria(CategoryFrontend.COLUMN_TITLE, title);
-
-               // Only one entry is find
-               criteria.setLimit(1);
-
-               // Run it on backend
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug log
-               this.getLogger().debug(MessageFormat.format("result({0})={1}", result, result.size())); //NOI18N
-
-               // Now check size of the result
-               boolean isFound = (result.size() == 1);
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound)); //NOI18N
-
-               // Return it
-               return isFound;
-       }
-
-       /**
-        * Converts the given map into a Storable instance, depending on which
-        * class implements it. All keys are being interpreted as class
-        * fields/attributes and their respective setters are being searched for. As
-        * this method may fail to find one or access it, this method throws some
-        * exception.
-        *
-        * @param map Map instance to convert to Storable
-        * @return An instance of a Storable implementation
-        */
-       @Override
-       public Storable toStorable (final Map<String, String> map) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("map={0} - CALLED!", map)); //NOI18N
-
-               // Is map null?
-               if (null == map) {
-                       // Is null
-                       throw new NullPointerException("map is null"); //NOI18N
-               } else if (map.isEmpty()) {
-                       // Map is empty
-                       throw new IllegalArgumentException("map is empty."); //NOI18N
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("Has to handle {0} entries", map.size())); //NOI18N
-
-               // Get iterator on all entries
-               Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
-
-               // Init object instance
-               Storable instance = new ProductCategory();
-
-               // Iterate over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       Map.Entry<String, String> entry = iterator.next();
-
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("entry:{0}={1}", entry.getKey(), entry.getValue())); //NOI18N
-
-                       // Try to set value
-                       instance.setValueFromColumn(entry.getKey(), entry.getValue());
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("instance={0} - EXIT!", instance)); //NOI18N
-
-               // Return it
-               return instance;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java
deleted file mode 100644 (file)
index 207cfaa..0000000
+++ /dev/null
@@ -1,422 +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.frontend.product;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.Map;
-import org.mxchange.jcore.criteria.searchable.SearchCriteria;
-import org.mxchange.jcore.criteria.searchable.SearchableCriteria;
-import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
-import org.mxchange.jcore.database.result.DatabaseResult;
-import org.mxchange.jcore.database.result.Result;
-import org.mxchange.jcore.database.storage.Storable;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-import org.mxchange.pizzaapplication.product.pizza.PizzaProduct;
-
-/**
- * Stores and retrieves Contact instances
- *
- * @author Roland Haeder
- */
-public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implements ProductFrontend {
-
-       /**
-        * Default constrcutor
-        *
-        * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException
-        * If the configured backend is not supported
-        * @throws java.sql.SQLException If any SQL error occurs
-        */
-       public PizzaProductDatabaseFrontend () throws UnsupportedDatabaseBackendException, SQLException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Set "table" name
-               this.setTableName("products"); //NOI18N
-
-               // Initalize backend
-               this.initBackend();
-       }
-
-       /**
-        * Adds product to database by given title, price and category id
-        *
-        * @param title Product title
-        * @param price Product price
-        * @param category Product category id
-        * @param available Availability of product (selectable by customer)
-        * @throws java.sql.SQLException If any SQL errors occur
-        */
-       @Override
-       public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException, IOException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("title={0},price={1},category={2} - CALLED!", title, price, category)); //NOI18N
-
-               // Title should not be null
-               if (null == title) {
-                       // Abort here
-                       throw new NullPointerException("title is null"); //NOI18N
-               } else if (null == price) {
-                       // Abort here
-                       throw new NullPointerException("price is null"); //NOI18N
-               } else if (null == category) {
-                       // Abort here
-                       throw new NullPointerException("category is null"); //NOI18N
-               } else if (null == available) {
-                       // Abort here
-                       throw new NullPointerException("available is null"); //NOI18N
-               }
-
-               // Clear dataset from previous usage
-               this.clearDataSet();
-
-               // Add title and parent
-               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!
-               Result<? extends Storable> result = this.doInsertDataSet();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Shuts down the database layer
-        *
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws java.io.IOException If any IO error occurs
-        */
-       @Override
-       public void doShutdown () throws SQLException, IOException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Shutdown backend
-               this.getBackend().doShutdown();
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Depending on column, an empty value may be converted to null
-        *
-        * @param key Key to check
-        * @param value Value to check
-        * @return Possible previous value or null
-        */
-       @Override
-       public Object emptyStringToNull (final String key, final Object value) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
-
-               // Copy value
-               Object v = value;
-
-               // Is the value empty?
-               if ((value instanceof String) && ("".equals(value))) { //NOI18N
-                       // This value may need to be changed
-                       switch (key) {
-                       }
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("v={0} - EXIT!", v)); //NOI18N
-
-               // Return it
-               return v;
-       }
-
-       /**
-        * An iterator on all products
-        *
-        * @return Iterator on all products
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token
-        * was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL errors occur
-        */
-       @Override
-       @SuppressWarnings("unchecked")
-       public Iterator<Product> getAllProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Instance search criteria
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Run the query
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Get iterator
-               Iterator<?> iterator = result.iterator();
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("iterator={0} - EXIT!", iterator)); //NOI18N
-
-               // Get iterator and return it
-               return (Iterator<Product>) iterator;
-       }
-
-       @Override
-       @SuppressWarnings("unchecked")
-       public Iterator<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Instance search criteria
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add criteria
-               criteria.addCriteria(ProductFrontend.COLUMN_AVAILABLE, Boolean.TRUE);
-
-               // Run the query
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
-
-               // Get iterator
-               Iterator<?> iterator = result.iterator();
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("iterator={0} - EXIT!", iterator)); //NOI18N
-
-               // Get iterator and return it
-               return (Iterator<Product>) iterator;
-       }
-
-       @Override
-       public String getIdName () {
-               // Return column id
-               return ProductFrontend.COLUMN_ITEM_ID;
-       }
-
-       /**
-        * Gets a Result back from given ResultSet instance
-        *
-        * @param resultSet ResultSet instance from SQL driver
-        * @return A typorized Result instance
-        * @throws java.sql.SQLException If any SQL error occurs
-        */
-       @Override
-       public Result<? extends Storable> getResultFromSet (final ResultSet resultSet) throws SQLException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("resultSet={0} - CALLED!", resultSet)); //NOI18N
-
-               // Init result instance
-               Result<? extends Storable> result = new DatabaseResult();
-
-               // Reset result set before first row
-               resultSet.beforeFirst();
-
-               // "Walk" through all entries
-               while (resultSet.next()) {
-                       // Get id, title and parent id
-                       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
-
-                       // Instance new object
-                       Product product = new PizzaProduct(id, title, price, category, available);
-
-                       // Debug log
-                       this.getLogger().debug(MessageFormat.format("product={0}", product)); //NOI18N
-
-                       // Add it to result
-                       result.add(product);
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("result({0})={1} - EXIT!", result.size(), result)); //NOI18N
-
-               // Return result
-               return result;
-       }
-
-       @Override
-       public Storable getStorableAtRow (final int rowIndex) {
-               throw new UnsupportedOperationException("Not supported yet: rowIndex=" + rowIndex);
-       }
-
-       /**
-        * Checks wether the given product title is already used.
-        *
-        * @param title Product title
-        * @return Whether the product title is already used
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token
-        * was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL errors occur
-        */
-       @Override
-       public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title)); //NOI18N
-
-               // Get search criteria
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add criteria
-               criteria.addCriteria(ProductFrontend.COLUMN_TITLE, title);
-
-               // Only one entry is find
-               criteria.setLimit(1);
-
-               // Run it on backend
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug log
-               this.getLogger().debug(MessageFormat.format("result({0}={1}", result, result.size())); //NOI18N
-
-               // Now check size of the result
-               boolean isFound = (result.size() == 1);
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound)); //NOI18N
-
-               // Return it
-               return isFound;
-       }
-
-       /**
-        * Converts the given map into a Storable instance, depending on which
-        * class implements it. All keys are being interpreted as class
-        * fields/attributes and their respective setters are being searched for. As
-        * this method may fail to find one or access it, this method throws some
-        * exception.
-        *
-        * @param map Map instance to convert to Storable
-        * @return An instance of a Storable implementation
-        */
-       @Override
-       public Storable toStorable (final Map<String, String> map) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("map={0} - CALLED!", map)); //NOI18N
-
-               // Is map null?
-               if (null == map) {
-                       // Is null
-                       throw new NullPointerException("map is null"); //NOI18N
-               } else if (map.isEmpty()) {
-                       // Map is empty
-                       throw new IllegalArgumentException("map is empty."); //NOI18N
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("Has to handle {0} entries", map.size())); //NOI18N
-
-               // Get iterator on all entries
-               Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
-
-               // Init object instance
-               Storable instance = new PizzaProduct();
-
-               // Iterate over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       Map.Entry<String, String> entry = iterator.next();
-
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("entry:{0}={1}", entry.getKey(), entry.getValue())); //NOI18N
-
-                       // Try to set value
-                       instance.setValueFromColumn(entry.getKey(), entry.getValue());
-               }
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("instance={0} - EXIT!", instance)); //NOI18N
-
-               // Return it
-               return instance;
-       }
-
-       @Override
-       public Product getProduct (final AddableBasketItem item) throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace("item=" + item + " - CALLED!");
-
-               // item should not be null
-               if (null == item) {
-                       // Abort here
-                       throw new NullPointerException("item is null");
-               }
-
-               // Get search criteria
-               SearchableCriteria criteria = new SearchCriteria();
-
-               // Add criteria
-               criteria.addCriteria(ProductFrontend.COLUMN_ITEM_ID, item.getItemId());
-
-               // Only one entry is find
-               criteria.setLimit(1);
-
-               // Run it on backend
-               Result<? extends Storable> result = this.getBackend().doSelectByCriteria(criteria);
-
-               // Debug log
-               this.getLogger().debug(MessageFormat.format("result({0}={1}", result, result.size())); //NOI18N
-
-               // Init product instance
-               Product product = null;
-
-               // Is there one entry?
-               if (result.hasNext()) {
-                       // Get item
-                       Storable storeable = result.next();
-
-                       // Is it Product?
-                       if (!(storeable instanceof Product)) {
-                               // Cannot cast!
-                               throw new IllegalStateException("storeable=" + storeable + " does not implement Product.");
-                       }
-
-                       // Cast it
-                       product = (Product) storeable;
-               }
-
-               // Trace message
-               this.getLogger().trace("product=" + product + " - EXIT!");
-
-               // Return it
-               return product;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java
deleted file mode 100644 (file)
index 6e71d77..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Häder
- *
- * 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.frontend.product;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.util.Iterator;
-import org.mxchange.jcore.database.frontend.DatabaseFrontend;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * An interface for product database frontends
- *
- * @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
-        * @param title Product title
-        * @param price Product price
-        * @param category Product category id
-        * @param available Availability of product (selectable by customer)
-        * @throws java.sql.SQLException If any SQL errors occur
-        * @throws java.io.IOException If an IO error occurs
-        */
-       public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException, IOException;
-
-       /**
-        * An iterator on all products
-        *
-        * @return Iterator on all products
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL errors occur
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public Iterator<Product> getAllProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-
-       /**
-        * An iterator on all products
-        *
-        * @return Iterator on all products
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL errors occur
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public Iterator<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-
-       /**
-        * Checks wether the given product title is already used.
-        *
-        * @param title Product title
-        * @return Whether the product title is already used
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL errors occur
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-
-       /**
-        * Some "getter" for a Product instance from given item
-        *
-        * @param item Item instance
-        * @return  A Product instance
-        * @throws java.io.IOException If any IO error occurs
-        * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
-        * @throws java.sql.SQLException If any SQL errors occur
-        * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
-        * @throws java.lang.NoSuchMethodException If a method was not found
-        * @throws java.lang.IllegalAccessException If the method cannot be accessed
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
-        */
-       public Product getProduct (final AddableBasketItem item) throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java b/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java
deleted file mode 100644 (file)
index 5295d62..0000000
+++ /dev/null
@@ -1,39 +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.exceptions;
-
-import java.text.MessageFormat;
-import javax.servlet.http.HttpServletRequest;
-import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend;
-
-/**
- * An exception thrown when the given title is already used
- * 
- * @author Roland Haeder
- */
-public class CategoryTitleAlreadyUsedException extends Exception {
-
-       /**
-        * Constructor with HttpServletRequest instance
-        *
-        * @param request A HttpServletRequest instance
-        */
-       public CategoryTitleAlreadyUsedException (final HttpServletRequest request) {
-               // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", request.getParameter(CategoryFrontend.COLUMN_TITLE))); //NOI18N
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java b/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java
deleted file mode 100644 (file)
index c36c59f..0000000
+++ /dev/null
@@ -1,39 +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.exceptions;
-
-import java.text.MessageFormat;
-import javax.servlet.http.HttpServletRequest;
-import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend;
-
-/**
- * An exception thrown when the given title is already used
- * 
- * @author Roland Haeder
- */
-public class ProductTitleAlreadyUsedException extends Exception {
-
-       /**
-        * Constructor with HttpServletRequest instance
-        *
-        * @param request A HttpServletRequest instance
-        */
-       public ProductTitleAlreadyUsedException (final HttpServletRequest request) {
-               // Call super constructor
-               super(MessageFormat.format("Title {0} is already used.", request.getParameter(ProductFrontend.COLUMN_TITLE))); //NOI18N
-       }
-}
index 367a904bf3e7c102749c75472d6adf5f05a6c2f1..13209def9bcf44f1a7803cd929c1dc03a53616b6 100644 (file)
@@ -29,10 +29,10 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 import org.mxchange.jcore.exceptions.BadTokenException;
 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.pizzaapplication.beans.PizzaBean;
-import org.mxchange.pizzaapplication.beans.basket.BasketBean;
+import org.mxchange.jshop.beans.basket.BasketBean;
+import org.mxchange.jshop.item.AddableBasketItem;
+import org.mxchange.pizzaapplication.beans.controller.PizzaBean;
 import org.mxchange.pizzaapplication.filter.servlet.BaseServletFilter;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
 
 /**
  * A filter for handling added basket items
diff --git a/src/java/org/mxchange/pizzaapplication/item/AddableBasketItem.java b/src/java/org/mxchange/pizzaapplication/item/AddableBasketItem.java
deleted file mode 100644 (file)
index 5315079..0000000
+++ /dev/null
@@ -1,79 +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.item;
-
-import org.mxchange.jcore.database.storage.Storable;
-
-/**
- * An interface for addable basket items
- *
- * @author Roland Haeder
- */
-public interface AddableBasketItem extends Storable, Comparable<AddableBasketItem> {
-
-       /**
-        * Item amount
-        * @return the amount
-        */
-       public Long getAmount ();
-
-       /**
-        * Item amount
-        * @param amount the amount to set
-        */
-       public void setAmount (final Long amount);
-
-       /**
-        * Entry id (from database backend)
-        * @return the id
-        */
-       public Long getId ();
-
-       /**
-        * Entry id (from database backend)
-        * @param id the id to set
-        */
-       public void setId (final Long id);
-
-       /**
-        * @return the id
-        */
-       public Long getItemId ();
-
-       /**
-        * @param id the id to set
-        */
-       public void setItemId (final Long id);
-
-       /**
-        * @return the type
-        */
-       public String getItemType ();
-
-       /**
-        * @param type the type to set
-        */
-       public void setItemType (final String type);
-
-       /**
-        * Compare method
-        * @param item Item to compare to
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final AddableBasketItem item);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/item/BaseItem.java b/src/java/org/mxchange/pizzaapplication/item/BaseItem.java
deleted file mode 100644 (file)
index 03a7e07..0000000
+++ /dev/null
@@ -1,143 +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.item;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Objects;
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- * An item (addedable to a basket) could respresent a product or a discount
- * coupon. This depends on the type of the item.
- *
- * @author Roland Haeder
- */
-public class BaseItem extends BaseFrameworkSystem implements AddableBasketItem {
-       /**
-        * Entry id (from database backend)
-        */
-       private Long id;
-
-       /**
-        * Item amount
-        */
-       private Long amount;
-
-       /**
-        * Item id number
-        */
-       private Long itemId;
-
-       /**
-        * Item type
-        */
-       private String itemType;
-
-       @Override
-       public int compareTo (final AddableBasketItem item) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
-               
-               // item should not be null
-               if (null == item) {
-                       throw new NullPointerException("item is null"); //NOI18N
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("this.itemId={0},item.itemId={1}", this.getItemId(), item.getItemId())); //NOI18N
-
-               // Is the id the same?
-               if (Objects.equals(this.getItemId(), item.getItemId())) {
-                       // Same id, means same item
-                       return 0;
-               } else if (this.getItemId() > item.getItemId()) {
-                       // This id is larger than compared to
-                       return -1;
-               }
-
-               // The other id is larger
-               return 1;
-       }
-
-       @Override
-       public final Long getAmount () {
-               return this.amount;
-       }
-
-       @Override
-       public final void setAmount (final Long amount) {
-               this.amount = amount;
-       }
-
-       @Override
-       public final Long getId () {
-               return this.id;
-       }
-
-       @Override
-       public final void setId (final Long id) {
-               this.id = id;
-       }
-
-       @Override
-       public final Long getItemId () {
-               return this.itemId;
-       }
-
-       @Override
-       public final void setItemId( final Long itemId) {
-               this.itemId = itemId;
-       }
-
-       @Override
-       public final String getItemType () {
-               return this.itemType;
-       }
-
-       @Override
-       public final void setItemType (final String itemType) {
-               this.itemType = itemType;
-       }
-
-       @Override
-       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N
-
-               // Call super method
-               Object value = this.getValueInStorableFromColumn(this, "BaseItem", columnName); //NOI18N
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value)); //NOI18N
-
-               // Return value
-               return value;
-       }
-
-       @Override
-       public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value)); //NOI18N
-
-               // Call super method
-               this.setValueInStorableFromColumn(this, "BaseItem", columnName, value); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/item/basket/BasketItem.java b/src/java/org/mxchange/pizzaapplication/item/basket/BasketItem.java
deleted file mode 100644 (file)
index 0cc17af..0000000
+++ /dev/null
@@ -1,58 +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.item.basket;
-
-import java.text.MessageFormat;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.item.BaseItem;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * A basket item for Pizza service
- *
- * @author Roland Haeder
- */
-public class BasketItem extends BaseItem implements AddableBasketItem {
-       /**
-        * Default constructor
-        */
-       public BasketItem () {
-       }
-
-       /**
-        * Constructor for an item from given Product instance
-        * 
-        * @param product Product instance
-        */
-       public BasketItem (final Product product) {
-               // Call default constructor
-               this();
-
-               // Trace message
-               this.getLogger().debug(MessageFormat.format("product={0} - CALLED!", product));
-
-               // product must not be null
-               if (null == product) {
-                       // Abort here
-                       throw new NullPointerException("product is null");
-               }
-
-               // Copy all neccessary values
-               this.setItemId(product.getItemId());
-               this.setItemType("Product"); //NOI18N
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/product/BaseProduct.java b/src/java/org/mxchange/pizzaapplication/product/BaseProduct.java
deleted file mode 100644 (file)
index 47191a0..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.mxchange.pizzaapplication.product;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Objects;
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- *
- * @author quix0r
- */
-public class BaseProduct extends BaseFrameworkSystem implements Product {
-       /**
-        * Availability of product
-        */
-       private Boolean available;
-
-       /**
-        * Product category
-        */
-       private Long category;
-
-       /**
-        * Id number of product item
-        */
-       private Long itemId;
-
-       /**
-        * Price of product
-        */
-       private Float price;
-
-       /**
-        * Title of product
-        */
-       private String title;
-
-       /**
-        * Compares two categories with each other
-        *
-        * @param product Product comparator
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final Product product) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
-               
-               // category should not be null
-               if (null == product) {
-                       throw new NullPointerException("product is null"); //NOI18N
-               }
-               
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("this.id={0},product.id={1}", this.getItemId(), product.getItemId())); //NOI18N
-               
-               // Is the id the same?
-               if (Objects.equals(this.getItemId(), product.getItemId())) {
-                       // Same id, means same category
-                       return 0;
-               } else if (this.getItemId() > product.getItemId()) {
-                       // This id is larger than compared to
-                       return 1;
-               }
-               
-               // The other id is larger
-               return -1;
-       }
-
-       /**
-        * Getter for product availability
-        *
-        * @return Product availability
-        */
-       @Override
-       public final Boolean getAvailable () {
-               return this.available;
-       }
-
-       /**
-        * Setter for product availability
-        *
-        * @param available Product availability
-        */
-       @Override
-       public final void setAvailable (final Boolean available) {
-               this.available = available;
-       }
-
-       /**
-        * Getter for product category
-        *
-        * @return Product category
-        */
-       @Override
-       public final Long getCategory () {
-               return this.category;
-       }
-
-       /**
-        * Setter for product category
-        *
-        * @param category Product category
-        */
-       @Override
-       public final void setCategory (final Long category) {
-               this.category = category;
-       }
-
-       /**
-        * Name of product
-        * @return the name
-        */
-       @Override
-       public final Long getItemId () {
-               return this.itemId;
-       }
-
-       /**
-        * Id number of product
-        * @param itemId the id number to set
-        */
-       @Override
-       public final void setItemId (final Long itemId) {
-               this.itemId = itemId;
-       }
-
-       /**
-        * Price of product
-        * @return the price
-        */
-       @Override
-       public final Float getPrice () {
-               return this.price;
-       }
-
-       /**
-        * Price of product
-        * @param price the price to set
-        */
-       @Override
-       public final void setPrice (final Float price) {
-               this.price = price;
-       }
-
-       /**
-        * Title of product
-        * @return the title
-        */
-       @Override
-       public final String getTitle () {
-               return this.title;
-       }
-
-       /**
-        * Title of product
-        * @param title the title to set
-        */
-       @Override
-       public final void setTitle (final String title) {
-               this.title = title;
-       }
-
-       @Override
-       public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N
-
-               // Call super method
-               Object value = this.getValueInStorableFromColumn(this, "BaseProduct", columnName); //NOI18N
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value)); //NOI18N
-
-               // Return value
-               return value;
-       }
-
-       @Override
-       public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("columnName={0},value={1} - CALLED!", columnName, value)); //NOI18N
-
-               // Call super method
-               this.setValueInStorableFromColumn(this, "BaseProduct", columnName, value); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/product/Product.java b/src/java/org/mxchange/pizzaapplication/product/Product.java
deleted file mode 100644 (file)
index ee4620b..0000000
+++ /dev/null
@@ -1,101 +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.product;
-
-import org.mxchange.jcore.database.storage.Storable;
-
-/**
- * An interface for in database storeable products
- *
- * @author Roland Haeder
- */
-public interface Product extends Storable, Comparable<Product> {
-       /**
-        * Getter for id number, suitable for form fields.
-        * 
-        * @return Id number of product
-        */
-       public Long getItemId ();
-
-       /**
-        * Id number of product
-        * @param id the id number to set
-        */
-       public void setItemId (final Long id);
-
-       /**
-        * Getter for title.
-        * 
-        * @return Title of product
-        */
-       public String getTitle ();
-
-       /**
-        * Title of product
-        * @param title the title to set
-        */
-       public void setTitle (final String title);
-
-       /**
-        * Getter for raw price.
-        * 
-        * @return Single price of product
-        */
-       public Float getPrice ();
-
-       /**
-        * Price of product
-        * @param price the price to set
-        */
-       public void setPrice (final Float price);
-
-       /**
-        * Getter for product category
-        *
-        * @return Product category
-        */
-       public Long getCategory ();
-
-       /**
-        * Setter for product category
-        *
-        * @param category Product category
-        */
-       public void setCategory (final Long category);
-
-       /**
-        * Getter for product availability
-        *
-        * @return Product availability
-        */
-       public Boolean getAvailable ();
-
-       /**
-        * Setter for product availability
-        *
-        * @param available Product availability
-        */
-       public void setAvailable (final Boolean available);
-
-       /**
-        * Compare method
-        * @param product Product to compare to
-        * @return Comparison value
-        */
-       @Override
-       public int compareTo (final Product product);
-}
diff --git a/src/java/org/mxchange/pizzaapplication/product/pizza/PizzaProduct.java b/src/java/org/mxchange/pizzaapplication/product/pizza/PizzaProduct.java
deleted file mode 100644 (file)
index 82c43fa..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.product.pizza;
-
-import java.text.MessageFormat;
-import org.mxchange.pizzaapplication.product.BaseProduct;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * Product class for pizza application
- *
- * @author Roland Haeder
- */
-public class PizzaProduct extends BaseProduct implements Product {
-       /**
-        * Default constructor
-        */
-       public PizzaProduct () {
-       }
-
-       /**
-        * Constructor will all required data
-        *
-        * @param id Id number of product
-        * @param title Name of product
-        * @param price Price
-        * @param category Category id
-        * @param available Availability (selectable by customer)
-        */
-       public PizzaProduct (final Long id, final String title, final Float price, final Long category, final Boolean available) {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("id={0},title={1},price={2},category={3},available={4} - CALLED!", id, title, price, category, available)); //NOI18N
-
-               // Set all here
-               this.setItemId(id);
-               this.setTitle(title);
-               this.setPrice(price);
-               this.setCategory(category);
-               this.setAvailable(available);
-       }
-}
index 645f0b2bd299ad64695c80668ab5d9e3e7179e66..139e50b1cfeed923c805e2badec885e943f840a0 100644 (file)
@@ -17,7 +17,7 @@
 package org.mxchange.pizzaapplication.tags.basket;
 
 import javax.servlet.jsp.tagext.BodyTag;
-import org.mxchange.pizzaapplication.beans.basket.BasketBean;
+import org.mxchange.jshop.beans.basket.BasketBean;
 
 /**
  *
index 2acf5258711dde3fc44f7508cd6628c254d93a77..f487690e56fc5767977e3a51d1d4cbaca862c133 100644 (file)
@@ -27,10 +27,10 @@ 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.pizzaapplication.beans.PizzaBean;
-import org.mxchange.pizzaapplication.beans.basket.BasketBean;
-import org.mxchange.pizzaapplication.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.product.Product;
+import org.mxchange.jshop.beans.basket.BasketBean;
+import org.mxchange.jshop.item.AddableBasketItem;
+import org.mxchange.jshop.product.Product;
+import org.mxchange.pizzaapplication.beans.controller.PizzaBean;
 
 /**
  * A basket tag that outputs a small basket and a link to the full basket website.
index cd63a914a12b8d88ce8f35c15c850a2a062b4012..234caf26a8422c05b11268474898f6167510e02b 100644 (file)
@@ -3,7 +3,7 @@
        <tlib-version>1.0</tlib-version>
        <jsp-version>1.2</jsp-version>
        <short-name>basket</short-name>
-       <uri>http://mxchange.org/pizza-service/tags/basket</uri>
+       <uri>http://mxchange.org/jshop/tags/basket</uri>
 
        <tag>
                <name>mini_basket</name>
@@ -14,7 +14,7 @@
                        <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>
+                       <type>org.mxchange.jshop.beans.basket.BasketBean</type>
                </attribute>
        </tag>
 </taglib>
index 744b04bb1e0f8cc2aa89fc58d0b67a8fce9606ad..3485e12ae0993ed1f28842db5713e1e165af8d15 100644 (file)
@@ -5,13 +5,13 @@
 --%>
 
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="org.mxchange.pizzaapplication.category.Category"%>
-<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.jshop.category.Category"%>
+<%@page import="org.mxchange.jshop.database.frontend.category.CategoryFrontend"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<jsp:useBean id="controller" 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.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
 <jsp:setProperty name="controller" property="basket" value="${basket}" />
index 0983d611bd62ec645da0b86743ae6efe3485ba82..105b5fabcd80e09e94f63195a1fea46099afd6ab 100644 (file)
@@ -7,11 +7,11 @@
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
+<%@page import="org.mxchange.jshop.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" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <c:set var="basePath" value="${pageContext.request.contextPath}" />
index 71221e72dbdc759e5dcb0b201de121ee48d7d1a5..81029241d595afa72ab3a9c7e14aef919977ebb6 100644 (file)
 <%@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.database.frontend.product.ProductFrontend"%>
-<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<%@page import="org.mxchange.jshop.product.Product"%>
+<%@page import="org.mxchange.jshop.database.frontend.product.ProductFrontend"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
 <%controller.init();%>
index 199bd4bf0d3bf70a9bcc03f349e7be3c8a9c8d4d..01a7d407a61b2150df47fa19cda19edeff5f5dbe 100644 (file)
@@ -5,7 +5,7 @@
 --%>
 
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
 
 <!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">
index a9d408a5c356ee8b6e003c050783c1c59d0319cf..31f8792382cdb2a5133665524e2b7549db4f48c9 100644 (file)
@@ -6,7 +6,7 @@
 
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <c:set var="basePath" value="${pageContext.request.contextPath}" />
index 5ac0bafe7e31d37a23212ba837e8a260e9d650c2..d813528f0245f58bc64dc4eeccd37dacc38353ea 100644 (file)
@@ -8,7 +8,7 @@
 
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <c:set var="basePath" value="${pageContext.request.contextPath}" />
index 3362d09ec6817b1eed3045f01bffd96918e2b1f6..4e55adb7583663e39dc9391eb8cff4525cfab5d6 100644 (file)
@@ -7,17 +7,17 @@
 <%@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"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
+<%@page import="org.mxchange.jshop.item.AddableBasketItem"%>
 
-<jsp:useBean id="controller" 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.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
 <jsp:setProperty name="controller" property="basket" value="${basket}" />
 <%controller.init();%>
 
-<jsp:useBean id="item" scope="request" class="org.mxchange.pizzaapplication.item.basket.BasketItem" type="AddableBasketItem" />
+<jsp:useBean id="item" scope="request" class="org.mxchange.jshop.item.basket.BasketItem" type="AddableBasketItem" />
 <jsp:setProperty name="item" property="*" />
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
index 9407f3f94485875a4a83b0fc00444318e6ad7c99..9a2b0eb0e799222e6d615f08b214b71c687cf52c 100644 (file)
@@ -8,16 +8,16 @@
 <%@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"%>
-<%@page import="org.mxchange.pizzaapplication.item.basket.BasketItem"%>
-<%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
+<%@page import="org.mxchange.jshop.product.Product"%>
+<%@page import="org.mxchange.jshop.basket.Basket"%>
+<%@page import="org.mxchange.jshop.item.basket.BasketItem"%>
+<%@page import="org.mxchange.jshop.item.AddableBasketItem"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@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="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<%@taglib prefix="basket" uri="http://mxchange.org/jshop/tags/basket" %>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <c:set var="basePath" value="${pageContext.request.contextPath}" />
 
index d6187af5fbd8bd21eb78cd9b7bc16818da44fac5..62332e3434b255f41d8ec6963e7cc1162df4f2c3 100644 (file)
@@ -5,10 +5,10 @@
 --%>
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@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="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<%@page import="org.mxchange.jshop.database.frontend.category.CategoryFrontend"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <select class="select" name="<%=CategoryFrontend.COLUMN_ID%>" size="1">
        <c:forEach var="category" items="${controller.allCategories}">
index 8eb9f79a17446fbd61979bc5b67755e0d4303f34..51b05ccfe096ecada4dc8b8e2245e270ea022d8a 100644 (file)
@@ -5,10 +5,10 @@
 --%>
 
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@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="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<%@page import="org.mxchange.jshop.database.frontend.category.CategoryFrontend"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.controller.PizzaBean" />
 
 <select class="select" name="<%=CategoryFrontend.COLUMN_PARENT%>" size="1">
        <option value="">Ist oberste Kategorie</option>