1   /**
2    * Copyright (c) 2000-2008 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 begin, int end)
103         throws com.liferay.portal.SystemException {
104         return getPersistence().findByGroupId(groupId, begin, end);
105     }
106 
107     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
108         long groupId, int begin, int end,
109         com.liferay.portal.kernel.util.OrderByComparator obc)
110         throws com.liferay.portal.SystemException {
111         return getPersistence().findByGroupId(groupId, begin, 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 begin, int end)
143         throws com.liferay.portal.SystemException {
144         return getPersistence().findByUserId(userId, begin, end);
145     }
146 
147     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
148         long userId, int begin, int end,
149         com.liferay.portal.kernel.util.OrderByComparator obc)
150         throws com.liferay.portal.SystemException {
151         return getPersistence().findByUserId(userId, begin, 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<com.liferay.portlet.shopping.model.ShoppingCart> findWithDynamicQuery(
189         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
190         throws com.liferay.portal.SystemException {
191         return getPersistence().findWithDynamicQuery(queryInitializer);
192     }
193 
194     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findWithDynamicQuery(
195         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
196         int begin, int end) throws com.liferay.portal.SystemException {
197         return getPersistence()
198                    .findWithDynamicQuery(queryInitializer, begin, end);
199     }
200 
201     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll()
202         throws com.liferay.portal.SystemException {
203         return getPersistence().findAll();
204     }
205 
206     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll(
207         int begin, int end) throws com.liferay.portal.SystemException {
208         return getPersistence().findAll(begin, end);
209     }
210 
211     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll(
212         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
213         throws com.liferay.portal.SystemException {
214         return getPersistence().findAll(begin, end, obc);
215     }
216 
217     public static void removeByGroupId(long groupId)
218         throws com.liferay.portal.SystemException {
219         getPersistence().removeByGroupId(groupId);
220     }
221 
222     public static void removeByUserId(long userId)
223         throws com.liferay.portal.SystemException {
224         getPersistence().removeByUserId(userId);
225     }
226 
227     public static void removeByG_U(long groupId, long userId)
228         throws com.liferay.portal.SystemException,
229             com.liferay.portlet.shopping.NoSuchCartException {
230         getPersistence().removeByG_U(groupId, userId);
231     }
232 
233     public static void removeAll() throws com.liferay.portal.SystemException {
234         getPersistence().removeAll();
235     }
236 
237     public static int countByGroupId(long groupId)
238         throws com.liferay.portal.SystemException {
239         return getPersistence().countByGroupId(groupId);
240     }
241 
242     public static int countByUserId(long userId)
243         throws com.liferay.portal.SystemException {
244         return getPersistence().countByUserId(userId);
245     }
246 
247     public static int countByG_U(long groupId, long userId)
248         throws com.liferay.portal.SystemException {
249         return getPersistence().countByG_U(groupId, userId);
250     }
251 
252     public static int countAll() throws com.liferay.portal.SystemException {
253         return getPersistence().countAll();
254     }
255 
256     public static ShoppingCartPersistence getPersistence() {
257         return _getUtil()._persistence;
258     }
259 
260     public void setPersistence(ShoppingCartPersistence persistence) {
261         _persistence = persistence;
262     }
263 
264     private static ShoppingCartUtil _getUtil() {
265         if (_util == null) {
266             _util = (ShoppingCartUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
267         }
268 
269         return _util;
270     }
271 
272     private static final String _UTIL = ShoppingCartUtil.class.getName();
273     private static ShoppingCartUtil _util;
274     private ShoppingCartPersistence _persistence;
275 }