From 371159a07fe48df4152dc25b6d2f5e0fb65d7439 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 4 Sep 2015 23:42:30 +0200 Subject: [PATCH] =?utf8?q?Binded=20to=20jshop-core=20+=20added=20it=20Sign?= =?utf8?q?ed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jshop-core.jar | Bin 0 -> 28048 bytes nbproject/build-impl.xml | 14 +- nbproject/genfiles.properties | 6 +- nbproject/project.properties | 5 +- nbproject/project.xml | 18 +- .../application/PizzaApplication.java | 206 --------- .../application/PizzaServiceApplication.java | 412 ------------------ .../beans/controller/PizzaServiceWebBean.java | 13 +- .../beans/controller/PizzaWebBean.java | 8 +- 9 files changed, 32 insertions(+), 650 deletions(-) create mode 100644 lib/jshop-core.jar delete mode 100644 src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java delete mode 100644 src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java diff --git a/lib/jshop-core.jar b/lib/jshop-core.jar new file mode 100644 index 0000000000000000000000000000000000000000..feda701b1145bb8e0f90a0dd25b725b116c38425 GIT binary patch literal 28048 zcmeHQYiu0Xbw0aXa(0(Pkz7)wL`gP9Q4$~GL!#aiC6g3sQz9kVq!iOiY%P}~YNh2a zwY#)LJ8|NqaT26R3$$sH255lh(U*U;s6$C{Qm0Ld7C}%HMS%b*&=&rYrUlvn0a^qI z;PyNB&UpBsv>csDADh|+4&^d{>3Ol)8n%v zeUld_2HyDr(PgvfH&FDa3GHi(D9%SS4zuX=$i>Nt@tN8F>51uNHhn`Y6#K4f`9eCE zJ=uP+f3Pk-lC@nKSx%;IYVEj&nMW%jFjb{7cm7C6?}`ZYHyfTA8A)?xME}H*?FW zT)x~x9sUn#_fpz2ccM_H(Ov$}FXa}rOqoYJD?K`&EZo+LWoqaSSVOv~EtRQeU!`hN z81Kbgezi;;{ekOP&gT|ZQsuf;nVywGF}I}U%g|G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{+PA8mz@`D8YPm}D&GK@=#9goZ&GA;f ze*@#}Q?JdI7@Ic4u5kbN$h({Up6j*NRMr~`TXnyE*J|}{gKw)2Tfzf{ z1FOs4>~y~e%4*>f*1~-HxXGU;>ed_gJ{GHmpB)R@f-p3CbKXPa-ZWvg@>Ar!l(-4VrgX+_hIO|KM7{`i<$(6`1QnTwTLecHsZduo>>NN&fXejEzkT literal 0 HcmV?d00001 diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index ef45db9e..ccedafe3 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -1022,30 +1022,32 @@ exists or setup the property manually. For example like this: + + + - - - + + + + - - - + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 3c858bbd..d9320034 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=d470fc14 +build.xml.data.CRC32=46935672 build.xml.script.CRC32=82213886 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=d470fc14 -nbproject/build-impl.xml.script.CRC32=617ba396 +nbproject/build-impl.xml.data.CRC32=46935672 +nbproject/build-impl.xml.script.CRC32=1654f0fc nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index 54cd9348..5a0eb9bb 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -34,6 +34,7 @@ file.reference.commons-lang3-3.4.jar=lib/commons-lang3-3.4.jar file.reference.gf-client.jar=lib/gf-client.jar file.reference.jcore.jar=lib/jcore.jar file.reference.jsfcore.jar=lib/jsfcore.jar +file.reference.jshop-core.jar=lib/jshop-core.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 @@ -61,7 +62,8 @@ javac.classpath=\ ${file.reference.commons-lang3-3.4.jar}:\ ${file.reference.log4j-api-2.3.jar}:\ ${file.reference.log4j-core-2.3.jar}:\ - ${file.reference.log4j-web-2.3.jar} + ${file.reference.log4j-web-2.3.jar}:\ + ${file.reference.jshop-core.jar} # Space-separated list of extra javac options javac.compilerargs= javac.debug=true @@ -100,6 +102,7 @@ runmain.jvmargs= source.encoding=UTF-8 source.reference.jcore.jar=../jcore/src/ source.reference.jsfcore.jar=../jsfcore/src/ +source.reference.jshop-core.jar=../jshop-core/src/ source.reference.jshop.jar=../jshop/src/ source.root=src src.dir=${source.root}/java diff --git a/nbproject/project.xml b/nbproject/project.xml index b8af222c..2ce44c6d 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -7,31 +7,31 @@ 1.6.5 - ${file.reference.cdi-api.jar} + ${file.reference.jcore.jar} WEB-INF/lib - ${file.reference.gf-client.jar} + ${file.reference.jsfcore.jar} WEB-INF/lib - ${file.reference.commons-codec-1.10.jar} + ${file.reference.jshop.jar} WEB-INF/lib - ${file.reference.commons-lang3-3.4.jar} + ${file.reference.cdi-api.jar} WEB-INF/lib - ${file.reference.jcore.jar} + ${file.reference.gf-client.jar} WEB-INF/lib - ${file.reference.jsfcore.jar} + ${file.reference.commons-codec-1.10.jar} WEB-INF/lib - ${file.reference.jshop.jar} + ${file.reference.commons-lang3-3.4.jar} WEB-INF/lib @@ -46,6 +46,10 @@ ${file.reference.log4j-web-2.3.jar} WEB-INF/lib + + ${file.reference.jshop-core.jar} + WEB-INF/lib + diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java deleted file mode 100644 index e0d4385b..00000000 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java +++ /dev/null @@ -1,206 +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.application; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.sql.SQLException; -import java.util.Deque; -import java.util.Iterator; -import org.mxchange.jcore.application.Application; -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 PizzaApplication extends Application { - /** - * Some "getter" for a linked list of only available products - * - * @return Only available products - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public Deque getAvailableProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Some "getter" for a linked list of all products - * - * @return All products - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public Deque getAllProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Some "getter" for a linked list of all categories - * - * @return All categories - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public Deque getAllCategories () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Initializes this instance with given ServletContext - * - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.io.IOException If an IO error occurs - */ - public void init () throws SQLException, IOException; - - /** - * Some "getter" for a an array of only available products - * - * @return Only available products - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public Iterator getAvailableProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Some "getter" for a an array of all products - * - * @return All products - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public Iterator getAllProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Some "getter" for a an array of all categories - * - * @return All categories - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public Iterator getAllCategoriesIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Generates a link for category's parent category. If none is given, the method will return only a small - * note. - * - * @param category Category instance - * @return HTML link for category's parent category - * @deprecated Old lost code - */ - @Deprecated - public String generateLinkForParent (final Category category); - - /** - * Checks if given Product instance is available and returns a printable - * (human-readable) string. - * - * @param product Product instance to check - * @return Human-readable version of product availability - * @deprecated Old lost code - */ - @Deprecated - public String getPrintableProductAvailability (final Product product); - - /** - * Returns a printable (human-readable) string of product's category - * - * @param product Product instance to check - * @return Human-readable version of product availability - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - * @deprecated Old lost code - */ - @Deprecated - public String getPrintableProductCategory (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; - - /** - * Adds given category data from request to database - * - * @param category Category instance - * @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException The category's title is already used - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - */ - public void doAdminAddCategory (final Category category) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException; - - /** - * Adds given product data from request to database - * - * @param product Product instance - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - * @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the product's title is already used - */ - public void doAdminAddProduct (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException; - - /** - * Handles admin product form requests - * - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - * @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the product's title is already used - * @deprecated Old lost code - */ - @Deprecated - public void doAdminHandleProductForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException; - - /** - * Handles admin category form requests - * - * @throws java.io.IOException If an IO error occurs - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.lang.NoSuchMethodException If a method was not found - * @throws java.lang.IllegalAccessException If the method cannot be accessed publicly - * @throws java.lang.reflect.InvocationTargetException If something else happens? - * @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException The category's title is already used - * @deprecated - */ - @Deprecated - public void doAdminHandleCategoryForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException; -} diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java deleted file mode 100644 index 5eda780d..00000000 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ /dev/null @@ -1,412 +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.application; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.sql.SQLException; -import java.text.MessageFormat; -import java.util.Deque; -import java.util.Iterator; -import org.mxchange.jcore.BaseFrameworkSystem; -import org.mxchange.jsfcore.BaseServletSystem; -import org.mxchange.jshop.category.Category; -import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException; -import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException; -import org.mxchange.jshop.product.Product; - -/** - * Main application class - * - * @author Roland Haeder - */ -public class PizzaServiceApplication extends BaseServletSystem implements PizzaApplication { - /** - * Default constructor - */ - public PizzaServiceApplication () { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - } - - @Override - public Deque getAllCategories () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Deligate to frontend - return this.categoryFrontend.getAllCategories(); - } - - @Override - public Deque getAllProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Deligate to frontend - return this.productFrontend.getAllProducts(); - } - - @Override - public Deque getAvailableProducts () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Deligate to frontend - return this.productFrontend.getAllAvailableProducts(); - } - - @Override - public void init () throws SQLException { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Is the bundle initialized? - if (!BaseFrameworkSystem.isBundledInitialized()) { - // Temporary initialize default bundle - // TODO The enum Gender uses this - this.initBundle(); - } - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - public void doBootstrap () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - public void doMainLoop () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - public void doShutdown () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - @Deprecated - public String getPrintableProductAvailability (final Product product) { - // Trace message - this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N - - // Is it null? - if (null == product) { - // Should not be null - throw new NullPointerException("product is null"); //NOI18N - } - - // Get availability - if (product.getAvailable() == true) { - // Is available - return "Ja"; - } else { - // Not, not for public - return "Nein"; - } - } - - @Override - @SuppressWarnings ("unchecked") - public Iterator getAvailableProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Ask frontend for a list of products - return this.productFrontend.getAvailableProductsIterator(); - } - - @Override - @SuppressWarnings ("unchecked") - public Iterator getAllProductsIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Ask frontend for a list of products - return this.productFrontend.getAllProductsIterator(); - } - - @Override - @SuppressWarnings ("unchecked") - public Iterator getAllCategoriesIterator () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - - // Ask frontend for a list of categories - return this.categoryFrontend.getAllCategoriesIterator(); - } - - /** - * Checks whether given category title is already used - * - * @param title Title of category to check - * @return Whether it has been found - */ - private boolean isCategoryTitleUsed(final String title) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - // Trace message - this.getLogger().trace("title=" + title + " - CALLED!"); //NOI18N - - // Delegate to frontend - return this.categoryFrontend.isCategoryTitleUsed(title); - } - - @Override - public void doAdminAddCategory (final Category category) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException { - // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N - - // category must not be null - if (null == category) { - // Is null - throw new NullPointerException("category is null"); //NOI18N - } - - // Get all fields - String title = category.getTitle(); - Long parentId = category.getParentId(); - - // Debug message - this.getLogger().debug(MessageFormat.format("title={0},parentId={1}", title, parentId)); //NOI18N - - // Init variables for casting - Integer id = 0; - - // Check all fields - if (null == title) { - // "title" not set - throw new IllegalArgumentException("title is not set."); //NOI18N - } else if (title.isEmpty()) { - // Is left empty - throw new IllegalArgumentException("title is empty."); //NOI18N - } else if ((parentId == null) || (parentId == 0)) { - // Is left empty - throw new IllegalArgumentException("parentId is empty."); //NOI18N - } - - // Try to check if title is used already - if (this.isCategoryTitleUsed(title)) { - // Title already used - throw new CategoryTitleAlreadyUsedException(category); - } - - // The category is not found, so add it to database - this.categoryFrontend.addCategory(title, id); - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - public void doAdminAddProduct (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException { - // Trace message - this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N - - // product must not be null - if (null == product) { - // Is null - throw new NullPointerException("product is null"); //NOI18N - } - - // Get title, price and category id - String title = product.getTitle(); - Float price = product.getPrice(); - Long categoryId = product.getCategoryId(); - Boolean available = product.getAvailable(); - - // Debug message - this.getLogger().debug(MessageFormat.format("title={0},price={1},categoryId={2},available={3}", title, price, categoryId, available)); //NOI18N - - // Check all fields - if (null == title) { - // "title" not set - throw new IllegalArgumentException("product title is not set"); //NOI18N - } else if (title.isEmpty()) { - // Is left empty - throw new IllegalArgumentException("product title is empty"); //NOI18N - } else if (null == price) { - // "price" not set - throw new IllegalArgumentException("product price is not set."); //NOI18N - } else if (null == categoryId) { - // "title" not set - throw new IllegalArgumentException("product category id is not set."); //NOI18N - } else if (null == available) { - // "title" not set - throw new IllegalArgumentException("product availability not set."); //NOI18N - } - - // Try to check if title is used already - if (this.isProductTitleUsed(product)) { - // Title already used - throw new ProductTitleAlreadyUsedException(product); - } - - // The product is not found, so add it to database - this.productFrontend.addProduct(title, price, categoryId, available); - - // Trace message - this.getLogger().trace("EXIT!"); //NOI18N - } - - @Override - @Deprecated - public String generateLinkForParent (final Category category) { - // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N - - // category must not be null - if (null == category) { - // Is null - throw new NullPointerException("category is null"); //NOI18N - } - - // Get parent id - Long parentId = category.getParentId(); - - // Is the id set? - if (parentId > 0) { - // Product HTML code for link - throw new UnsupportedOperationException(MessageFormat.format("parentId={0} - Unfinished!", parentId)); //NOI18N - } - - // No parent set - return "Keine"; - } - - @Override - @Deprecated - public String getPrintableProductCategory (final Product product) throws IOException, SQLException, 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 - } - - // Declare category - Category category; - - // Get Category instance from product over the frontend - category = this.categoryFrontend.getCategory(product); - - // Debug message - this.getLogger().debug(MessageFormat.format("categoryId={0}", category)); //NOI18N - - // Get decoded title - String title = category.getDecodedTitle(); - - // Trace message - this.getLogger().trace(MessageFormat.format("title={0} - EXIT!", title)); //NOI18N - - // Return it - return title; - } - - /** - * Checks if product's title is already used. - * - * @param product Product instance - * @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 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? - */ - private boolean isProductTitleUsed (final Product product) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", product)); //NOI18N - - // Init title - String title = product.getTitle(); - - // category must not be null and "title" must be found and non-empty - if (null == product) { - // Abort here - throw new NullPointerException("category is null"); //NOI18N - } else if (null == title) { - // title is not set - throw new IllegalArgumentException("product title is not set"); //NOI18N - } else if (title.isEmpty()) { - // Is left empty - throw new IllegalArgumentException("product title is empty"); //NOI18N - } - - // Default is not used - // TODO Call backend - throw new UnsupportedOperationException("not finished yet."); - - // Trace message - //this.getLogger().trace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N - - // Return it - //return isUsed; - } - - @Override - @Deprecated - public void doAdminHandleProductForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, ProductTitleAlreadyUsedException { - // Deprecated method called - throw new UnsupportedOperationException("Deprecated method called."); - } - - @Override - @Deprecated - public void doAdminHandleCategoryForms () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, CategoryTitleAlreadyUsedException { - // Deprecated method called - throw new UnsupportedOperationException("Deprecated method called."); - } - - /** - * Checks if category's title is already used. - * - * @param category Category instance - * @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 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? - */ - private boolean isCategoryTitleUsed (final Category category) throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - // Trace message - this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N - - // Init title - String title = category.getTitle(); - - // category must not be null and "title" must be found and non-empty - if (null == category) { - // Abort here - throw new NullPointerException("category is null"); //NOI18N - } else if (null == title) { - // title is not set - throw new IllegalArgumentException("category title is not set."); //NOI18N - } else if (title.isEmpty()) { - // Is left empty - throw new IllegalArgumentException("category title is empty."); //NOI18N - } - - // Default is not used - boolean isUsed = this.isCategoryTitleUsed(title); - - // Trace message - this.getLogger().trace(MessageFormat.format("isUsed={0} - EXIT!", isUsed)); //NOI18N - - // Return it - return isUsed; - } -} diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java index f3885dfe..6532d402 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java @@ -29,12 +29,9 @@ import javax.faces.FacesException; import javax.inject.Named; 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.jshopcore.exceptions.CategoryTitleAlreadyUsedException; +import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException; /** * Main application class @@ -49,18 +46,12 @@ public class PizzaServiceWebBean extends BaseFrameworkBean implements PizzaWebBe */ private static final long serialVersionUID = 58137539530279L; - /** - * Pizza application - */ - private final PizzaApplication app; - /** * Initializer block */ { // Get new application instance this.getLogger().debug("INITIALIZER!"); //NOI18N - this.app = new PizzaServiceApplication(); } /** diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java index 91deebe4..e28a03d0 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java @@ -22,8 +22,8 @@ import java.util.Iterator; import javax.faces.FacesException; import org.mxchange.jshop.beans.FrameworkBean; import org.mxchange.jshop.category.Category; -import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException; -import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException; +import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException; +import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException; import org.mxchange.jshop.product.Product; /** @@ -124,7 +124,7 @@ public interface PizzaWebBean extends FrameworkBean { * * @param category Category instance * @throws java.rmi.RemoteException If something unexpected happened - * @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException If the given title is already used + * @throws org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException If the given title is already used */ public void doAdminAddCategory (final Category category) throws RemoteException, CategoryTitleAlreadyUsedException; @@ -133,7 +133,7 @@ public interface PizzaWebBean extends FrameworkBean { * * @param product Product instance * @throws java.rmi.RemoteException If something unexpected happened - * @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the given product title is already used + * @throws org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException If the given product title is already used */ public void doAdminAddProduct (final Product product) throws RemoteException, ProductTitleAlreadyUsedException; -- 2.39.5