From: Roland Haeder Date: Thu, 13 Aug 2015 11:42:33 +0000 (+0200) Subject: Continued with project: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7c268701fb396f5ed03e9430a1d03dc362906f35;p=pizzaservice-war.git Continued with project: - added doAdminAddCategory() and doAdminAddProduct() - it is getParameter() for HttpServletRequest instances to get the actual POST/GET *parameter* - Ignored more strings for internationalization Signed-off-by:Roland Häder --- 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 }