ShoppingCart Interface
- public interface ShoppingCart
extends Belonging
The ShoppingCart is used to contain a list of ShoppingCartLines
. Each ShoppingCartLine
contains
a unique item. If the customer adds a ProductItem
that is already in the shopping cart, the quantity of the
existing ShoppingCartLine
is increased.
Related Topics
ShoppingCartHome
ShoppingCartLine
-
All Known Implementing Classes
-
ShoppingCartImpl
-
All Superinterfaces
-
Belonging
, BusinessSmartComponent
, Cloneable
, Comparable
, Serializable
addItemsFromShoppingCart(ShoppingCart) Method
public void addItemsFromShoppingCart(ShoppingCart
items)
throws InvalidArgumentException
Add the ShoppingCartLines from the specified ShoppingCart to this ShoppingCart.
Exceptions
-
InvalidArgumentException
addProductItem(ProductItem, double) Method
public ShoppingCartLine
addProductItem(ProductItem
item,
double quantity)
throws InvalidArgumentException
Add an Item to the ShoppingCart. If the Item is already in the ShoppingCart, increase its quantity.
Exceptions
-
InvalidArgumentException
addProductItem(ProductItem, double, Money) Method
public ShoppingCartLine
addProductItem(ProductItem
item,
double quantity,
Money
unitMoney)
throws InvalidArgumentException
Add an Item to the ShoppingCart. If the Item is already in the ShoppingCart, increase its quantity.
Exceptions
-
InvalidArgumentException
addShoppingCartLine(ShoppingCartLine) Method
public boolean addShoppingCartLine(ShoppingCartLine
element)
Ensures that this collection contains the specified element (optional operation).
addShoppingCartLineCollection(Collection) Method
public boolean addShoppingCartLineCollection(Collection
collection)
Adds all of the elements in the specified collection to this collection (optional operation).
clearShoppingCartLineCollection() Method
public void clearShoppingCartLineCollection()
Removes all of the elements from this collection (optional operation).
containsShoppingCartLine(ShoppingCartLine) Method
public boolean containsShoppingCartLine(ShoppingCartLine
element)
Returns true if this collection contains the specified element.
containsShoppingCartLineCollection(Collection) Method
public boolean containsShoppingCartLineCollection(Collection
c)
Returns true if this collection contains all of the elements in the specified collection.
createShoppingCartLine() Method
public ShoppingCartLine
createShoppingCartLine()
Used internally by the ShoppingCart to create ShoppingCartLines. If ShoppingCart is used to manage a list of lines that extend ShoppingCartLine, this method should be overridden to return an instance of the appropiate sub class.
equalsShoppingCartLineCollection(Object) Method
public boolean equalsShoppingCartLineCollection(Object
object)
Compares the specified object with this collection for equality.
findShoppingCartLine(String) Method
public ShoppingCartLine
findShoppingCartLine(String
productIdentifier)
throws ItemNotInShoppingCartException
, InvalidArgumentException
Find the ShoppingCartLine associated with the specified Item. Throws an ItemNotInShoppingCartException if the Item cannot be found.
Parameters
-
productIdentifier
- (See productItem.getKey( ).getIdentifier( ) )
Exceptions
-
ItemNotInShoppingCartException
-
InvalidArgumentException
getCategoryQuantity(String) Method
public double getCategoryQuantity(String
categoryId)
throws RemoteException
Count the number of products that belong to a category.
Exceptions
-
RemoteException
getNumberOfUnits() Method
public double getNumberOfUnits()
Count the total quantity of items by summing the quantity on each line.
getOrderDiscountPresentations() Method
public ArrayList
getOrderDiscountPresentations()
Gets the order level discount list
getShipping() Method
public Money
getShipping()
Get the value of shipping
Returns
- shipping.
getShippingDiscountPresentations() Method
public ArrayList
getShippingDiscountPresentations()
Accessor method for the presentation of the
discounts applied to the shipping,
used by JSP pages for instance
getShoppingCartLineCollection() Method
public Collection
getShoppingCartLineCollection()
Returns the entire collection
getSubtotal() Method
public Money
getSubtotal()
Get the value of Subtotal
Returns
- Subtotal.
getTotal() Method
public Money
getTotal()
Get the value of total
Returns
- total.
getTotal(int) Method
public Money
getTotal(int totalType)
throws InvalidArgumentException
Gets the shopping cart total for the given total type. Valid values are one or more of :
- LINE_UNIT_PRICE_TIMES_QUANTITY
- LINE_SHIPPING
- LINE_TAX
- SHOPPING_CART_SHIPPING
Parameters
-
totalType
- type
Exceptions
-
InvalidArgumentException
getTotalPrice() Method
public Money
getTotalPrice()
Gets the overal shopping cart total
isEmpty() Method
public boolean isEmpty()
Returns true if the shopping cart has no items
isShoppingCartLineCollectionEmpty() Method
public boolean isShoppingCartLineCollectionEmpty()
Returns true if this collection contains no elements.
removeAllProductItems() Method
public void removeAllProductItems()
Removes all ShoppingCartLines. This resets the entire ShoppingCart.
removeProductItem(String) Method
public ProductItem
removeProductItem(String
productIdentifier)
throws InvalidArgumentException
Remove the ShoppingCartLine associated with the Item specified.
Parameters
-
productIdentifier
- (See productItem.getKey( ).getIdentifier( ) )
Exceptions
-
InvalidArgumentException
removeShoppingCartLine(ShoppingCartLine) Method
public boolean removeShoppingCartLine(ShoppingCartLine
element)
Removes a single instance of the specified element from this collection, if it is present (optional operation).
removeShoppingCartLineCollection(Collection) Method
public boolean removeShoppingCartLineCollection(Collection
collection)
Removes all this collection's elements that are also contained in the specified collection (optional operation).
retainShoppingCartLineCollection(Collection) Method
public boolean retainShoppingCartLineCollection(Collection
collection)
Retains only the elements in this collection that are contained in the specified collection (optional operation).
setOrderDiscountPresentations(ArrayList) Method
public void setOrderDiscountPresentations(ArrayList
discountPresentations)
sets the order level discount list
setProductItemQuantity(ProductItem, double) Method
public void setProductItemQuantity(ProductItem
item,
double quantity)
throws InvalidArgumentException
Sets the Quantity of the ShoppingCartLine associated with this Item. A new ShoppingCartLine is created if the Item is not present. This differs from addItem in that this method explicitly sets the absolute Quantity of a ShoppingCartLine rather than incrementing the existing value .
Exceptions
-
InvalidArgumentException
setShipping(Money) Method
public void setShipping(Money
shipping)
Set the value of shipping
Parameters
-
shipping
- shipping to be set
setShippingDiscountPresentations(ArrayList) Method
public void setShippingDiscountPresentations(ArrayList
discountPresentations)
sets Order Discount Description
setShoppingCartLineCollection(Collection) Method
public void setShoppingCartLineCollection(Collection
collection)
Sets the entire collection
setSubtotal(Money) Method
public void setSubtotal(Money
subtotal)
Set the value of subtotal
Parameters
-
subtotal
- subtotal to be set
setTotal(Money) Method
public void setTotal(Money
total)
Set the value of total
Parameters
-
total
- total to be set
shoppingCartLineCollectionHashCode() Method
public int shoppingCartLineCollectionHashCode()
Returns the hash code value for this collection.
shoppingCartLineCollectionIterator() Method
public Iterator
shoppingCartLineCollectionIterator()
Returns an iterator over the elements in this collection.
shoppingCartLineCollectionSize() Method
public int shoppingCartLineCollectionSize()
Returns the number of elements in this collection.