Package org.springframework.samples.jpetstore.domain

Examples of org.springframework.samples.jpetstore.domain.Item


    this.petStore = petStore;
  }

  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String itemId = request.getParameter("itemId");
    Item item = this.petStore.getItem(itemId);
    Map model = new HashMap();
    model.put("item", item);
    model.put("product", item.getProduct());
    return new ModelAndView("Item", model);
  }
View Full Code Here


    else {
      // isInStock is a "real-time" property that must be updated
      // every time an item is added to the cart, even if other
      // item details are cached.
      boolean isInStock = this.petStore.isItemInStock(workingItemId);
      Item item = this.petStore.getItem(workingItemId);
      cart.addItem(item, isInStock);
    }
    return new ModelAndView("Cart", "cart", cart);
  }
View Full Code Here

public class ViewItemAction extends BaseAction {

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    String itemId = request.getParameter("itemId");
    Item item = getPetStore().getItem(itemId);
    request.setAttribute("item", item);
    request.setAttribute("product", item.getProduct());
    return mapping.findForward("success");
  }
View Full Code Here

    else {
      // isInStock is a "real-time" property that must be updated
      // every time an item is added to the cart, even if other
      // item details are cached.
      boolean isInStock = getPetStore().isItemInStock(workingItemId);
      Item item = getPetStore().getItem(workingItemId);
      cartForm.getCart().addItem(item, isInStock);
    }
    return mapping.findForward("success");
  }
View Full Code Here

  public List getItemListByProduct(String productId) throws DataAccessException {
    return getSqlMapClientTemplate().queryForList("getItemListByProduct", productId);
  }

  public Item getItem(String itemId) throws DataAccessException {
    Item item = (Item) getSqlMapClientTemplate().queryForObject("getItem", itemId);
    if (item != null) {
      Integer qty = (Integer) getSqlMapClientTemplate().queryForObject("getInventoryQuantity", itemId);
      item.setQuantity(qty.intValue());
    }
    return item;
  }
View Full Code Here

TOP

Related Classes of org.springframework.samples.jpetstore.domain.Item

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.