From 7c268701fb396f5ed03e9430a1d03dc362906f35 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 13 Aug 2015 13:42:33 +0200 Subject: [PATCH] =?utf8?q?Continued=20with=20project:=20-=20added=20doAdmi?= =?utf8?q?nAddCategory()=20and=20doAdminAddProduct()=20-=20it=20is=20getPa?= =?utf8?q?rameter()=20for=20HttpServletRequest=20instances=20to=20get=20th?= =?utf8?q?e=20actual=20POST/GET=20*parameter*=20-=20Ignored=20more=20strin?= =?utf8?q?gs=20for=20internationalization=20Signed-off-by:Roland=20H=C3=A4?= =?utf8?q?der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../application/PizzaApplication.java | 14 ++++++ .../application/PizzaServiceApplication.java | 48 +++++++++++++++---- web/form_handler/admin/do_category.jsp | 6 +-- web/form_handler/admin/do_product.jsp | 6 +-- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java index 22901cab..80983bf1 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java @@ -231,4 +231,18 @@ public interface PizzaApplication extends Application { * @throws javax.servlet.ServletException If something unexpected happened */ public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException; + + /** + * Adds given category data from request to database + * + * @param request Request instance + */ + public void doAdminAddCategory (final HttpServletRequest request); + + /** + * Adds given product data from request to database + * + * @param request Request instance + */ + public void doAdminAddProduct (final HttpServletRequest request); } diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 1603c70f..550d3f94 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -243,17 +243,17 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P @Override public void doBootstrap () { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("Not supported yet."); //NOI18N } @Override public void doMainLoop () { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("Not supported yet."); //NOI18N } @Override public void doShutdown () { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("Not supported yet."); //NOI18N } /** @@ -477,7 +477,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P */ @Override public String getPrintableProduktAvailability (final Product product) { - throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: product={0}", product)); + throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: product={0}", product)); //NOI18N } /** @@ -749,7 +749,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P @Override public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException { // Trace message - this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); + this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N // Init iterator Iterator iterator = this.getProducts(); @@ -760,7 +760,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P Product product = iterator.next(); // Debug message - this.getLogger().debug(MessageFormat.format("product={0}", product)); + this.getLogger().debug(MessageFormat.format("product={0}", product)); //NOI18N // Is it choosen? if (this.isProductChoosen(product, request, session)) { @@ -770,7 +770,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P } // Trace message - this.getLogger().trace("EXIT!"); + this.getLogger().trace("EXIT!"); //NOI18N } /** @@ -1005,15 +1005,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // Check request method if (!"POST".equals(request.getMethod())) { //NOI18N // Not POST, so get from session - this.getLogger().trace(MessageFormat.format("Calling this.getChooseFromSession({0},{1}) ... - EXIT!", product.getId(), session)); + this.getLogger().trace(MessageFormat.format("Calling this.getChooseFromSession({0},{1}) ... - EXIT!", product.getId(), session)); //NOI18N return this.getChooseFromSession(product, session); } else if (this.isProductOrdered(product, session)) { // Product is ordered - this.getLogger().trace(MessageFormat.format("Calling this.getChooseFromSession({0},{1}) ... - EXIT!", product.getId(), session)); + this.getLogger().trace(MessageFormat.format("Calling this.getChooseFromSession({0},{1}) ... - EXIT!", product.getId(), session)); //NOI18N return this.getChooseFromSession(product, session); } else if (!this.getChooseFromSession(product, session).isEmpty()) { // Found in session - this.getLogger().trace(MessageFormat.format("Calling this.getChooseFromSession({0},{1}) ... - EXIT!", product.getId(), session)); + this.getLogger().trace(MessageFormat.format("Calling this.getChooseFromSession({0},{1}) ... - EXIT!", product.getId(), session)); //NOI18N return this.getChooseFromSession(product, session); } @@ -1154,4 +1154,32 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P this.getLogger().debug(MessageFormat.format("entry {0}={1}", entry.getKey(), entry.getValue())); //NOI18N } } + + /** + * Adds given category data from request to database + * + * @param request Request instance + */ + @Override + public void doAdminAddCategory (final HttpServletRequest request) { + // Trace message + this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } + + /** + * Adds given product data from request to database + * + * @param request Request instance + */ + @Override + public void doAdminAddProduct (final HttpServletRequest request) { + // Trace message + this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } } diff --git a/web/form_handler/admin/do_category.jsp b/web/form_handler/admin/do_category.jsp index 611df6f4..d917e2a9 100644 --- a/web/form_handler/admin/do_category.jsp +++ b/web/form_handler/admin/do_category.jsp @@ -18,12 +18,12 @@ // Is it post? if ("POST".equals(request.getMethod())) { //NOI18N // Is "add/edit/delete" set? - if (request.getAttribute("add") != null) { //NOI18N + if (request.getParameter("add") != null) { //NOI18N // Add new category app.doAdminAddCategory(request); - } else if (request.getAttribute("edit") != null) { //NOI18N + } else if (request.getParameter("edit") != null) { //NOI18N // @TODO - } else if (request.getAttribute("delete") != null) { //NOI18N + } else if (request.getParameter("delete") != null) { //NOI18N // @TODO } diff --git a/web/form_handler/admin/do_product.jsp b/web/form_handler/admin/do_product.jsp index e94cdca5..679f21b2 100644 --- a/web/form_handler/admin/do_product.jsp +++ b/web/form_handler/admin/do_product.jsp @@ -18,12 +18,12 @@ // Is it post? if ("POST".equals(request.getMethod())) { //NOI18N // Is "add/edit/delete" set? - if (request.getAttribute("add") != null) { //NOI18N + if (request.getParameter("add") != null) { //NOI18N // Add new product app.doAdminAddProduct(request); - } else if (request.getAttribute("edit") != null) { //NOI18N + } else if (request.getParameter("edit") != null) { //NOI18N // @TODO - } else if (request.getAttribute("delete") != null) { //NOI18N + } else if (request.getParameter("delete") != null) { //NOI18N // @TODO } -- 2.39.5