2 * Copyright (C) 2015 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.pizzaapplication.beans.basket;
19 import java.io.Serializable;
20 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
21 import org.mxchange.jshopcore.model.product.Product;
24 * An interface for a basket
26 * @author Roland Haeder<roland@mxchange.org>
28 public interface BasketWebController extends Serializable {
31 * Checks whether the basket is empty
33 * @return Whether the basket is empty
35 public boolean isEmpty ();
38 * Checks whether the basket has items in it. This method is wrapper to
41 * @return Whether the basket is empty
43 public boolean hasItems ();
46 * Checks whether the currently set product is added in basked
48 * @param product Product instance
49 * @return Whether the product is added
51 public boolean isProductAdded (final Product product);
54 * Adds given product instance to basket by adding amount from form data to
57 * @param product Product instance to add
58 * @return Redirect target or null
60 public String addItem (final Product product);
63 * Getter for item amount property
65 * @return Item amount property
67 public Long getAmount ();
70 * Setter for item amount property
72 * @param amount Item amount property
74 public void setAmount (final Long amount);
77 * Getter for current item
79 * @return Current item
81 public AddableBasketItem getCurrentItem ();
84 * Setter for current item
86 * @param currentItem Current item
88 public void setCurrentItem (final AddableBasketItem currentItem);
91 * Calculates total price (no tax added) of current item. If no current item
92 * is set and no amount, a NPE is thrown.
94 * @return Current item's total price
96 public Float calculateItemPrice ();