Package com.emc.plants.persistence

Examples of com.emc.plants.persistence.Inventory


  }

  @Test
  public void testGetItemInventory() {
    String inventoryID = "F0003";
    Inventory inventory = catalog.getItemInventory(inventoryID);
    assertEquals("Result", "Black-eyed Susan", inventory.getName());
  }
View Full Code Here


        Util.debug("BackOrderStockBean.createBackOrder() - Creating BackOrder for InventoryID: " + inventoryID);
        // Order enough stock from the supplier to reach the maximum threshold and to
        // satisfy the back order.
        amountToOrder = maximumItems + amountToOrder;
        // backOrder = getBackOrderLocalHome().create(inventoryID, amountToOrder);
        Inventory inv = em.find(Inventory.class, inventoryID);
        BackOrder b = new BackOrder(inv, amountToOrder);
        em.persist(b);
      }
    }
    catch (Exception e)
View Full Code Here

                Util.debug(fields[7]);
                Util.debug(fields[8]);
                Util.debug(fields[9]);
                Util.debug(fields[10]);
                Util.debug(fields[11]);
                Inventory storeItem = new Inventory(id, name, heading, descr, pkginfo, image, price, cost, quantity, category, notes, isPublic);
                catalog.addItem(storeItem);
                addImage(id, image, catalog);
            }
            Util.debug("INVENTORY table populated with text...");
            // catalog.remove();
View Full Code Here

                while (i.hasNext()) {
                    BackOrderItem backOrderItem = (BackOrderItem) i.next();
                    long backOrderID = backOrderItem.getBackOrderID();
                    String inventoryID = backOrderItem.getInventory().getInventoryId();
                    // Get the inventory quantity and name for the back order item information.
                    Inventory item = catalog.getItemInventory(inventoryID);
                    int quantity = item.getQuantity();
                    backOrderItem.setInventoryQuantity(quantity);
                    String name = item.getName();
                    // catalog.remove();
                    backOrderItem.setName(name);
                    // Don't include backorders that have been completed.
                    if (!(backOrderItem.getStatus().equals(Util.STATUS_ADDEDSTOCK))) {
                        String invID = backOrderItem.getInventory().getInventoryId();
View Full Code Here

   * @param id of inventory item.
   * @return an inventory bean.
   */
  private Inventory getInventoryItem(String inventoryID)
  {
    Inventory inv = null;
    /*      // Get the Inventory home.
     InventoryHome inventoryHome = (InventoryHome) Util.getEJBLocalHome("java:comp/env/ejb/Inventory", InventoryHome.class);
     try
     {
     inv = inventoryHome.findByPrimaryKeyUpdate(inventoryID);
View Full Code Here

    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.
View Full Code Here

   * @param si - Store item
   */
  public void checkInventory(ShoppingCartItem si)
  {
    Util.debug("ShoppingCart.checkInventory() - checking Inventory quantity of item: " + si.getID());
    Inventory inv = getInventoryItem(si.getID());
   
    /**
     * Decrease the quantity of this inventory item.
     * @param quantity The number to decrease the inventory by.
     * @return The number of inventory items removed.
     */
    int quantity=si.getQuantity();
    int minimumItems = inv.getMinThreshold();
     
    int amountToOrder = 0;
    Util.debug("ShoppingCartBean:checkInventory() - Decreasing inventory item " +inv.getInventoryId());
    int quantityNotFilled = 0;
    if (inv.getQuantity() < 1)
    {
      quantityNotFilled = quantity;
    }
    else if (inv.getQuantity() < quantity)
    {
      quantityNotFilled = quantity - inv.getQuantity();
    }
     
    // When quantity becomes < 0, this will be to determine the
    // quantity of unfilled orders due to insufficient stock.
    inv.setQuantity(inv.getQuantity() - quantity);
     
    //  Check to see if more inventory needs to be ordered from the supplier
    //  based on a set minimum Threshold
    if (inv.getQuantity() < minimumItems)
    {
      // Calculate the amount of stock to order from the supplier
      // to get the inventory up to the maximum.
      amountToOrder = quantityNotFilled;
      backOrder(inv, amountToOrder);
View Full Code Here

     */
    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);
View Full Code Here

    if (shoppingCart != null)
    {
      String invID = req.getParameter("itemID");

      // Gets detached instance
      Inventory inv = catalog.getItemInventory(invID);
      ShoppingCartItem si = new ShoppingCartItem(inv);
      si.setQuantity(Integer.parseInt(req.getParameter("qty").trim()));
      shoppingCart.addItem(si);
      session.setAttribute(Util.ATTR_CART, shoppingCart);
      session.setAttribute(Util.ATTR_CART_CONTENTS, shoppingCart.getCartContents());
View Full Code Here

   * @param inventoryID - ID of the Inventory item desired.
   * @return Inventory
   */
  public Inventory getItemInventory(String inventoryID)
  {
    Inventory si = null;
    /*
     InventoryHome invHome = (InventoryHome) Util.getEJBLocalHome("java:comp/env/ejb/Inventory",
     com.ibm.websphere.samples.pbwjpa.InventoryHome.class);
     Inventory inv = invHome.findByPrimaryKey(new InventoryKey(inventoryID));
     si = new ShoppingCartItem(inv);
View Full Code Here

TOP

Related Classes of com.emc.plants.persistence.Inventory

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.