From: Roland Haeder Date: Wed, 2 Sep 2015 17:02:38 +0000 (+0200) Subject: Removed more old methods X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0b6cd1db5e54fb6bd36df445e65ea57efc1215c2;p=pizzaservice-war.git Removed more old methods 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 aa400cea..eba91b9f 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java @@ -88,26 +88,6 @@ public interface PizzaApplication extends Application { */ public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException; - /** - * Some "getter" for HTML code 'checked="checked"' if the product is choosen - * - * @param product Product instance - * @param request Request instance - * @param session Session instance - * @return Whether the product is choosen - */ - public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session); - - /** - * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons - * - * @param request Request instance - * @param session Session instance - * @return Whether the product is choosen - * @throws javax.servlet.ServletException If something unexpected happened - */ - public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException; - /** * Somewhat setter in session * diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 9bf32b49..920ada75 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -129,59 +129,6 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P this.getLogger().trace("EXIT!"); //NOI18N } - /** - * Calculates total amount of all choosen products - * - * @param request Request instance - * @param session Session instance - * @return Total amount of all choosen products - * @deprecated Old lost - */ - @Deprecated - private int calculateTotalAmount (final ServletRequest request, final HttpSession session) throws ServletException { - // Trace message - this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N - - // Is product and session set? - if (null == request) { - // Not set - throw new NullPointerException("request is null"); //NOI18N - } else if (null == session) { - // Not set - throw new NullPointerException("session is null"); //NOI18N - } - - // Init/declare total price and iterator - int totalAmount = 0; - Iterator iterator = this.getAvailableProductsIterator(); - - // "Walk" over all products - while (iterator.hasNext()) { - // Get next product - Product product = iterator.next(); - - // Is this choosen? - if (this.isProductChoosen(product, request, session)) { - // Then add ordered amount - this.getLogger().debug(MessageFormat.format("Counting {0} ...", product.getItemId())); //NOI18N - - // Getting amount - String amount = this.getAmountFromSession(product, session); - - // Add it up - this.getLogger().debug(MessageFormat.format("amount={0}", amount)); //NOI18N - totalAmount += Integer.valueOf(amount); - } - this.getLogger().debug(MessageFormat.format("product={0},totalAmount={1}", product.getItemId(), totalAmount)); //NOI18N - } - - // Trace message - this.getLogger().trace(MessageFormat.format("totalAmount={0} - EXIT!", totalAmount)); //NOI18N - - // Return total price - return totalAmount; - } - @Override public void doBootstrap () { throw new UnsupportedOperationException("Not supported yet."); //NOI18N @@ -197,116 +144,6 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P throw new UnsupportedOperationException("Not supported yet."); //NOI18N } - /** - * Some "getter" for amount from session - * - * @param product Product instance - * @param session Session instance - * @return Amount as string - * @deprecated Old lost code - */ - @Deprecated - private String getAmountFromSession (final Product product, final HttpSession session) { - // Trace message - this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N - - // Is product and session set? - if (null == product) { - // Not set - throw new NullPointerException("product is null"); //NOI18N - } else if (null == session) { - // Not set - throw new NullPointerException("session is null"); //NOI18N - } - - // Get attribute - Object object = this.getValueFromSession(product, session, HTTP_PARAM_AMOUNT); - - // Is the object null? - if (null == object) { - // Trace message - this.getLogger().trace("Returning 0 - EXIT!"); //NOI18N - - // Not found - return "0"; //NOI18N - } - - // Trace message - this.getLogger().trace(MessageFormat.format("object={0} - EXIT!", object)); //NOI18N - - // Cast to string and return it - return (String) object; - } - - @Override - public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session) { - // Trace message - this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N - - // Is product and session set? - if (null == product) { - // Not set - throw new NullPointerException("product is null"); //NOI18N - } else if (null == request) { - // Not set - throw new NullPointerException("request is null"); //NOI18N - } else if (null == session) { - // Not set - throw new NullPointerException("session is null"); //NOI18N - } - - // First let's check if the product is choosen - if (this.isProductChoosen(product, request, session)) { - // Trace message - this.getLogger().trace("Returning checked=\"checked\" - EXIT!"); //NOI18N - - // Is choosen - return "checked=\"checked\""; //NOI18N - } else { - // Trace message - this.getLogger().trace("Returning empty string - EXIT!"); //NOI18N - - // Not choosen - return ""; //NOI18N - } - } - - @Override - public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException { - // Trace message - this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N - - // Is product and session set? - if (null == request) { - // Not set - throw new NullPointerException("request is null"); //NOI18N - } else if (null == session) { - // Not set - throw new NullPointerException("session is null"); //NOI18N - } - - // Get "enabled" from request scope - Boolean enabled = Boolean.parseBoolean((String) request.getAttribute("enabled")); //NOI18N - - // Debug message - this.getLogger().debug(MessageFormat.format("enabled={0}", enabled)); //NOI18N - - // Is something selected? - if ((enabled) || (this.calculateTotalAmount(request, session) > 0)) { - // Trace message - this.getLogger().trace("Returning empty string - EXIT!"); //NOI18N - - // Something has been choosen - return ""; //NOI18N - } else { - // Trace message - this.getLogger().trace("Returning disabled=\"disabled\" - EXIT!"); //NOI18N - - // Nothing choosen yet - return "disabled=\"disabled\""; //NOI18N - } - } - @Override public String getPrintableProduktAvailability (final Product product) { // Trace message diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java index 18bed800..c15dcfe7 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaBean.java @@ -41,26 +41,6 @@ public interface PizzaBean extends FrameworkBean { */ public void init () throws FacesException; - /** - * Some "getter" for HTML code 'checked="checked"' if the product is choosen - * - * @param product Product instance - * @param request Request instance - * @param session Session instance - * @return Whether the product is choosen - */ - public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session); - - /** - * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons - * - * @param request Request instance - * @param session Session instance - * @return Whether the product is choosen - * @throws javax.servlet.ServletException If something unexpected happened - */ - public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException; - /** * Somewhat setter in session * diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java index a61838d6..681aad76 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceBean.java @@ -94,16 +94,6 @@ public class PizzaServiceBean extends BaseFrameworkBean implements PizzaBean { } } - @Override - public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session) { - return this.app.getCheckedHtmlFromProduct(product, request, session); - } - - @Override - public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException { - return this.app.getDisabledHtmlFromSession(request, session); - } - @Override public String getPrintableProduktAvailability (final Product product) { return this.app.getPrintableProduktAvailability(product);