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