]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java
Finally added calculateItemPrice() ...
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / basket / BasketWebController.java
index 3f78e540f5a1da4adb63f2ecc68a91c54c7dba26..d071350686884d554a2963f252969c6a46e81d6a 100644 (file)
 package org.mxchange.pizzaapplication.beans.basket;
 
 import java.io.Serializable;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
 import org.mxchange.jshopcore.model.product.Product;
 
 /**
  * An interface for a basket
  *
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
  */
 public interface BasketWebController extends Serializable {
+
        /**
         * Checks whether the basket is empty
         *
@@ -33,16 +35,63 @@ public interface BasketWebController extends Serializable {
        public boolean isEmpty ();
 
        /**
-        * Checks whether the basket has items in it. This method is wrapper to isEmpty()
+        * Checks whether the basket has items in it. This method is wrapper to
+        * isEmpty()
         *
         * @return Whether the basket is empty
         */
        public boolean hasItems ();
 
        /**
-        * Setter for current product instance
-        * 
+        * Checks whether the currently set product is added in basked
+        *
         * @param product Product instance
+        * @return Whether the product is added
+        */
+       public boolean isProductAdded (final Product product);
+
+       /**
+        * Adds given product instance to basket by adding amount from form data to
+        * it.
+        *
+        * @param product Product instance to add
+        * @return Redirect target or null
+        */
+       public String addItem (final Product product);
+
+       /**
+        * Getter for item amount property
+        *
+        * @return Item amount property
+        */
+       public Long getAmount ();
+
+       /**
+        * Setter for item amount property
+        *
+        * @param amount Item amount property
+        */
+       public void setAmount (final Long amount);
+
+       /**
+        * Getter for current item
+        *
+        * @return Current item
+        */
+       public AddableBasketItem getCurrentItem ();
+
+       /**
+        * Setter for current item
+        *
+        * @param currentItem Current item
+        */
+       public void setCurrentItem (final AddableBasketItem currentItem);
+
+       /**
+        * Calculates total price (no tax added) of current item. If no current item
+        * is set and no amount, a NPE is thrown.
+        *
+        * @return Current item's total price
         */
-       public void setCurrentProduct (final Product product);
+       public Float calculateItemPrice ();
 }