From a785d803d21066b56fdacdfeda992adc45f70c25 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 28 Aug 2015 22:07:27 +0200 Subject: [PATCH] Refacturing: - 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. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- lib/jcore.jar | Bin 120727 -> 120613 bytes lib/jsfcore.jar | Bin 9017 -> 9017 bytes lib/jshop.jar | Bin 0 -> 79428 bytes nbproject/build-impl.xml | 2 + nbproject/genfiles.properties | 6 +- nbproject/project.properties | 4 +- nbproject/project.xml | 4 + .../localization/bundle_en_US.properties | 8 +- .../BasePizzaServiceSystem.java | 50 +- .../application/PizzaApplication.java | 10 +- .../application/PizzaServiceApplication.java | 22 +- .../pizzaapplication/basket/BaseBasket.java | 195 ------- .../pizzaapplication/basket/Basket.java | 146 ----- .../basket/item/ItemBasket.java | 45 -- .../beans/basket/BasketBean.java | 177 ------ .../beans/basket/ItemBasketBean.java | 196 ------- .../beans/{ => controller}/PizzaBean.java | 18 +- .../{ => controller}/PizzaServiceBean.java | 98 +--- .../beans/customer/CustomerBean.java | 4 +- .../customer/PizzaServiceCustomerBean.java | 4 +- .../beans/item/BasketItemBean.java | 107 ---- .../pizzaapplication/beans/item/ItemBean.java | 45 -- .../category/BaseCategory.java | 191 ------ .../pizzaapplication/category/Category.java | 80 --- .../category/product/ProductCategory.java | 42 -- .../basket/BasketDatabaseConstants.java | 55 -- .../basket/BasketDatabaseFrontend.java | 547 ------------------ .../frontend/basket/BasketFrontend.java | 119 ---- .../frontend/category/CategoryFrontend.java | 102 ---- .../PizzaCategoryDatabaseFrontend.java | 377 ------------ .../product/PizzaProductDatabaseFrontend.java | 422 -------------- .../frontend/product/ProductFrontend.java | 124 ---- .../CategoryTitleAlreadyUsedException.java | 39 -- .../ProductTitleAlreadyUsedException.java | 39 -- .../servlet/basket/BasketItemAddedFilter.java | 6 +- .../item/AddableBasketItem.java | 79 --- .../pizzaapplication/item/BaseItem.java | 143 ----- .../item/basket/BasketItem.java | 58 -- .../pizzaapplication/product/BaseProduct.java | 195 ------- .../pizzaapplication/product/Product.java | 101 ---- .../product/pizza/PizzaProduct.java | 55 -- .../tags/basket/BasketTag.java | 2 +- .../tags/basket/MiniBasketTag.java | 8 +- web/WEB-INF/tlds/basket.tld | 4 +- web/admin/category.jsp | 10 +- web/admin/index.jsp | 8 +- web/admin/product.jsp | 10 +- web/bye.jsp | 2 +- web/customer/login.jsp | 2 +- web/customer/register.jsp | 2 +- web/form_handler/add_item.jsp | 10 +- web/index.jsp | 14 +- .../admin/admin_category_selection_box.jsp | 8 +- .../admin_parent_category_selection_box.jsp | 8 +- 54 files changed, 103 insertions(+), 3900 deletions(-) create mode 100644 lib/jshop.jar delete mode 100644 src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java delete mode 100644 src/java/org/mxchange/pizzaapplication/basket/Basket.java delete mode 100644 src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java delete mode 100644 src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java delete mode 100644 src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java rename src/java/org/mxchange/pizzaapplication/beans/{ => controller}/PizzaBean.java (95%) rename src/java/org/mxchange/pizzaapplication/beans/{ => controller}/PizzaServiceBean.java (83%) delete mode 100644 src/java/org/mxchange/pizzaapplication/beans/item/BasketItemBean.java delete mode 100644 src/java/org/mxchange/pizzaapplication/beans/item/ItemBean.java delete mode 100644 src/java/org/mxchange/pizzaapplication/category/BaseCategory.java delete mode 100644 src/java/org/mxchange/pizzaapplication/category/Category.java delete mode 100644 src/java/org/mxchange/pizzaapplication/category/product/ProductCategory.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/basket/BasketDatabaseConstants.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketDatabaseFrontend.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketFrontend.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java delete mode 100644 src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java delete mode 100644 src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java delete mode 100644 src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java delete mode 100644 src/java/org/mxchange/pizzaapplication/item/AddableBasketItem.java delete mode 100644 src/java/org/mxchange/pizzaapplication/item/BaseItem.java delete mode 100644 src/java/org/mxchange/pizzaapplication/item/basket/BasketItem.java delete mode 100644 src/java/org/mxchange/pizzaapplication/product/BaseProduct.java delete mode 100644 src/java/org/mxchange/pizzaapplication/product/Product.java delete mode 100644 src/java/org/mxchange/pizzaapplication/product/pizza/PizzaProduct.java diff --git a/lib/jcore.jar b/lib/jcore.jar index adc5c6d62b12352d537c21cf4551a8411d51a901..5c344f84657d28ec66405902cd7958f977fe36e6 100644 GIT binary patch delta 3146 zcmZ`*dr*{B6#vdXzJ-0U3uxlyPb02&0 zfa(1PlQlP6Z!jxLh@xz1sI?|JUvG%c`Z2t4Uy-6HB$4>h5xA@NnOTocNGTY9uX{{R zdH&*(LU+ch^0HOs`Og)vDowJPZRWu^J1V2II5F@u@X@OBqSQM**b+$6?WklmkV?u2 zQ%T)|iKHBA!gep1Fvkn3c_2G(U#*)&aHBqfb?YK%SYx7LD5m+q%%b%nWJ}a%k}A<> zNayASrHX!}T;!8r`U3f^?FBQ+%k$pGryREJE-9N__8YaOvs0r7>RkUv6rmN}B4LGaaP+PE`u~;@;hM z`Zn~n8A*3tet8_%p2wUp(@BFjzh~WgSSXw?ZiEzJ39W?5VvzYNh#Ea(H-kg?Oxprs0-Cc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|4v+dQJS+oR1ip#RfYL+ z=n{W_Vn`ng;%^QF(Hf-(7tHvVK8WB|zn{3X=Q^vHBuy3JK#S}$_*WY@r^WSCtbep| z0$rEEhHx2Th>5$*n42dRhF)>_4uN|+7`qV+xZ?_> z5pkS|pN3=j2t=VP1{R`iAkd7@O_3{O*p)?6pem&v^9SG;yx#bEzdv7KUBK`Z-N82T$3H&BRc*qg|^_>Fw7@M(>2C8>lG$L z@u?*ye-CH&?}2RGI~-WKsP2NiuR;WYBu`cOoV{eek^;L&n7j9Y9GHK){jG^z*?%69 zD{3ct@xf{IL?b&PcLxHu$Sc~x{}hUXK%(C7`!VafoMQKN7Gvp=X));Q5G_X_R=LC; zl1=SV#U>nA9fg^=;)c9O*4k59 diff --git a/lib/jsfcore.jar b/lib/jsfcore.jar index c68585ba7aa74968c525c6c45052674811ea37ca..9865324731046e90d011318d24eab563bc7c392d 100644 GIT binary patch delta 233 zcmdn#w$qI_z?+$ci-CcIf#L63nTfm_%zuEC#WXN=Q65Zv1`AG>V>AG9CkHZGf$2U* zM=*Vf(VYV*?%sT-f5&D;rUo9_e1@Y8MGU7HN*Eq8R51KtsAl-bP{YW<(7-6n&^UP? z-(8Tt&GYzqxxkEdl9Fu9K-(vulD7bx$f{rurrj0v!E~hpM0|^a1DO9^!3#{gC7fk-H7zY-NP|5<+N0mwddOBKm delta 233 zcmdn#w$qI_z?+$ci-CcIf#LE5$%(ug%$IV>AG9CkHZGf$2U* zM=*Vf(VYV*?#}-7z~0S@ObtA;xeP}c3K&i?6frzxC}a4+P|5I*p^A}%p^j0Qp?>l{ zzPliOo9FTKa)BA^BqiCHfwoURC2s*XkyXJSOuH-SgXu~Ii1-!-2QdG;f)|)}Q49pr YGZe$&E|~mXF%B#kp_B!tk1CY_0DiYqkN^Mx diff --git a/lib/jshop.jar b/lib/jshop.jar new file mode 100644 index 0000000000000000000000000000000000000000..9df42b3510e668245aa101de84ddf50cba2347ff GIT binary patch literal 79428 zcmeHw31A$>mG-OA(X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$6(Nf(JlPp zzoagl1tJUE@G^r)U$@MEHAUFeED81rkko|-k#uh1UoQwP+-78^S$9A<*};7gx8zGE pr7byasX;TaTk7*u)0S$hl>xJ&mTfs~n30x~uZ|+xH4DpC`v23<6T1Ka literal 0 HcmV?d00001 diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 31465cbd..7cc63684 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -1031,6 +1031,7 @@ exists or setup the property manually. For example like this: + @@ -1044,6 +1045,7 @@ exists or setup the property manually. For example like this: + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 88d3fe8f..d76800cb 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -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 diff --git a/nbproject/project.properties b/nbproject/project.properties index 5817b497..851aac70 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -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 diff --git a/nbproject/project.xml b/nbproject/project.xml index a0911229..7468c759 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -42,6 +42,10 @@ ${file.reference.commons-lang3-3.4.jar} WEB-INF/lib + + ${file.reference.jshop.jar} + WEB-INF/lib + diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 07e8210f..646cd4e4 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -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ü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 diff --git a/src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java b/src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java index 17c7504c..aac7e6ee 100644 --- a/src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java +++ b/src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java @@ -16,58 +16,12 @@ */ 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 { } diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java index 9f72fb87..738ac7b0 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java @@ -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; /** * diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 7d27ca19..96c36864 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -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 index 58ff9cf6..00000000 --- a/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java +++ /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 . - */ -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 Any instance that implements AddableBasketItem - */ -public class BaseBasket extends BasePizzaServiceSystem implements Basket, 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 getAll () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Trace message - this.getLogger().trace("CALLED!"); - - // Init map - @SuppressWarnings("unchecked") - Map map = (Map) ((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 index 462d4668..00000000 --- a/src/java/org/mxchange/pizzaapplication/basket/Basket.java +++ /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 . - */ -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 Any addable basket items - */ -public interface Basket 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 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 index 51aaa066..00000000 --- a/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java +++ /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 . - */ -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 implements Basket { - /** - * 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/basket/BasketBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java deleted file mode 100644 index 2365701d..00000000 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java +++ /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 . - */ -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 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 index ce19d151..00000000 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java +++ /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 . - */ -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 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 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/PizzaBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java similarity index 95% rename from src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java rename to src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java index 142e678b..ce1e6dda 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java @@ -14,9 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaapplication.beans; +package org.mxchange.pizzaapplication.beans.controller; -import java.io.Serializable; import java.util.Iterator; import javax.faces.FacesException; import javax.servlet.ServletContext; @@ -25,18 +24,19 @@ 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; +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 Serializable { +public interface PizzaBean extends FrameworkBean { /** * Some "getter" for amount from session * diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java similarity index 83% rename from src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java rename to src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java index 17843ba1..115632a1 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaapplication.beans; +package org.mxchange.pizzaapplication.beans.controller; import java.io.IOException; import java.sql.SQLException; @@ -23,25 +23,21 @@ 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.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; -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 @@ -50,41 +46,23 @@ import org.mxchange.pizzaapplication.product.Product; */ @Named("controller") @SessionScoped -public class PizzaServiceBean implements PizzaBean { +public class PizzaServiceBean extends BaseFrameworkBean 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.getLogger().debug("INITIALIZER!"); //NOI18N this.app = new PizzaServiceApplication(); } @@ -404,64 +382,6 @@ public class PizzaServiceBean implements PizzaBean { 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 diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java index 238c15b3..ffe424ab 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java @@ -16,20 +16,20 @@ */ 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 * diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java index 327a88f9..901ac079 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java @@ -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 index 458ede09..00000000 --- a/src/java/org/mxchange/pizzaapplication/beans/item/BasketItemBean.java +++ /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 . - */ -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 index 05fcaf93..00000000 --- a/src/java/org/mxchange/pizzaapplication/beans/item/ItemBean.java +++ /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 . - */ -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 index 337504bd..00000000 --- a/src/java/org/mxchange/pizzaapplication/category/BaseCategory.java +++ /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 . - */ -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 index d04f2ec1..00000000 --- a/src/java/org/mxchange/pizzaapplication/category/Category.java +++ /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 . - */ -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 { - - /** - * 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 index 8cf78445..00000000 --- a/src/java/org/mxchange/pizzaapplication/category/product/ProductCategory.java +++ /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 . - */ -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 index 91ede812..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/basket/BasketDatabaseConstants.java +++ /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 . - */ -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 index 9b7f6433..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketDatabaseFrontend.java +++ /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 . - */ -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 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 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 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 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 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> iterator = map.entrySet().iterator(); - - // Init object instance - Storable instance = new BasketItem(); - - // Iterate over all - while (iterator.hasNext()) { - // Get next entry - Map.Entry 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 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 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 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 result = this.getBackend().doSelectByCriteria(criteria); - - // Trace message - this.getLogger().debug(MessageFormat.format("result={0} - EXIT!", result)); //NOI18N - - // Return it - return result; - } - - @Override - public Map 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 result = this.getBackend().doSelectByCriteria(criteria); - - // Now convert it to a map - Set set = result.resultSet(); - - // Debug message - this.getLogger().debug("set=" + set); - - // Init map - Map 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 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 index 75391e81..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketFrontend.java +++ /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 . - */ -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 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 index 43a2cdcb..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java +++ /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 . - */ -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 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 index 0afecbc9..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java +++ /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 . - */ -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 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 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 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) 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 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 getResultFromSet (final ResultSet resultSet) throws SQLException { - // Trace message - this.getLogger().trace(MessageFormat.format("resultSet={0} - CALLED!", resultSet)); //NOI18N - - // Init result instance - Result 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 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 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> iterator = map.entrySet().iterator(); - - // Init object instance - Storable instance = new ProductCategory(); - - // Iterate over all - while (iterator.hasNext()) { - // Get next entry - Map.Entry 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 index 207cfaa6..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java +++ /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 . - */ -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 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 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 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) iterator; - } - - @Override - @SuppressWarnings("unchecked") - public Iterator 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 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) 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 getResultFromSet (final ResultSet resultSet) throws SQLException { - // Trace message - this.getLogger().trace(MessageFormat.format("resultSet={0} - CALLED!", resultSet)); //NOI18N - - // Init result instance - Result 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 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 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> iterator = map.entrySet().iterator(); - - // Init object instance - Storable instance = new PizzaProduct(); - - // Iterate over all - while (iterator.hasNext()) { - // Get next entry - Map.Entry 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 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 index 6e71d77c..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java +++ /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 . - */ -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 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 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 index 5295d62c..00000000 --- a/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java +++ /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 . - */ -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 index c36c59f5..00000000 --- a/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java +++ /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 . - */ -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 - } -} diff --git a/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java b/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java index 367a904b..13209def 100644 --- a/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java +++ b/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java @@ -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 index 53150794..00000000 --- a/src/java/org/mxchange/pizzaapplication/item/AddableBasketItem.java +++ /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 . - */ -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 { - - /** - * 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 index 03a7e072..00000000 --- a/src/java/org/mxchange/pizzaapplication/item/BaseItem.java +++ /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 . - */ -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 index 0cc17af0..00000000 --- a/src/java/org/mxchange/pizzaapplication/item/basket/BasketItem.java +++ /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 . - */ -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 index 47191a06..00000000 --- a/src/java/org/mxchange/pizzaapplication/product/BaseProduct.java +++ /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 index ee4620bf..00000000 --- a/src/java/org/mxchange/pizzaapplication/product/Product.java +++ /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 . - */ -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 { - /** - * 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 index 82c43fa9..00000000 --- a/src/java/org/mxchange/pizzaapplication/product/pizza/PizzaProduct.java +++ /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 . - */ -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); - } -} diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java index 645f0b2b..139e50b1 100644 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java +++ b/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java @@ -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; /** * diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java index 2acf5258..f487690e 100644 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java +++ b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java @@ -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. diff --git a/web/WEB-INF/tlds/basket.tld b/web/WEB-INF/tlds/basket.tld index cd63a914..234caf26 100644 --- a/web/WEB-INF/tlds/basket.tld +++ b/web/WEB-INF/tlds/basket.tld @@ -3,7 +3,7 @@ 1.0 1.2 basket - http://mxchange.org/pizza-service/tags/basket + http://mxchange.org/jshop/tags/basket mini_basket @@ -14,7 +14,7 @@ Basket instance, should be the same as the bean true true - org.mxchange.pizzaapplication.beans.basket.BasketBean + org.mxchange.jshop.beans.basket.BasketBean diff --git a/web/admin/category.jsp b/web/admin/category.jsp index 744b04bb..3485e12a 100644 --- a/web/admin/category.jsp +++ b/web/admin/category.jsp @@ -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" %> - + diff --git a/web/admin/index.jsp b/web/admin/index.jsp index 0983d611..105b5fab 100644 --- a/web/admin/index.jsp +++ b/web/admin/index.jsp @@ -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"%> - + <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> diff --git a/web/admin/product.jsp b/web/admin/product.jsp index 71221e72..81029241 100644 --- a/web/admin/product.jsp +++ b/web/admin/product.jsp @@ -10,11 +10,11 @@ <%@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"%> - +<%@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"%> + <%controller.init();%> diff --git a/web/bye.jsp b/web/bye.jsp index 199bd4bf..01a7d407 100644 --- a/web/bye.jsp +++ b/web/bye.jsp @@ -5,7 +5,7 @@ --%> <%--<%@page errorPage="errorHandler.jsp" %>--%> -<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> +<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%> diff --git a/web/customer/login.jsp b/web/customer/login.jsp index a9d408a5..31f87923 100644 --- a/web/customer/login.jsp +++ b/web/customer/login.jsp @@ -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" %> diff --git a/web/customer/register.jsp b/web/customer/register.jsp index 5ac0bafe..d813528f 100644 --- a/web/customer/register.jsp +++ b/web/customer/register.jsp @@ -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" %> diff --git a/web/form_handler/add_item.jsp b/web/form_handler/add_item.jsp index 3362d09e..4e55adb7 100644 --- a/web/form_handler/add_item.jsp +++ b/web/form_handler/add_item.jsp @@ -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"%> - + <%controller.init();%> - + <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> diff --git a/web/index.jsp b/web/index.jsp index 9407f3f9..9a2b0eb0 100644 --- a/web/index.jsp +++ b/web/index.jsp @@ -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" %> - +<%@taglib prefix="basket" uri="http://mxchange.org/jshop/tags/basket" %> + diff --git a/web/static/admin/admin_category_selection_box.jsp b/web/static/admin/admin_category_selection_box.jsp index d6187af5..62332e34 100644 --- a/web/static/admin/admin_category_selection_box.jsp +++ b/web/static/admin/admin_category_selection_box.jsp @@ -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"%> - +<%@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"%> + -- 2.39.5