com.ibm.websphere.samples.pbw.ejb
Class ShoppingCartBean

java.lang.Object
  extended by com.ibm.websphere.samples.pbw.ejb.ShoppingCartBean

@Named
@SessionScoped
public class ShoppingCartBean
extends Object

ShopingCartBean provides a transactional facade for order collection and processing.


Constructor Summary
ShoppingCartBean()
           
 
Method Summary
 void addItem(Inventory new_item)
          Add an item to the cart.
 void checkInventory(Inventory si)
          Method checkInventory.
 Order createOrder(String customerID, String billName, String billAddr1, String billAddr2, String billCity, String billState, String billZip, String billPhone, String shipName, String shipAddr1, String shipAddr2, String shipCity, String shipState, String shipZip, String shipPhone, String creditCard, String ccNum, String ccExpireMonth, String ccExpireYear, String cardHolder, int shippingMethod, Collection<Inventory> items)
          Create an order with contents of a shopping cart.
 ArrayList<Inventory> getItems()
          Get the items in the shopping cart.
 int getSize()
           
 float getSubtotalCost()
          Get the cost of all items in the shopping cart.
 void removeAllItems()
          Remove all items from the cart.
 void removeItem(Inventory item)
          Remove an item from the cart.
 void removeZeroQuantityItems()
          Remove zero quantity items.
 void setItems(Collection<Inventory> items)
          Set the items in the shopping cart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShoppingCartBean

public ShoppingCartBean()
Method Detail

addItem

public void addItem(Inventory new_item)
Add an item to the cart.

Parameters:
new_item - Item to add to the cart.

removeItem

public void removeItem(Inventory item)
Remove an item from the cart.

Parameters:
item - Item to remove from cart.

removeAllItems

public void removeAllItems()
Remove all items from the cart.


removeZeroQuantityItems

public void removeZeroQuantityItems()
Remove zero quantity items.


getItems

public ArrayList<Inventory> getItems()
Get the items in the shopping cart.

Returns:
A Collection of ShoppingCartItems.

setItems

public void setItems(Collection<Inventory> items)
Set the items in the shopping cart.

Parameters:
items - A Vector of ShoppingCartItem's.

getSubtotalCost

public float getSubtotalCost()
Get the cost of all items in the shopping cart.

Returns:
The total cost of all items in the shopping cart.

checkInventory

public void checkInventory(Inventory si)
Method checkInventory. Check the inventory level of a store item. Order additional inventory when necessary.

Parameters:
si - - Store item

createOrder

public Order createOrder(String customerID,
                         String billName,
                         String billAddr1,
                         String billAddr2,
                         String billCity,
                         String billState,
                         String billZip,
                         String billPhone,
                         String shipName,
                         String shipAddr1,
                         String shipAddr2,
                         String shipCity,
                         String shipState,
                         String shipZip,
                         String shipPhone,
                         String creditCard,
                         String ccNum,
                         String ccExpireMonth,
                         String ccExpireYear,
                         String cardHolder,
                         int shippingMethod,
                         Collection<Inventory> items)
Create an order with contents of a shopping cart.

Parameters:
customerID - customer's ID
billName - billing name
billAddr1 - billing address line 1
billAddr2 - billing address line 2
billCity - billing address city
billState - billing address state
billZip - billing address zip code
billPhone - billing phone
shipName - shippng name
shipAddr1 - shippng address line 1
shipAddr2 - shippng address line 2
shipCity - shippng address city
shipState - shippng address state
shipZip - shippng address zip code
shipPhone - shippng phone
creditCard - credit card
ccNum - credit card number
ccExpireMonth - credit card expiration month
ccExpireYear - credit card expiration year
cardHolder - credit card holder name
shippingMethod - int of shipping method used
items - vector of StoreItems ordered
Returns:
OrderInfo

getSize

public int getSize()


Copyright © 2011. All Rights Reserved.