1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.shopping.service.persistence;
24  
25  /**
26   * <a href="ShoppingCartUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ShoppingCartUtil {
32      public static com.liferay.portlet.shopping.model.ShoppingCart create(
33          long cartId) {
34          return getPersistence().create(cartId);
35      }
36  
37      public static com.liferay.portlet.shopping.model.ShoppingCart remove(
38          long cartId)
39          throws com.liferay.portal.SystemException,
40              com.liferay.portlet.shopping.NoSuchCartException {
41          return getPersistence().remove(cartId);
42      }
43  
44      public static com.liferay.portlet.shopping.model.ShoppingCart remove(
45          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart)
46          throws com.liferay.portal.SystemException {
47          return getPersistence().remove(shoppingCart);
48      }
49  
50      /**
51       * @deprecated Use <code>update(ShoppingCart shoppingCart, boolean merge)</code>.
52       */
53      public static com.liferay.portlet.shopping.model.ShoppingCart update(
54          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart)
55          throws com.liferay.portal.SystemException {
56          return getPersistence().update(shoppingCart);
57      }
58  
59      /**
60       * Add, update, or merge, the entity. This method also calls the model
61       * listeners to trigger the proper events associated with adding, deleting,
62       * or updating an entity.
63       *
64       * @param        shoppingCart the entity to add, update, or merge
65       * @param        merge boolean value for whether to merge the entity. The
66       *                default value is false. Setting merge to true is more
67       *                expensive and should only be true when shoppingCart is
68       *                transient. See LEP-5473 for a detailed discussion of this
69       *                method.
70       * @return        true if the portlet can be displayed via Ajax
71       */
72      public static com.liferay.portlet.shopping.model.ShoppingCart update(
73          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart,
74          boolean merge) throws com.liferay.portal.SystemException {
75          return getPersistence().update(shoppingCart, merge);
76      }
77  
78      public static com.liferay.portlet.shopping.model.ShoppingCart updateImpl(
79          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart,
80          boolean merge) throws com.liferay.portal.SystemException {
81          return getPersistence().updateImpl(shoppingCart, merge);
82      }
83  
84      public static com.liferay.portlet.shopping.model.ShoppingCart findByPrimaryKey(
85          long cartId)
86          throws com.liferay.portal.SystemException,
87              com.liferay.portlet.shopping.NoSuchCartException {
88          return getPersistence().findByPrimaryKey(cartId);
89      }
90  
91      public static com.liferay.portlet.shopping.model.ShoppingCart fetchByPrimaryKey(
92          long cartId) throws com.liferay.portal.SystemException {
93          return getPersistence().fetchByPrimaryKey(cartId);
94      }
95  
96      public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
97          long groupId) throws com.liferay.portal.SystemException {
98          return getPersistence().findByGroupId(groupId);
99      }
100 
101     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
102         long groupId, int start, int end)
103         throws com.liferay.portal.SystemException {
104         return getPersistence().findByGroupId(groupId, start, end);
105     }
106 
107     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
108         long groupId, int start, int end,
109         com.liferay.portal.kernel.util.OrderByComparator obc)
110         throws com.liferay.portal.SystemException {
111         return getPersistence().findByGroupId(groupId, start, end, obc);
112     }
113 
114     public static com.liferay.portlet.shopping.model.ShoppingCart findByGroupId_First(
115         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
116         throws com.liferay.portal.SystemException,
117             com.liferay.portlet.shopping.NoSuchCartException {
118         return getPersistence().findByGroupId_First(groupId, obc);
119     }
120 
121     public static com.liferay.portlet.shopping.model.ShoppingCart findByGroupId_Last(
122         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
123         throws com.liferay.portal.SystemException,
124             com.liferay.portlet.shopping.NoSuchCartException {
125         return getPersistence().findByGroupId_Last(groupId, obc);
126     }
127 
128     public static com.liferay.portlet.shopping.model.ShoppingCart[] findByGroupId_PrevAndNext(
129         long cartId, long groupId,
130         com.liferay.portal.kernel.util.OrderByComparator obc)
131         throws com.liferay.portal.SystemException,
132             com.liferay.portlet.shopping.NoSuchCartException {
133         return getPersistence().findByGroupId_PrevAndNext(cartId, groupId, obc);
134     }
135 
136     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
137         long userId) throws com.liferay.portal.SystemException {
138         return getPersistence().findByUserId(userId);
139     }
140 
141     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
142         long userId, int start, int end)
143         throws com.liferay.portal.SystemException {
144         return getPersistence().findByUserId(userId, start, end);
145     }
146 
147     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
148         long userId, int start, int end,
149         com.liferay.portal.kernel.util.OrderByComparator obc)
150         throws com.liferay.portal.SystemException {
151         return getPersistence().findByUserId(userId, start, end, obc);
152     }
153 
154     public static com.liferay.portlet.shopping.model.ShoppingCart findByUserId_First(
155         long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
156         throws com.liferay.portal.SystemException,
157             com.liferay.portlet.shopping.NoSuchCartException {
158         return getPersistence().findByUserId_First(userId, obc);
159     }
160 
161     public static com.liferay.portlet.shopping.model.ShoppingCart findByUserId_Last(
162         long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
163         throws com.liferay.portal.SystemException,
164             com.liferay.portlet.shopping.NoSuchCartException {
165         return getPersistence().findByUserId_Last(userId, obc);
166     }
167 
168     public static com.liferay.portlet.shopping.model.ShoppingCart[] findByUserId_PrevAndNext(
169         long cartId, long userId,
170         com.liferay.portal.kernel.util.OrderByComparator obc)
171         throws com.liferay.portal.SystemException,
172             com.liferay.portlet.shopping.NoSuchCartException {
173         return getPersistence().findByUserId_PrevAndNext(cartId, userId, obc);
174     }
175 
176     public static com.liferay.portlet.shopping.model.ShoppingCart findByG_U(
177         long groupId, long userId)
178         throws com.liferay.portal.SystemException,
179             com.liferay.portlet.shopping.NoSuchCartException {
180         return getPersistence().findByG_U(groupId, userId);
181     }
182 
183     public static com.liferay.portlet.shopping.model.ShoppingCart fetchByG_U(
184         long groupId, long userId) throws com.liferay.portal.SystemException {
185         return getPersistence().fetchByG_U(groupId, userId);
186     }
187 
188     public static java.util.List<Object> findWithDynamicQuery(
189         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
190         throws com.liferay.portal.SystemException {
191         return getPersistence().findWithDynamicQuery(dynamicQuery);
192     }
193 
194     public static java.util.List<Object> findWithDynamicQuery(
195         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
196         int end) throws com.liferay.portal.SystemException {
197         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
198     }
199 
200     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll()
201         throws com.liferay.portal.SystemException {
202         return getPersistence().findAll();
203     }
204 
205     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll(
206         int start, int end) throws com.liferay.portal.SystemException {
207         return getPersistence().findAll(start, end);
208     }
209 
210     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll(
211         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
212         throws com.liferay.portal.SystemException {
213         return getPersistence().findAll(start, end, obc);
214     }
215 
216     public static void removeByGroupId(long groupId)
217         throws com.liferay.portal.SystemException {
218         getPersistence().removeByGroupId(groupId);
219     }
220 
221     public static void removeByUserId(long userId)
222         throws com.liferay.portal.SystemException {
223         getPersistence().removeByUserId(userId);
224     }
225 
226     public static void removeByG_U(long groupId, long userId)
227         throws com.liferay.portal.SystemException,
228             com.liferay.portlet.shopping.NoSuchCartException {
229         getPersistence().removeByG_U(groupId, userId);
230     }
231 
232     public static void removeAll() throws com.liferay.portal.SystemException {
233         getPersistence().removeAll();
234     }
235 
236     public static int countByGroupId(long groupId)
237         throws com.liferay.portal.SystemException {
238         return getPersistence().countByGroupId(groupId);
239     }
240 
241     public static int countByUserId(long userId)
242         throws com.liferay.portal.SystemException {
243         return getPersistence().countByUserId(userId);
244     }
245 
246     public static int countByG_U(long groupId, long userId)
247         throws com.liferay.portal.SystemException {
248         return getPersistence().countByG_U(groupId, userId);
249     }
250 
251     public static int countAll() throws com.liferay.portal.SystemException {
252         return getPersistence().countAll();
253     }
254 
255     public static ShoppingCartPersistence getPersistence() {
256         return _persistence;
257     }
258 
259     public void setPersistence(ShoppingCartPersistence persistence) {
260         _persistence = persistence;
261     }
262 
263     private static ShoppingCartPersistence _persistence;
264 }