* @param request Request instance
* @param session Session instance
* @return Total amount of all choosen products
- * @deprecated Old lost code
+ * @deprecated Old lost
*/
- @Override
@Deprecated
- public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ private int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N
return totalAmount;
}
- /**
- * Calculates total price of all choosen products
- *
- * @param request Request instance
- * @param session Session instance
- * @return Total price of all choosen products
- */
- @Override
- public float calculateTotalPrice (final HttpServletRequest 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 total price
- float totalPrice = 0.00f;
-
- // Get iterator
- Iterator<Product> iterator = this.getAvailableProducts();
-
- // "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 product's total price
- this.getLogger().debug(MessageFormat.format("Calling getTotalPositionPriceFromRequestSession({0},request,session) ...", product.getItemId())); //NOI18N
- totalPrice += this.getTotalPositionPriceFromRequestSession(product, request, session);
- }
- this.getLogger().debug(MessageFormat.format("product={0},totalPrice={1}", product.getItemId(), totalPrice)); //NOI18N
- }
-
- // Trace message
- this.getLogger().trace(MessageFormat.format(" totalPrice={0} - EXIT!", totalPrice)); //NOI18N
-
- // Return total price
- return totalPrice;
- }
-
@Override
public void doBootstrap () {
throw new UnsupportedOperationException("Not supported yet."); //NOI18N
* @param product Product instance
* @param session Session instance
* @return Amount as string
+ * @deprecated Old lost code
*/
- @Override
@Deprecated
- public String getAmountFromSession (final Product product, final HttpSession session) {
+ private String getAmountFromSession (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
}
}
- /**
- * Some "getter" for choose from session
- *
- * @param product Product instance
- * @param session Session instance
- * @return Choose as string
- */
- @Override
- @Deprecated
- public String getChooseFromSession (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_ITEM_ID);
-
- // Is the object null?
- if (null == object) {
- // Not found
- this.getLogger().debug(MessageFormat.format("Returning empty string for product={0} ...", product.getItemId())); //NOI18N
- return ""; //NOI18N
- }
-
- // Trace message
- this.getLogger().trace(MessageFormat.format("object={0} - CALLED!", object)); //NOI18N
-
- // Cast to string and return it
- return (String) object;
- }
-
/**
* Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
*
}
}
- /**
- * Some getter for printable value from session or an empty string for null.
- *
- * @param session Session instance
- * @param key Key to get
- * @return Value from key, empty string for null
- */
- @Override
- public Object getPrintableValeFromSession (final HttpSession session, final String key) {
- // Trace message
- this.getLogger().trace(MessageFormat.format("session={0},key={1} - CALLED", session, key)); //NOI18N
-
- // Are both parameter not null?
- if (null == session) {
- // Abort here
- throw new NullPointerException("session is null"); //NOI18N
- } else if (null == key) {
- // Abort here
- throw new NullPointerException("key is null"); //NOI18N
- }
-
- // Now get it
- Object value = this.getValueFromSession(session, key);
-
- // Debug message
- this.getLogger().debug(MessageFormat.format("value={0}", value)); //NOI18N
-
- // Trace message
- this.getLogger().trace(MessageFormat.format("Calling this.convertNullToEmpty({0}) ... - EXIT!", value)); //NOI18N
-
- // Return actual value
- return this.convertNullToEmpty(value);
- }
-
/**
* Some "getter" for a an array of only available products
*
}
}
- /**
- * Some "getter" for total price of position from request or session.
- * Single price and amount is multiplyed.
- *
- * @param product Product instance
- * @param request Request instance
- * @param session Session instance
- * @return Amount as string
- */
- @Override
- @Deprecated
- public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
- throw new UnsupportedOperationException("This method is deprecated and shall not be called.");
- }
-
/**
* Checks whether the given product is choosen, request overules session.
*