From 121b8ad3c14b055d76ecfd71cab3878668d1a349 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 27 Aug 2015 21:05:37 +0200 Subject: [PATCH] =?utf8?q?Continued=20with=20project:=20-=20started=20to?= =?utf8?q?=20refacture=20all=20JSPs=20towards=20JSFs=20-=20this=20requires?= =?utf8?q?=20a=20lot=20to=20be=20rewritten=20-=20moved=20some=20classes=20?= =?utf8?q?to=20better=20location=20-=20deleted=20some=20old=20JSPs=20-=20m?= =?utf8?q?oved=20constants=20from=20FooBarConstants=20class=20to=20proper?= =?utf8?q?=20interface=20-=20removed=20above=20mentioned=20classes=20-=20a?= =?utf8?q?dded=20interface=20BasketTag=20-=20updated=20jcore.jar=20Signed-?= =?utf8?q?off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jcore.jar | Bin 117254 -> 117379 bytes nbproject/project.properties | 6 +- .../BasePizzaServiceSystem.java | 6 + .../application/PizzaApplication.java | 2 + .../application/PizzaServiceApplication.java | 105 +++++-- .../pizzaapplication/basket/BaseBasket.java | 48 +-- .../basket/item/ItemBasket.java | 1 - .../pizzaapplication/beans/PizzaBean.java | 30 ++ .../beans/PizzaServiceBean.java | 92 +++++- .../beans/basket/BasketBean.java | 30 ++ .../beans/basket/ItemBasketBean.java | 75 ++++- .../beans/customer/CustomerBean.java | 276 +++++++++++++++++- .../customer}/PizzaServiceCustomerBean.java | 35 ++- .../frontend/category/CategoryFrontend.java | 12 + .../PizzaCategoryDatabaseFrontend.java | 19 +- .../product/PizzaProductDatabaseFrontend.java | 25 +- .../frontend/product/ProductFrontend.java | 20 ++ .../PizzaProductDatabaseConstants.java | 55 ---- .../CategoryTitleAlreadyUsedException.java | 5 +- .../ProductTitleAlreadyUsedException.java | 5 +- .../basket/BasketTag.java} | 30 +- .../tags/basket/MiniBasketTag.java | 35 ++- web/WEB-INF/tlds/basket.tld | 7 + web/admin/category.jsp | 14 +- web/admin/index.jsp | 5 +- web/admin/product.jsp | 13 +- web/form_handler/add_item.jsp | 8 +- web/form_handler/admin/do_category.jsp | 8 +- web/form_handler/admin/do_product.jsp | 8 +- web/form_handler/do_order.jsp | 53 ---- web/form_handler/do_preview.jsp | 71 ----- web/index.jsp | 14 +- .../admin/admin_category_selection_box.jsp | 8 +- .../admin_parent_category_selection_box.jsp | 8 +- web/static/gender_selection_box.jsp | 4 +- 35 files changed, 753 insertions(+), 380 deletions(-) rename src/java/org/mxchange/pizzaapplication/{customer/bean => beans/customer}/PizzaServiceCustomerBean.java (91%) delete mode 100644 src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java rename src/java/org/mxchange/pizzaapplication/{database/category/PizzaCategoryDatabaseConstants.java => tags/basket/BasketTag.java} (53%) delete mode 100644 web/form_handler/do_order.jsp delete mode 100644 web/form_handler/do_preview.jsp diff --git a/lib/jcore.jar b/lib/jcore.jar index 68d453786dc73ac35ef528ce3a68a76f5ba2bc4e..11b967e308d9a1e68b2d54167d9f1ae0f614b798 100644 GIT binary patch delta 9339 zcmZ`f33wD$(p5E+>CU7BNrZ%ukoyiHoPls9oB_g3Ku#eL?r_K<3PM0pSwOA^8#!EI z5igEFAmJv0fVe24%c`Kl?vK0bDvPTtA|ij)>&ax2#re|xUcXoOt5;R8JI}7yp5CAt z{qr48H-HXsaq(IsReyhRMBbAHH|nhIFxjtF#@H6k*S@(S;UW)$&(F#I8M7v4`XZY} zm`WEHo2xNXno4XZ%{|PLCdid&eo>?aO`JQqCeowSTITmT64&kVuOW=NTH~=`v!TN+ z5J`@%(iA(o*zj$nVGuLO86n*aXPz{VIrF7C?d&d1fL{k`diiyd=6SyyX#}bChv1sb zf?RE7?omp#-YZA9yV@uMZ)GgSVDqR;NpjBBLqLNyC3&%fsWs58{%g>vNpiK8D{z;z zR?<{rqIK;>beS`CS4}vkP&LyaSS&sL+M+?H3jpM5Y!0{(YOa~^khSM9x=P;t?Z^qX zeGB@B8w`BYj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_`F+`cRmBklOrhjr7s{$T`|RJq}~#>s{Hz@z0U){4()EqO>0` zdB`JeofUUNRlD}QF72&%;#|_kyq~1#TWu=yhKtP7@J}DQ$`)LWu-_QOuONq>h%KwX z%ZL=>mM5N3#QRU4GUR^g*`aP}uU*)f#clao54MYv&UZC%cDi&%<)bC~%6~7w?!sGM z*aZs|&9XuGxtLQvbtv`_Y~>%0!&Rg}e6pj#=_+hk6|$$~V^aCjiP%tae>fSl1$X(+ zQ?a?~!Rw?RljrpCj$PrI;t}6`qwgb2G{( zOncmBl+T>@j?F0FIah4KE^^y-3(7}O`(hc^vNvzRdU7+goNsROTXDImUxt08UAmJ8 z-z-D2@u~Oz54wE@M&%zpZ z%i~xjQ9?6oO092~@y?ZBBi>H_f9vKQ9quPLt;r)JtfeD7c9-3byaBse-uok&pt_YX z!($~r=CxPv#wwz#ROUt$`Q}XfDvv8wft|%cnCsWW?Yen8$N44Mt@mIZkuq!#OPMf{ z$7@^RkB3@0lRWnOdmQb%Wv=rQHFtMOSYSMAFORQWZq;9rVGr1grqbH&+KW|}@Znm1 zIhC}oTw~Q=n`dv_@1tCkH0Q`!#wNeaN|aOIVaj;>&R&caY_a=T&(il~%({Cx!XCBH zvHVFH-@4H^ZdembtJ%Hw`mC?W0RSy4NiW)|I1+ayC@i9(`+kZTyX+Pkt>bQBAR@9K_C|XwN}bbg;89C0M0b3_GJM zM%zyxa?Hs%#IvD;{IfOHghFuW$C#MgTqNb!w36)ahd8KDf2mtbzYn*+VOfghz}n)1 z9vlJks~n{djPtXE+4+Zk6$ZevK=Ed0?`TRV~7#IdU8hiuijsm{#l2n@CFKEVs%pI#u-8>UxGub7F6cJU1K*r$#-`{Z{aSv)g9 z5@xqJ;-tngM|kG7SVBL_E-&|!7 getAvailableProducts () throws ServletException { + // categoryFrontend must be set + if (null == this.productFrontend) { + // Abort here + throw new NullPointerException("productFrontend is null"); + } + try { // Ask frontend for a list of products return this.productFrontend.getAvailableProducts(); @@ -506,6 +518,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P */ @Override public Iterator getAllProducts () throws ServletException { + // Trace message + this.getLogger().trace("CALLED!"); + + // categoryFrontend must be set + if (null == this.productFrontend) { + // Abort here + throw new NullPointerException("productFrontend is null"); + } + try { // Ask frontend for a list of products return this.productFrontend.getAllProducts(); @@ -521,6 +542,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P */ @Override public Iterator getCategories () throws ServletException { + // Trace message + this.getLogger().trace("CALLED!"); + + // categoryFrontend must be set + if (null == this.categoryFrontend) { + // Abort here + throw new NullPointerException("categoryFrontend is null"); + } + try { // Ask frontend for a list of categories return this.categoryFrontend.getCategories(); @@ -539,6 +569,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P * @return Amount as string */ @Override + @Deprecated public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) { // Trace message this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N @@ -1056,6 +1087,12 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P * @return Whether it has been found */ private boolean isCategoryTitleUsed(final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + // categoryFrontend must be set + if (null == this.categoryFrontend) { + // Abort here + throw new NullPointerException("categoryFrontend is null"); + } + // Delegate to frontend return this.categoryFrontend.isCategoryTitleUsed(title); } @@ -1066,6 +1103,12 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P * @return Whether the product title has already been used */ private boolean isProductTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + // categoryFrontend must be set + if (null == this.productFrontend) { + // Abort here + throw new NullPointerException("productFrontend is null"); + } + // Delegate to frontend return this.productFrontend.isProductTitleUsed(title); } @@ -1126,8 +1169,8 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P } // Get all fields - String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE); - String parent = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_PARENT); + String title = request.getParameter(CategoryFrontend.COLUMN_TITLE); + String parent = request.getParameter(CategoryFrontend.COLUMN_PARENT); // Debug message this.getLogger().debug(MessageFormat.format("title={0},parent={1}", title, parent)); //NOI18N @@ -1138,10 +1181,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // Check all fields if (null == title) { // "title" not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N } else if (title.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N } else if ((parent != null) && (!parent.isEmpty())) { // "parent" is set, so check it try { @@ -1191,10 +1234,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P } // Get title, price and category id - String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE); - String price = request.getParameter(PizzaProductDatabaseConstants.COLUMN_PRICE); - String category = request.getParameter(PizzaProductDatabaseConstants.COLUMN_CATEGORY); - String available = request.getParameter(PizzaProductDatabaseConstants.COLUMN_AVAILABLE); + String title = request.getParameter(ProductFrontend.COLUMN_TITLE); + String price = request.getParameter(ProductFrontend.COLUMN_PRICE); + String category = request.getParameter(ProductFrontend.COLUMN_CATEGORY); + String available = request.getParameter(ProductFrontend.COLUMN_AVAILABLE); // Debug message this.getLogger().debug(MessageFormat.format("title={0},price={1},category={2},available={3}", title, price, category, available)); //NOI18N @@ -1206,31 +1249,31 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // Check all fields if (null == title) { // "title" not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N } else if (title.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N } else if (null == price) { // "price" not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_PRICE)); //NOI18N } else if (price.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_PRICE)); //NOI18N } else if (null == category) { // "title" not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N } else if (category.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N } else if (null == available) { // "title" not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N } else if (available.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N } else if ((!"true".equals(available)) && (!"false".equals(available))) { //NOI18N // Invalid value - throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", ProductFrontend.COLUMN_AVAILABLE, available)); //NOI18N } // Parse numbers @@ -1357,7 +1400,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N // Init title - String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE); + String title = request.getParameter(ProductFrontend.COLUMN_TITLE); // request must not be null and "title" must be found and non-empty if (null == request) { @@ -1365,10 +1408,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P throw new NullPointerException("request is null"); //NOI18N } else if (null == title) { // title is not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N } else if (title.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N } // Default is not used @@ -1511,7 +1554,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N // Init title - String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE); + String title = request.getParameter(CategoryFrontend.COLUMN_TITLE); // request must not be null and "title" must be found and non-empty if (null == request) { @@ -1519,10 +1562,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P throw new NullPointerException("request is null"); //NOI18N } else if (null == title) { // title is not set - throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N } else if (title.isEmpty()) { // Is left empty - throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N } // Default is not used diff --git a/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java b/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java index 85daa560..3645d04c 100644 --- a/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java +++ b/src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java @@ -17,7 +17,6 @@ package org.mxchange.pizzaapplication.basket; import java.io.IOException; -import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; @@ -45,6 +44,17 @@ public class BaseBasket extends BasePizzaServiceSys */ private static final long serialVersionUID = 784396762230845717L; + /** + * Protected constructor with session instance + * + * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend has been configured + * @throws java.sql.SQLException If an SQL error occurs + */ + protected BaseBasket () throws UnsupportedDatabaseBackendException, SQLException { + // Trace message + this.getLogger().trace("CALLED!"); //NOI18N + } + @Override public void init (final ServletContext context, final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException { // Trace message @@ -76,17 +86,6 @@ public class BaseBasket extends BasePizzaServiceSys this.setFrontend(frontend); } - /** - * Protected constructor with session instance - * - * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend has been configured - * @throws java.sql.SQLException If an SQL error occurs - */ - protected BaseBasket () throws UnsupportedDatabaseBackendException, SQLException { - // Trace message - this.getLogger().trace("CALLED!"); //NOI18N - } - @Override public void addItem (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Trace call @@ -164,29 +163,4 @@ public class BaseBasket extends BasePizzaServiceSys // Return it return isAdded; } - - /** - * Called when fields are set on deserialization - * - * @param in Object input stream - * @throws IOException If any IO error occurs - * @throws ClassNotFoundException If the class is not found - */ - private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { - // Trace message - this.getLogger().trace(MessageFormat.format("in={0} - CALLED!", in)); - - try { - // Init everything else - - // Init frontend - BasketFrontend frontend = new BasketDatabaseFrontend(); - - // Set it here - this.setFrontend(frontend); - } catch (final UnsupportedDatabaseBackendException | SQLException ex) { - // Continue to throw - throw new IOException(ex); - } - } } diff --git a/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java b/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java index ae34890f..51aaa066 100644 --- a/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java +++ b/src/java/org/mxchange/pizzaapplication/basket/item/ItemBasket.java @@ -35,7 +35,6 @@ public class ItemBasket extends BaseBasket implements Basket< /** * Default constructor to be able to throw exceptions from super constructor - * @param context Context instance * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported * @throws java.sql.SQLException If an SQL error occurs */ diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java b/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java index 00188ca3..539b0e7b 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/PizzaBean.java @@ -19,10 +19,13 @@ package org.mxchange.pizzaapplication.beans; import java.io.Serializable; import java.util.Iterator; import javax.faces.FacesException; +import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.logging.log4j.Logger; +import org.mxchange.pizzaapplication.beans.basket.BasketBean; import org.mxchange.pizzaapplication.category.Category; import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException; import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException; @@ -304,4 +307,31 @@ public interface PizzaBean extends Serializable { * @throws ServletException If something unexpected happened */ public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException; + + /** + * Getter for logger + * + * @return Logger + */ + public Logger getLogger (); + + /** + * @return the basket + */ + public BasketBean getBasket (); + + /** + * @param basket the basket to set + */ + public void setBasket (final BasketBean basket); + + /** + * @return the application + */ + public ServletContext getApplication (); + + /** + * @param application the application to set + */ + public void setApplication (final ServletContext application); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java index 7248b7d7..7ff4e8ba 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java @@ -29,6 +29,8 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.mxchange.jcore.exceptions.BadTokenException; import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException; import org.mxchange.pizzaapplication.application.PizzaApplication; @@ -69,32 +71,49 @@ public class PizzaServiceBean implements PizzaBean { */ private final PizzaApplication app; + /** + * Class' logger + */ + private final Logger LOG; + /** * Initializer block */ { // Get new application instance + LOG = LogManager.getLogger(this); + LOG.debug("INITIALIZER!"); this.app = new PizzaServiceApplication(); } + /** + * Default constructor + */ + public PizzaServiceBean () { + this.getLogger().trace("CALLED!"); + } + @Override @PostConstruct public void init () throws FacesException { + // Trace message + this.getLogger().trace("application=" + this.getApplication() + ",basket=" + this.getBasket() + " - CALLED!"); + + // Must not be null + if (this.getApplication() == null) { + // Abort here + throw new NullPointerException("application is null"); + } + try { // Call init method - this.app.init(this.application); + this.app.init(this.getApplication()); } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) { // Continue to throw throw new FacesException(ex); } } - /** - * Default constructor - */ - public PizzaServiceBean () { - } - /** * Calculates total amount of all choosen products * @@ -248,6 +267,7 @@ public class PizzaServiceBean implements PizzaBean { * @return Amount as string */ @Override + @Deprecated public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) { return this.app.getTotalPositionPriceFromRequestSession(product, request, session); } @@ -381,4 +401,62 @@ public class PizzaServiceBean implements PizzaBean { public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException { this.app.doAdminHandleCategoryForms(request, response); } + + /** + * Getter for logger + * + * @return Logger + */ + @Override + public Logger getLogger () { + return this.LOG; + } + + /** + * @return the basket + */ + @Override + public BasketBean getBasket () { + // Trace message + this.getLogger().trace("basked=" + this.basket + " - EXIT!"); + + // Return it + return this.basket; + } + + /** + * @param basket the basket to set + */ + @Override + public void setBasket (final BasketBean basket) { + // Trace message + this.getLogger().trace("basked=" + basket + " - CALLED!"); + + // Set it here + this.basket = basket; + } + + /** + * @return the application + */ + @Override + public ServletContext getApplication () { + // Trace message + this.getLogger().trace("application=" + this.application + " - EXIT!"); + + // Return it + return this.application; + } + + /** + * @param application the application to set + */ + @Override + public void setApplication (final ServletContext application) { + // Trace message + this.getLogger().trace("application=" + application + " - CALLED!"); + + // Set it here + this.application = application; + } } diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java index 22d12224..c37e6322 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketBean.java @@ -21,6 +21,9 @@ import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; import javax.faces.FacesException; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSession; +import org.apache.logging.log4j.Logger; import org.mxchange.jcore.exceptions.BadTokenException; import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.pizzaapplication.item.AddableBasketItem; @@ -105,4 +108,31 @@ public interface BasketBean extends Serializable { * @return Human-readable message */ public String getMessageStringFromKey (final String key); + + /** + * Getter for logger + * + * @return Logger + */ + public Logger getLogger (); + + /** + * @return the application + */ + public ServletContext getApplication (); + + /** + * @param application the application to set + */ + public void setApplication (final ServletContext application); + + /** + * @return the session + */ + public HttpSession getSession (); + + /** + * @param session the session to set + */ + public void setSession (final HttpSession session); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java index 27a074ba..1a8f7663 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/basket/ItemBasketBean.java @@ -20,13 +20,15 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; import javax.annotation.PostConstruct; -import javax.enterprise.context.Dependent; +import javax.enterprise.context.SessionScoped; import javax.faces.FacesException; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.mxchange.jcore.exceptions.BadTokenException; import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException; @@ -41,7 +43,7 @@ import org.mxchange.pizzaapplication.product.Product; * @author Roland Haeder */ @Named("basket") -@Dependent +@SessionScoped public class ItemBasketBean implements BasketBean { /** * Serial number @@ -60,19 +62,35 @@ public class ItemBasketBean implements BasketBean { @Inject private HttpSession session; + /** + * Class' logger + */ + private final Logger LOG; + /** * Instance of wrapped basket */ private final Basket basket; + /** + * Initializer block + */ + { + // Get new application instance + this.basket = new ItemBasket(); + LOG = LogManager.getLogger(this); + } + /** * Default constructor to be able to throw exceptions from super constructor * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported * @throws java.sql.SQLException If an SQL error occurs + * @throws java.io.IOException If an IO Error occurs + * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found */ - public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException { - // Get new application instance - this.basket = new ItemBasket(); + public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException { + // Trace message + this.getLogger().trace("CALLED!"); } @Override @@ -93,9 +111,12 @@ public class ItemBasketBean implements BasketBean { @Override @PostConstruct public void init () throws FacesException { + // Trace message + this.getLogger().trace("application=" + this.getApplication() + ",session=" + this.getSession() + " - CALLED!"); + try { // Init instance - this.basket.init(this.application, this.session); + this.basket.init(this.getApplication(), this.getSession()); } catch (final UnsupportedDatabaseBackendException | IOException | SQLException | BadTokenException ex) { // Continue to throw throw new FaceletException(ex); @@ -111,4 +132,46 @@ public class ItemBasketBean implements BasketBean { public boolean isItemAdded (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { return this.basket.isItemAdded(item); } + + /** + * Getter for logger + * + * @return Logger + */ + @Override + public Logger getLogger () { + return this.LOG; + } + + /** + * @return the application + */ + @Override + public ServletContext getApplication () { + return this.application; + } + + /** + * @param application the application to set + */ + @Override + public void setApplication (final ServletContext application) { + this.application = application; + } + + /** + * @return the session + */ + @Override + public HttpSession getSession () { + return this.session; + } + + /** + * @param session the session to set + */ + @Override + public void setSession (final HttpSession session) { + this.session = session; + } } diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java index 12fc8fb6..238c15b3 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerBean.java @@ -16,12 +16,284 @@ */ package org.mxchange.pizzaapplication.beans.customer; -import org.mxchange.pizzaapplication.customer.Customer; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.Map; +import org.mxchange.jcore.client.Client; +import org.mxchange.jcore.contact.Gender; /** * An interface for customer beans * * @author Roland Haeder */ -public interface CustomerBean extends Customer { +public interface CustomerBean extends Serializable { + /** + * Returns an iterator of all values from this object + * + * @return An iterator + * @throws java.lang.NoSuchMethodException If the invoked method was not found + * @throws java.lang.IllegalAccessException If the method cannot be accessed + * @throws java.lang.reflect.InvocationTargetException Any other problems? + */ + public Iterator> iterator ()throws NoSuchMethodException, IllegalAccessException, InvocationTargetException; + + /** + * Some "getter" for translated gender of the contact + * + * @return Translated / human-readable gender + */ + public String getTranslatedGender (); + + /** + * Gender of the contact + * + * @return the gender + */ + public Gender getGender (); + + /** + * Gender of the contact + * + * @param gender the gender to set + */ + public void setGender (final Gender gender); + + /** + * First name + * + * @return the first name + */ + public String getFirstName (); + + /** + * First name + * + * @param firstName the first name to set + */ + public void setFirstName (final String firstName); + + /** + * Family name + * + * @return the familyName + */ + public String getFamilyName (); + + /** + * Family name + * + * @param familyName the familyName to set + */ + public void setFamilyName (final String familyName); + + /** + * Companyname + * + * @return the companyName + */ + public String getCompanyName (); + + /** + * Companyname + * + * @param companyName the companyName to set + */ + public void setCompanyName (final String companyName); + + /** + * Street + * + * @return the street + */ + public String getStreet (); + + /** + * Street + * + * @param street the street to set + */ + public void setStreet (final String street); + + /** + * House number + * + * @return the houseNumber + */ + public Long getHouseNumber (); + + /** + * House number + * + * @param houseNumber the houseNumber to set + */ + public void setHouseNumber (final Long houseNumber); + + /** + * ZIP code + * + * @return the zipCode + */ + public Long getZipCode (); + + /** + * ZIP code + * + * @param zipCode the zipCode to set + */ + public void setZipCode (final Long zipCode); + + /** + * City + * + * @return the city + */ + public String getCity (); + + /** + * City + * + * @param city the city to set + */ + public void setCity (final String city); + + /** + * Country code + * + * @return the countryCode + */ + public String getCountryCode (); + + /** + * Country code + * + * @param countryCode the countryCode to set + */ + public void setCountryCode (final String countryCode); + + /** + * Email address + * + * @return the emailAddress + */ + public String getEmailAddress (); + + /** + * Email address + * + * @param emailAddress the emailAddress to set + */ + public void setEmailAddress (final String emailAddress); + + /** + * Phone number + * + * @return the phoneNumber + */ + public String getPhoneNumber (); + + /** + * Phone number + * + * @param phoneNumber the phoneNumber to set + */ + public void setPhoneNumber (final String phoneNumber); + + /** + * Fax number + * + * @return the faxNumber + */ + public String getFaxNumber (); + + /** + * Fax number + * + * @param faxNumber the faxNumber to set + */ + public void setFaxNumber (final String faxNumber); + + /** + * Cellphone number + * + * @return the cellphoneNumber + */ + public String getCellphoneNumber (); + + /** + * Cellphone number + * + * @param cellphoneNumber the cellphoneNumber to set + */ + public void setCellphoneNumber (final String cellphoneNumber); + + /** + * Birth day + * + * @return the birthday + */ + public String getBirthday (); + + /** + * Birth day + * + * @param birthday the birthday to set + */ + public void setBirthday (final String birthday); + + /** + * Comments + * + * @return the comment + */ + public String getComment (); + + /** + * Comments + * + * @param comment the comment to set + */ + public void setComment (final String comment); + + /** + * Checks whether the contact is user's own data + * + * @return Own data? + */ + public boolean isOwnContact (); + + /** + * Shows the contact to the user + * + * @param client Client instance to call back + */ + public void show (final Client client); + + /** + * Some "getter for a value from given column name. This name will be + * translated into a method name and then this method is called. + * + * @param columnName Column name + * @return Value from field + * @throws IllegalArgumentException Some implementations may throw this + * @throws java.lang.NoSuchMethodException If the invoked method was not found + * @throws java.lang.IllegalAccessException If the method cannot be accessed + * @throws java.lang.reflect.InvocationTargetException Any other problems? + */ + public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException; + + /** + * Some "setter" for a value from given column name. You may wish to overwrite this method in your + * own class. + * + * @param columnName Column name + * @param value Value to set in object's field + * @throws IllegalArgumentException Some implementations may throw this + * @throws java.lang.NoSuchMethodException If the invoked method was not found + * @throws java.lang.IllegalAccessException If the method cannot be accessed + * @throws java.lang.reflect.InvocationTargetException Any other problems? + */ + public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException; } diff --git a/src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java similarity index 91% rename from src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java rename to src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java index d2fb8d70..327a88f9 100644 --- a/src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerBean.java @@ -14,16 +14,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaapplication.customer.bean; +package org.mxchange.pizzaapplication.beans.customer; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.Iterator; import java.util.Map; +import javax.enterprise.context.SessionScoped; +import javax.inject.Named; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.contact.Contact; import org.mxchange.jcore.contact.Gender; -import org.mxchange.pizzaapplication.BasePizzaServiceSystem; import org.mxchange.pizzaapplication.beans.customer.CustomerBean; import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer; @@ -32,7 +33,19 @@ import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer; * * @author Roland Haeder */ -public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements CustomerBean { +@Named("customer") +@SessionScoped +public class PizzaServiceCustomerBean implements CustomerBean { + /** + * Serial number + */ + private static final long serialVersionUID = 543145347916L; + + /** + * Contact instance + */ + private Contact contact; + /** * Default constructor */ @@ -266,4 +279,20 @@ public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements // Deligate to "hidden" object this.getContact().setValueFromColumn(columnName, value); } + + /** + * Setter for Contact instance + * @param contact Contact instance to set + */ + private void setContact (final Contact contact) { + this.contact = contact; + } + + /** + * Getter for Contact instance + * @return Contact instance + */ + private Contact getContact () { + return this.contact; + } } diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java index f6d8b380..82c65396 100644 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java +++ b/src/java/org/mxchange/pizzaapplication/database/frontend/category/CategoryFrontend.java @@ -32,6 +32,18 @@ import org.mxchange.pizzaapplication.product.Product; * @author Roland Häder */ public interface CategoryFrontend extends DatabaseFrontend { + /** + * Column name for "parent" + */ + public static final String COLUMN_PARENT = "parent"; //NOI18N + /** + * Column name for "title" + */ + public static final String COLUMN_TITLE = "title"; //NOI18N + /** + * Column name for "id" + */ + public static final String COLUMN_ID = "category_id"; //NOI18N /** * Adds given category title as new category, parent may be null if not diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java index aea48416..081484f5 100644 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java +++ b/src/java/org/mxchange/pizzaapplication/database/frontend/category/PizzaCategoryDatabaseFrontend.java @@ -34,7 +34,6 @@ import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException; import org.mxchange.pizzaapplication.category.Category; import org.mxchange.pizzaapplication.category.product.ProductCategory; -import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants; import org.mxchange.pizzaapplication.product.Product; /** @@ -83,8 +82,8 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen this.clearDataSet(); // Add title and parent - this.addToDataSet(PizzaCategoryDatabaseConstants.COLUMN_TITLE, title); - this.addToDataSet(PizzaCategoryDatabaseConstants.COLUMN_PARENT, parent); + this.addToDataSet(CategoryFrontend.COLUMN_TITLE, title); + this.addToDataSet(CategoryFrontend.COLUMN_PARENT, parent); // Handle this over to the backend // @todo Nothing is done yet! @@ -134,7 +133,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen if ((value instanceof String) && ("".equals(value))) { //NOI18N // This value may need to be changed switch (key) { - case PizzaCategoryDatabaseConstants.COLUMN_PARENT: // Convert this + case CategoryFrontend.COLUMN_PARENT: // Convert this v = null; break; } @@ -196,7 +195,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen SearchableCriteria criteria = new SearchCriteria(); // Add id to it - criteria.addCriteria(PizzaCategoryDatabaseConstants.COLUMN_ID, id); + criteria.addCriteria(CategoryFrontend.COLUMN_ID, id); // Only one entry is find criteria.setLimit(1); @@ -235,7 +234,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen @Override public String getIdName () { // Return column id - return PizzaCategoryDatabaseConstants.COLUMN_ID; + return CategoryFrontend.COLUMN_ID; } /** @@ -259,9 +258,9 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen // "Walk" through all entries while (resultSet.next()) { // Get id, title and parent id - Long id = resultSet.getLong(PizzaCategoryDatabaseConstants.COLUMN_ID); - String title = resultSet.getString(PizzaCategoryDatabaseConstants.COLUMN_TITLE); - Long parent = resultSet.getLong(PizzaCategoryDatabaseConstants.COLUMN_PARENT); + Long id = resultSet.getLong(CategoryFrontend.COLUMN_ID); + String title = resultSet.getString(CategoryFrontend.COLUMN_TITLE); + Long parent = resultSet.getLong(CategoryFrontend.COLUMN_PARENT); // Debug message this.getLogger().debug(MessageFormat.format("id={0},title={1},parent={2}", id, title, parent)); //NOI18N @@ -303,7 +302,7 @@ public class PizzaCategoryDatabaseFrontend extends BaseDatabaseFrontend implemen SearchableCriteria criteria = new SearchCriteria(); // Add criteria - criteria.addCriteria(PizzaCategoryDatabaseConstants.COLUMN_TITLE, title); + criteria.addCriteria(CategoryFrontend.COLUMN_TITLE, title); // Only one entry is find criteria.setLimit(1); diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java index 6059cf46..1c9008a9 100644 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java +++ b/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java @@ -32,7 +32,6 @@ import org.mxchange.jcore.database.storage.Storeable; import org.mxchange.jcore.exceptions.BadTokenException; import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException; import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException; -import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants; import org.mxchange.pizzaapplication.product.Product; import org.mxchange.pizzaapplication.product.pizza.PizzaProduct; @@ -91,10 +90,10 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement this.clearDataSet(); // Add title and parent - this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_TITLE, title); - this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_PRICE, price); - this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_CATEGORY, category); - this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available); + this.addToDataSet(ProductFrontend.COLUMN_TITLE, title); + this.addToDataSet(ProductFrontend.COLUMN_PRICE, price); + this.addToDataSet(ProductFrontend.COLUMN_CATEGORY, category); + this.addToDataSet(ProductFrontend.COLUMN_AVAILABLE, available); // Handle this over to the backend // @todo Nothing is done yet! @@ -197,7 +196,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement SearchableCriteria criteria = new SearchCriteria(); // Add criteria - criteria.addCriteria(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, true); + criteria.addCriteria(ProductFrontend.COLUMN_AVAILABLE, true); // Run the query Result result = this.getBackend().doSelectByCriteria(criteria); @@ -218,7 +217,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement @Override public String getIdName () { // Return column id - return PizzaProductDatabaseConstants.COLUMN_ITEM_ID; + return ProductFrontend.COLUMN_ITEM_ID; } /** @@ -242,11 +241,11 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement // "Walk" through all entries while (resultSet.next()) { // Get id, title and parent id - Long id = resultSet.getLong(PizzaProductDatabaseConstants.COLUMN_ITEM_ID); - String title = resultSet.getString(PizzaProductDatabaseConstants.COLUMN_TITLE); - Float price = resultSet.getFloat(PizzaProductDatabaseConstants.COLUMN_PRICE); - Long category = resultSet.getLong(PizzaProductDatabaseConstants.COLUMN_CATEGORY); - Boolean available = resultSet.getBoolean(PizzaProductDatabaseConstants.COLUMN_AVAILABLE); + Long id = resultSet.getLong(ProductFrontend.COLUMN_ITEM_ID); + String title = resultSet.getString(ProductFrontend.COLUMN_TITLE); + Float price = resultSet.getFloat(ProductFrontend.COLUMN_PRICE); + Long category = resultSet.getLong(ProductFrontend.COLUMN_CATEGORY); + Boolean available = resultSet.getBoolean(ProductFrontend.COLUMN_AVAILABLE); // Debug message this.getLogger().debug(MessageFormat.format("id={0},title={1},category={2},available={3}", id, title, category, available)); //NOI18N @@ -291,7 +290,7 @@ public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implement SearchableCriteria criteria = new SearchCriteria(); // Add criteria - criteria.addCriteria(PizzaProductDatabaseConstants.COLUMN_TITLE, title); + criteria.addCriteria(ProductFrontend.COLUMN_TITLE, title); // Only one entry is find criteria.setLimit(1); diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java index cb4146a3..6cc26149 100644 --- a/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java +++ b/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java @@ -31,6 +31,26 @@ import org.mxchange.pizzaapplication.product.Product; * @author Roland Häder */ public interface ProductFrontend extends DatabaseFrontend { + /** + * Column name for "item_id" + */ + public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N + /** + * Column name for "available" + */ + public static final String COLUMN_AVAILABLE = "available"; //NOI18N + /** + * Column name for "price" + */ + public static final String COLUMN_PRICE = "price"; //NOI18N + /** + * Column name for "category" + */ + public static final String COLUMN_CATEGORY = "category"; //NOI18N + /** + * Column name for "title" + */ + public static final String COLUMN_TITLE = "title"; //NOI18N /** * Adds product to database by given title, price and category id diff --git a/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java deleted file mode 100644 index d10a80e4..00000000 --- a/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.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.product; - -/** - * Holder class for database columns for product frontend - * - * @author Roland Haeder - */ -public final class PizzaProductDatabaseConstants { - /** - * Column name for "available" - */ - public static final String COLUMN_AVAILABLE = "available"; //NOI18N - - /** - * Column name for "category" - */ - public static final String COLUMN_CATEGORY = "category"; //NOI18N - - /** - * Column name for "item_id" - */ - public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N - - /** - * Column name for "price" - */ - public static final String COLUMN_PRICE = "price"; //NOI18N - - /** - * Column name for "title" - */ - public static final String COLUMN_TITLE = "title"; //NOI18N - - /** - * No instance from this class - */ - private PizzaProductDatabaseConstants () { - } -} diff --git a/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java b/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java index 08d4ceaa..5295d62c 100644 --- a/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java +++ b/src/java/org/mxchange/pizzaapplication/exceptions/CategoryTitleAlreadyUsedException.java @@ -18,7 +18,7 @@ package org.mxchange.pizzaapplication.exceptions; import java.text.MessageFormat; import javax.servlet.http.HttpServletRequest; -import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants; +import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend; /** * An exception thrown when the given title is already used @@ -34,7 +34,6 @@ public class CategoryTitleAlreadyUsedException extends Exception { */ public CategoryTitleAlreadyUsedException (final HttpServletRequest request) { // Call super constructor - super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE))); //NOI18N + super(MessageFormat.format("Title {0} is already used.", request.getParameter(CategoryFrontend.COLUMN_TITLE))); //NOI18N } - } diff --git a/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java b/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java index 568ba391..c36c59f5 100644 --- a/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java +++ b/src/java/org/mxchange/pizzaapplication/exceptions/ProductTitleAlreadyUsedException.java @@ -18,7 +18,7 @@ package org.mxchange.pizzaapplication.exceptions; import java.text.MessageFormat; import javax.servlet.http.HttpServletRequest; -import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants; +import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend; /** * An exception thrown when the given title is already used @@ -34,7 +34,6 @@ public class ProductTitleAlreadyUsedException extends Exception { */ public ProductTitleAlreadyUsedException (final HttpServletRequest request) { // Call super constructor - super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE))); //NOI18N + super(MessageFormat.format("Title {0} is already used.", request.getParameter(ProductFrontend.COLUMN_TITLE))); //NOI18N } - } diff --git a/src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java similarity index 53% rename from src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java rename to src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java index 4fde31e2..645f0b2b 100644 --- a/src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java +++ b/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Roland Haeder + * Copyright (C) 2015 quix0r * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,32 +14,24 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaapplication.database.category; +package org.mxchange.pizzaapplication.tags.basket; + +import javax.servlet.jsp.tagext.BodyTag; +import org.mxchange.pizzaapplication.beans.basket.BasketBean; /** - * Holder class for database columns for product frontend * - * @author Roland Haeder + * @author quix0r */ -public final class PizzaCategoryDatabaseConstants { - /** - * Column name for "id" - */ - public static final String COLUMN_ID = "category_id"; //NOI18N - - /** - * Column name for "parent" - */ - public static final String COLUMN_PARENT = "parent"; //NOI18N +public interface BasketTag extends BodyTag { /** - * Column name for "title" + * @return the basket */ - public static final String COLUMN_TITLE = "title"; //NOI18N + public BasketBean getBasket (); /** - * No instance from this class + * @param basket the basket to set */ - private PizzaCategoryDatabaseConstants () { - } + public void setBasket (final BasketBean basket); } diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java index d3c36ba4..1ec420a3 100644 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java +++ b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java @@ -19,8 +19,6 @@ package org.mxchange.pizzaapplication.tags.basket; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.sql.SQLException; -import javax.enterprise.context.SessionScoped; -import javax.inject.Inject; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.BodyTagSupport; import org.mxchange.jcore.exceptions.BadTokenException; @@ -32,12 +30,15 @@ import org.mxchange.pizzaapplication.beans.basket.BasketBean; * * @author Roland Haeder */ -@SessionScoped -public class MiniBasketTag extends BodyTagSupport { +public class MiniBasketTag extends BodyTagSupport implements BasketTag { + /** + * Serial number + */ + private static final long serialVersionUID = 457415727452384L; + /** * Basket instance */ - @Inject private BasketBean basket; /** @@ -53,17 +54,17 @@ public class MiniBasketTag extends BodyTagSupport { StringBuilder out = new StringBuilder("

\n"); // basket should not be null - if (this.basket == null) { + if (this.getBasket() == null) { // Not set throw new NullPointerException("basket instance is null"); } try { // Some entries found? - if (this.basket.isEmpty()) { + if (this.getBasket().isEmpty()) { // Empty basket out.append("
\n"); - out.append(this.basket.getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n"); + out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n"); out.append("
\n"); } else { // Some times were found @@ -79,7 +80,7 @@ public class MiniBasketTag extends BodyTagSupport { try { // Get output instance and write it - pageContext.getOut().print(out.toString()); + this.pageContext.getOut().print(out.toString()); } catch (final IOException ex) { // Continue to throw throw new JspException(ex); @@ -88,4 +89,20 @@ public class MiniBasketTag extends BodyTagSupport { // Don't process any body return SKIP_BODY; } + + /** + * @return the basket + */ + @Override + public BasketBean getBasket () { + return this.basket; + } + + /** + * @param basket the basket to set + */ + @Override + public void setBasket (final BasketBean basket) { + this.basket = basket; + } } diff --git a/web/WEB-INF/tlds/basket.tld b/web/WEB-INF/tlds/basket.tld index 6eed62f3..cd63a914 100644 --- a/web/WEB-INF/tlds/basket.tld +++ b/web/WEB-INF/tlds/basket.tld @@ -9,5 +9,12 @@ mini_basket A mini basket showing latest added item and a link to the full basket web page org.mxchange.pizzaapplication.tags.basket.MiniBasketTag + + basket + Basket instance, should be the same as the bean + true + true + org.mxchange.pizzaapplication.beans.basket.BasketBean + diff --git a/web/admin/category.jsp b/web/admin/category.jsp index 3f9c0369..03817a13 100644 --- a/web/admin/category.jsp +++ b/web/admin/category.jsp @@ -7,15 +7,11 @@ <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%--<%@page errorPage="errorHandler.jsp" %>--%> <%@page import="org.mxchange.pizzaapplication.category.Category"%> -<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%> +<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> - -<% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); -%> + @@ -58,10 +54,10 @@ - + - + ${category.decodedTitle()} @@ -101,7 +97,7 @@
- +
diff --git a/web/admin/index.jsp b/web/admin/index.jsp index 778b6b21..d60e08de 100644 --- a/web/admin/index.jsp +++ b/web/admin/index.jsp @@ -11,11 +11,8 @@ <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> <%@page import="org.mxchange.pizzaapplication.product.Product"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> + -<% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); -%> diff --git a/web/admin/product.jsp b/web/admin/product.jsp index cac2d9d9..399fe98f 100644 --- a/web/admin/product.jsp +++ b/web/admin/product.jsp @@ -13,12 +13,9 @@ <%@page import="org.mxchange.pizzaapplication.product.Product"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> -<%@page import="org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants"%> +<%@page import="org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend"%> + -<% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); -%> @@ -66,7 +63,7 @@ - + ${product.getItemId()}: @@ -115,7 +112,7 @@
- +
@@ -128,7 +125,7 @@
- +
diff --git a/web/form_handler/add_item.jsp b/web/form_handler/add_item.jsp index 4a9fb126..aa07ebf6 100644 --- a/web/form_handler/add_item.jsp +++ b/web/form_handler/add_item.jsp @@ -4,24 +4,24 @@ Author : Roland Haeder --%> +<%@page import="org.mxchange.jcore.BaseFrameworkSystem"%> <%--<%@page errorPage="errorHandler.jsp" %>--%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> <%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%> + + <% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); - // Get amount from item Long amount = item.getAmount(); // Debug message - app.getLogger().debug("amount=" + amount); + BaseFrameworkSystem.getInstance().getLogger().debug("amount=" + amount); // Is amount null or zero? if ((null == amount) || (amount == 0)) { diff --git a/web/form_handler/admin/do_category.jsp b/web/form_handler/admin/do_category.jsp index ca3fa531..c4cf37df 100644 --- a/web/form_handler/admin/do_category.jsp +++ b/web/form_handler/admin/do_category.jsp @@ -8,16 +8,14 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> -<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %> +<%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %> <%@page import="org.mxchange.pizzaapplication.product.Product"%> <%@page import="org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException"%> + <% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); - // Handle forms - app.doAdminHandleCategoryForms(request, response); + controller.doAdminHandleCategoryForms(request, response); %> diff --git a/web/form_handler/admin/do_product.jsp b/web/form_handler/admin/do_product.jsp index f806c874..d912531b 100644 --- a/web/form_handler/admin/do_product.jsp +++ b/web/form_handler/admin/do_product.jsp @@ -8,15 +8,13 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> -<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %> +<%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %> <%@page import="org.mxchange.pizzaapplication.product.Product"%> + <% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); - // Handle forms - app.doAdminHandleProductForms(request, response); + controller.doAdminHandleProductForms(request, response); %> diff --git a/web/form_handler/do_order.jsp b/web/form_handler/do_order.jsp deleted file mode 100644 index a6006607..00000000 --- a/web/form_handler/do_order.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%-- - Document : order - Created on : 07.08.2015, 14:58:21 - Author : Roland Haeder ---%> - -<%--<%@page errorPage="errorHandler.jsp" %>--%> -<%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> -<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> -<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %> -<%@page import="org.mxchange.pizzaapplication.product.Product"%> - -<% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); - - // Is it post? - if ("POST".equals(request.getMethod())) { //NOI18N - // @TODO Handle saving customer data and such things - - // Mark all choosen products as ordered - app.markAllChoosenProductsAsOrdered(request, session); - - // Redirect to proper URL - // @TODO Commented out for developing: - //response.sendRedirect(request.getContextPath() + "/finished.jsp"); -%> - - - -<% - } -%> - - - - - - - Pizza-Service - Form-Handler - - - -
-

Pizza-Service - Form-Handler

-
- - - - - - diff --git a/web/form_handler/do_preview.jsp b/web/form_handler/do_preview.jsp deleted file mode 100644 index f4b7f13d..00000000 --- a/web/form_handler/do_preview.jsp +++ /dev/null @@ -1,71 +0,0 @@ -<%-- - Document : order - Created on : 04.08.2015, 10:55:10 - Author : Roland Haeder ---%> - -<%--<%@page errorPage="errorHandler.jsp" %>--%> -<%@page import="java.util.Iterator"%> -<%@page import="java.util.Map"%> -<%@page import="org.mxchange.jcore.contact.Gender"%> -<%@page import="org.mxchange.pizzaapplication.product.Product"%> -<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> -<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> -<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %> -<%@page contentType="text/html" pageEncoding="UTF-8"%> - -<% - // Init application instance - PizzaBean app = PizzaServiceBean.getInstance(application); - - // Is it post? - if ("POST".equals(request.getMethod())) { //NOI18N - // Get Iterator - Iterator iterator = app.getAvailableProducts(); - - // "Walk" through all products and unmark them as ordered - while (iterator.hasNext()) { - // Get product instance - Product product = iterator.next(); - - // Mark product as not ordered - app.unmarkProductAsOrdered(product, session); - - // Is it choosen and amount set? - if (app.isProductChoosen(product, request, session)) { - // Then mark it as choosen - app.markProductAsChoosen(product, session); - } else { - // Unmark it - app.unmarkProductAsChoosen(product, session); - } - } - - // Redirect to proper URL - // @TODO Commented out for developing: - //response.sendRedirect(request.getContextPath() + "/finished.jsp"); -%> - - - -<% - } -%> - - - - - - Pizza-Service - Form-Handler - - - -
-

Pizza-Service - Form-Handler

-
- - - - - - diff --git a/web/index.jsp b/web/index.jsp index f3c27c5a..b5e641aa 100644 --- a/web/index.jsp +++ b/web/index.jsp @@ -4,10 +4,10 @@ Author : Roland Haeder --%> -<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%> <%--<%@page errorPage="errorHandler.jsp" %>--%> <%@page import="java.util.Map"%> <%@page import="java.util.Iterator"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> <%@page import="org.mxchange.pizzaapplication.product.Product"%> <%@page import="org.mxchange.pizzaapplication.basket.Basket"%> @@ -16,8 +16,7 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@taglib prefix="basket" uri="http://mxchange.org/pizza-service/tags/basket" %> - - + @@ -42,7 +41,7 @@
- + @@ -63,7 +62,7 @@ <% // Get Iterator - Iterator iterator = service.getAvailableProducts(); + Iterator iterator = controller.getAvailableProducts(); // "Walk" through all products and unmark them as ordered while (iterator.hasNext()) { @@ -74,7 +73,7 @@ product.getLogger().debug("product.itemId=" + product.getItemId()); // Create an item instance form this product - AddableBasketItem item = basket.getItem(product); + AddableBasketItem item = controller.getBasket().getItem(product); // Debug message product.getLogger().debug("item=" + item); @@ -105,9 +104,6 @@ // Then skip this item continue; } - - // Unmark as ordered - service.unmarkProductAsOrdered(product, session); %>
diff --git a/web/static/admin/admin_category_selection_box.jsp b/web/static/admin/admin_category_selection_box.jsp index 908bc072..5d7672b2 100644 --- a/web/static/admin/admin_category_selection_box.jsp +++ b/web/static/admin/admin_category_selection_box.jsp @@ -5,13 +5,13 @@ --%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%> +<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> - + - + diff --git a/web/static/admin/admin_parent_category_selection_box.jsp b/web/static/admin/admin_parent_category_selection_box.jsp index 877396a6..845dcae4 100644 --- a/web/static/admin/admin_parent_category_selection_box.jsp +++ b/web/static/admin/admin_parent_category_selection_box.jsp @@ -5,14 +5,14 @@ --%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%> +<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%> <%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%> - + - - + diff --git a/web/static/gender_selection_box.jsp b/web/static/gender_selection_box.jsp index 615ef9e9..09379be6 100644 --- a/web/static/gender_selection_box.jsp +++ b/web/static/gender_selection_box.jsp @@ -9,9 +9,9 @@ <%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %> - + -> <% // "Walk" through all genders and output them for (final Gender gender : Gender.values()) { -- 2.39.5