KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > order > shoppingcart > WebShoppingCart


1 /*
2  * $Id: WebShoppingCart.java 5552 2005-08-17 19:31:38Z sichen $
3  *
4  * Copyright (c) 2001, 2002 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */

24 package org.ofbiz.order.shoppingcart;
25
26 import java.util.Locale JavaDoc;
27
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29 import javax.servlet.http.HttpSession JavaDoc;
30
31 import org.ofbiz.base.util.UtilHttp;
32 import org.ofbiz.entity.GenericDelegator;
33 import org.ofbiz.entity.GenericValue;
34 import org.ofbiz.product.store.ProductStoreWorker;
35 import org.ofbiz.webapp.website.WebSiteWorker;
36
37 /**
38  * WebShoppingCart.java
39  *
40  * Extension of {@link org.ofbiz.order.shoppingcart.ShoppingCart ShoppingCart}
41  * class which provides web presentation layer specific functionality
42  * related specifically to user session information.
43  *
44  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
45  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
46  * @author <a HREF="mailto:tristana@twibble.org">Tristan Austin</a>
47  * @version $Rev: 5552 $
48  * @since 2.0
49  */

50 public class WebShoppingCart extends ShoppingCart {
51
52     public WebShoppingCart(HttpServletRequest JavaDoc request, Locale JavaDoc locale, String JavaDoc currencyUom) {
53         // for purchase orders, bill to customer partyId must be set - otherwise, no way to know who we're purchasing for. supplierPartyId is furnished
54
// by order manager for PO entry.
55
// TODO: refactor constructor and the getCartObject method which calls them to multiple constructors for different types of orders
56
super((GenericDelegator)request.getAttribute("delegator"), ProductStoreWorker.getProductStoreId(request),
57                 WebSiteWorker.getWebSiteId(request), (locale != null ? locale : UtilHttp.getLocale(request)),
58                 (currencyUom != null ? currencyUom : UtilHttp.getCurrencyUom(request)),
59                 request.getParameter("billToCustomerPartyId"),
60                 (request.getParameter("supplierPartyId") != null ? request.getParameter("supplierPartyId") : request.getParameter("billFromVendorPartyId")));
61
62         HttpSession JavaDoc session = request.getSession(true);
63         this.userLogin = (GenericValue) session.getAttribute("userLogin");
64         this.autoUserLogin = (GenericValue) session.getAttribute("autoUserLogin");
65         this.orderPartyId = (String JavaDoc) session.getAttribute("orderPartyId");
66     }
67
68     public WebShoppingCart(HttpServletRequest JavaDoc request) {
69         this(request, UtilHttp.getLocale(request), UtilHttp.getCurrencyUom(request));
70     }
71     
72     /** Creates a new cloned ShoppingCart Object. */
73     public WebShoppingCart(ShoppingCart cart) {
74         super(cart);
75     }
76 }
77
Popular Tags