]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java
Finally added calculateItemPrice() ...
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / basket / BasketWebController.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.pizzaapplication.beans.basket;
18
19 import java.io.Serializable;
20 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
21 import org.mxchange.jshopcore.model.product.Product;
22
23 /**
24  * An interface for a basket
25  *
26  * @author Roland Haeder<roland@mxchange.org>
27  */
28 public interface BasketWebController extends Serializable {
29
30         /**
31          * Checks whether the basket is empty
32          *
33          * @return Whether the basket is empty
34          */
35         public boolean isEmpty ();
36
37         /**
38          * Checks whether the basket has items in it. This method is wrapper to
39          * isEmpty()
40          *
41          * @return Whether the basket is empty
42          */
43         public boolean hasItems ();
44
45         /**
46          * Checks whether the currently set product is added in basked
47          *
48          * @param product Product instance
49          * @return Whether the product is added
50          */
51         public boolean isProductAdded (final Product product);
52
53         /**
54          * Adds given product instance to basket by adding amount from form data to
55          * it.
56          *
57          * @param product Product instance to add
58          * @return Redirect target or null
59          */
60         public String addItem (final Product product);
61
62         /**
63          * Getter for item amount property
64          *
65          * @return Item amount property
66          */
67         public Long getAmount ();
68
69         /**
70          * Setter for item amount property
71          *
72          * @param amount Item amount property
73          */
74         public void setAmount (final Long amount);
75
76         /**
77          * Getter for current item
78          *
79          * @return Current item
80          */
81         public AddableBasketItem getCurrentItem ();
82
83         /**
84          * Setter for current item
85          *
86          * @param currentItem Current item
87          */
88         public void setCurrentItem (final AddableBasketItem currentItem);
89
90         /**
91          * Calculates total price (no tax added) of current item. If no current item
92          * is set and no amount, a NPE is thrown.
93          *
94          * @return Current item's total price
95          */
96         public Float calculateItemPrice ();
97 }