Package com.emc.plants.pojo.beans

Examples of com.emc.plants.pojo.beans.ShoppingCartItem


  }

  @Test
  public void testCheckInventory() {

    ShoppingCartItem scItem = new ShoppingCartItem("F0003",
        "Black-eyed Susan", "2 plants", 8.0f, 9.0f, 9, 10);
   
    //System.out.println("Shopping :: "+applicationContext);
    shopping.checkInventory(scItem);
    assertTrue(true);
View Full Code Here


  }
 
 
  @Test
  public void testCheckInventoryMulti() {
    ShoppingCartItem scItem = new ShoppingCartItem("F0003",
        "Black-eyed Susan", "2 plants", 8.0f, 9.0f, 9, 10);
    Collection<ShoppingCartItem> scItemsColln = new ArrayList<ShoppingCartItem>();
    //System.out.println("Shopping :: "+applicationContext);
    scItemsColln.add(scItem);
    shopping.checkInventory(scItemsColln);
View Full Code Here

  }
 
  @Test
  @Transactional
  public void testCreateOrder() {
    ShoppingCartItem scItem = new ShoppingCartItem("F0003",
        "Black-eyed Susan", "2 plants", 8.0f, 9.0f, 9, 10);
    Collection<ShoppingCartItem> scItemsColln = new ArrayList<ShoppingCartItem>();
    //System.out.println("Shopping :: "+applicationContext);
    scItemsColln.add(scItem);
   
View Full Code Here

        shoppingCart = null;
      }
    }
    if (shoppingCart != null)
    {
      ShoppingCartItem si;
      Collection items = shoppingCart.getItems();
      for (Object o : items)
      {
        si = (ShoppingCartItem) o;
        shoppingCart.checkInventory(si);
        logger.debug("ShoppingCart.checkInventory() - checking Inventory quantity of item: " + si.getID());
      }
    }

   
    try
View Full Code Here

    //EntityManager em = entityManagerFactory.createEntityManager();
    logger.debug("setCartContents() started execution .. ");
    items = new ArrayList<ShoppingCartItem>();
    int qty;
    String inventoryID;
    ShoppingCartItem si;
    Inventory inv;
    for (int i = 0; i < cartContents.size(); i++)
    {
      inventoryID = cartContents.getInventoryID(i);
      qty = cartContents.getQuantity(inventoryID);
      // Get the Inventory home.
      /*
      InventoryHome inventoryHome = (InventoryHome) Util.getEJBLocalHome("java:comp/env/ejb/Inventory", com.ibm.websphere.samples.pbwjpa.InventoryHome.class);
      try
      { */
      // inv = inventoryHome.findByPrimaryKey(new InventoryKey(inventoryID));
      inv = em.find(Inventory.class, inventoryID);
      // clone so we can use Qty as qty to purchase, not inventory in stock
      si = new ShoppingCartItem(inv);
      si.setQuantity(qty);
      addItem(si);
      /* }
       */
    }
   
 
View Full Code Here

   */
  public void addItem(ShoppingCartItem new_item)
  {
    logger.debug("addItem() started execution .. ");
    boolean added = false;
    ShoppingCartItem old_item;
    // If the same item is already in the cart, just increase the quantity.
    for (int i = 0; i < items.size(); i++)
    {
      old_item = (ShoppingCartItem) items.get(i);
      if (new_item.equals(old_item))
      {
        old_item.setQuantity(old_item.getQuantity() + new_item.getQuantity());
        added = true;
        break;
      }
    }
    // Add this item to shopping cart, if it is a brand new item.
View Full Code Here

   */
  public void removeItem(ShoppingCartItem item)
  {
    for (Object obj : items)
    {
      ShoppingCartItem si = (ShoppingCartItem) obj;
      if (item.equals(si))
      {
        items.remove(si);
        break;
      }
View Full Code Here

   * @return The total cost of all items in the shopping cart.
   */
  public float getTotalCost()
  {
    float total = 0.0f;
    ShoppingCartItem si;
    for (Object o : items)
    {
      si = (ShoppingCartItem) o;
      total += si.getPrice() * si.getQuantity();
    }
    return total;
  }
View Full Code Here

   *
   * @param items
   */
  public void checkInventory(Collection <ShoppingCartItem>items)
  {
    ShoppingCartItem si;
    for (Object o : items)
    {
      si = (ShoppingCartItem) o;
      checkInventory(si);     
    }
View Full Code Here

     ccNum, ccExpireMonth, ccExpireYear, cardHolder, shippingMethod, items);
     */
    Collection<OrderItem> orderitems = new ArrayList<OrderItem>();
    //EntityManager em = entityManagerFactory.createEntityManager();
    for (Object o : items) {
      ShoppingCartItem si = (ShoppingCartItem) o;
      Inventory inv = em.find(Inventory.class, si.getID());
      OrderItem oi = new OrderItem(inv);
      oi.setQuantity(si.getQuantity());
      orderitems.add(oi);
    }
    Customer c = em.find(Customer.class, customerID);
    order = new Order(c, billName, billAddr1, billAddr2, billCity, billState, billZip, billPhone,
        shipName, shipAddr1, shipAddr2, shipCity, shipState, shipZip, shipPhone, creditCard,
View Full Code Here

TOP

Related Classes of com.emc.plants.pojo.beans.ShoppingCartItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.