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 com.liferay.portlet.shopping.model.ShoppingCart create(
30          long cartId) {
31          return getPersistence().create(cartId);
32      }
33  
34      public static com.liferay.portlet.shopping.model.ShoppingCart remove(
35          long cartId)
36          throws com.liferay.portal.SystemException,
37              com.liferay.portlet.shopping.NoSuchCartException {
38          return getPersistence().remove(cartId);
39      }
40  
41      public static com.liferay.portlet.shopping.model.ShoppingCart remove(
42          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart)
43          throws com.liferay.portal.SystemException {
44          return getPersistence().remove(shoppingCart);
45      }
46  
47      /**
48       * @deprecated Use <code>update(ShoppingCart shoppingCart, boolean merge)</code>.
49       */
50      public static com.liferay.portlet.shopping.model.ShoppingCart update(
51          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart)
52          throws com.liferay.portal.SystemException {
53          return getPersistence().update(shoppingCart);
54      }
55  
56      /**
57       * Add, update, or merge, the entity. This method also calls the model
58       * listeners to trigger the proper events associated with adding, deleting,
59       * or updating an entity.
60       *
61       * @param        shoppingCart the entity to add, update, or merge
62       * @param        merge boolean value for whether to merge the entity. The
63       *                default value is false. Setting merge to true is more
64       *                expensive and should only be true when shoppingCart is
65       *                transient. See LEP-5473 for a detailed discussion of this
66       *                method.
67       * @return        true if the portlet can be displayed via Ajax
68       */
69      public static com.liferay.portlet.shopping.model.ShoppingCart update(
70          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart,
71          boolean merge) throws com.liferay.portal.SystemException {
72          return getPersistence().update(shoppingCart, merge);
73      }
74  
75      public static com.liferay.portlet.shopping.model.ShoppingCart updateImpl(
76          com.liferay.portlet.shopping.model.ShoppingCart shoppingCart,
77          boolean merge) throws com.liferay.portal.SystemException {
78          return getPersistence().updateImpl(shoppingCart, merge);
79      }
80  
81      public static com.liferay.portlet.shopping.model.ShoppingCart findByPrimaryKey(
82          long cartId)
83          throws com.liferay.portal.SystemException,
84              com.liferay.portlet.shopping.NoSuchCartException {
85          return getPersistence().findByPrimaryKey(cartId);
86      }
87  
88      public static com.liferay.portlet.shopping.model.ShoppingCart fetchByPrimaryKey(
89          long cartId) throws com.liferay.portal.SystemException {
90          return getPersistence().fetchByPrimaryKey(cartId);
91      }
92  
93      public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
94          long groupId) throws com.liferay.portal.SystemException {
95          return getPersistence().findByGroupId(groupId);
96      }
97  
98      public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
99          long groupId, int start, int end)
100         throws com.liferay.portal.SystemException {
101         return getPersistence().findByGroupId(groupId, start, end);
102     }
103 
104     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByGroupId(
105         long groupId, int start, int end,
106         com.liferay.portal.kernel.util.OrderByComparator obc)
107         throws com.liferay.portal.SystemException {
108         return getPersistence().findByGroupId(groupId, start, end, obc);
109     }
110 
111     public static com.liferay.portlet.shopping.model.ShoppingCart findByGroupId_First(
112         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
113         throws com.liferay.portal.SystemException,
114             com.liferay.portlet.shopping.NoSuchCartException {
115         return getPersistence().findByGroupId_First(groupId, obc);
116     }
117 
118     public static com.liferay.portlet.shopping.model.ShoppingCart findByGroupId_Last(
119         long groupId, com.liferay.portal.kernel.util.OrderByComparator obc)
120         throws com.liferay.portal.SystemException,
121             com.liferay.portlet.shopping.NoSuchCartException {
122         return getPersistence().findByGroupId_Last(groupId, obc);
123     }
124 
125     public static com.liferay.portlet.shopping.model.ShoppingCart[] findByGroupId_PrevAndNext(
126         long cartId, long groupId,
127         com.liferay.portal.kernel.util.OrderByComparator obc)
128         throws com.liferay.portal.SystemException,
129             com.liferay.portlet.shopping.NoSuchCartException {
130         return getPersistence().findByGroupId_PrevAndNext(cartId, groupId, obc);
131     }
132 
133     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
134         long userId) throws com.liferay.portal.SystemException {
135         return getPersistence().findByUserId(userId);
136     }
137 
138     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
139         long userId, int start, int end)
140         throws com.liferay.portal.SystemException {
141         return getPersistence().findByUserId(userId, start, end);
142     }
143 
144     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findByUserId(
145         long userId, int start, int end,
146         com.liferay.portal.kernel.util.OrderByComparator obc)
147         throws com.liferay.portal.SystemException {
148         return getPersistence().findByUserId(userId, start, end, obc);
149     }
150 
151     public static com.liferay.portlet.shopping.model.ShoppingCart findByUserId_First(
152         long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
153         throws com.liferay.portal.SystemException,
154             com.liferay.portlet.shopping.NoSuchCartException {
155         return getPersistence().findByUserId_First(userId, obc);
156     }
157 
158     public static com.liferay.portlet.shopping.model.ShoppingCart findByUserId_Last(
159         long userId, com.liferay.portal.kernel.util.OrderByComparator obc)
160         throws com.liferay.portal.SystemException,
161             com.liferay.portlet.shopping.NoSuchCartException {
162         return getPersistence().findByUserId_Last(userId, obc);
163     }
164 
165     public static com.liferay.portlet.shopping.model.ShoppingCart[] findByUserId_PrevAndNext(
166         long cartId, long userId,
167         com.liferay.portal.kernel.util.OrderByComparator obc)
168         throws com.liferay.portal.SystemException,
169             com.liferay.portlet.shopping.NoSuchCartException {
170         return getPersistence().findByUserId_PrevAndNext(cartId, userId, obc);
171     }
172 
173     public static com.liferay.portlet.shopping.model.ShoppingCart findByG_U(
174         long groupId, long userId)
175         throws com.liferay.portal.SystemException,
176             com.liferay.portlet.shopping.NoSuchCartException {
177         return getPersistence().findByG_U(groupId, userId);
178     }
179 
180     public static com.liferay.portlet.shopping.model.ShoppingCart fetchByG_U(
181         long groupId, long userId) throws com.liferay.portal.SystemException {
182         return getPersistence().fetchByG_U(groupId, userId);
183     }
184 
185     public static java.util.List<Object> findWithDynamicQuery(
186         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
187         throws com.liferay.portal.SystemException {
188         return getPersistence().findWithDynamicQuery(dynamicQuery);
189     }
190 
191     public static java.util.List<Object> findWithDynamicQuery(
192         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
193         int end) throws com.liferay.portal.SystemException {
194         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
195     }
196 
197     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll()
198         throws com.liferay.portal.SystemException {
199         return getPersistence().findAll();
200     }
201 
202     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll(
203         int start, int end) throws com.liferay.portal.SystemException {
204         return getPersistence().findAll(start, end);
205     }
206 
207     public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCart> findAll(
208         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
209         throws com.liferay.portal.SystemException {
210         return getPersistence().findAll(start, end, obc);
211     }
212 
213     public static void removeByGroupId(long groupId)
214         throws com.liferay.portal.SystemException {
215         getPersistence().removeByGroupId(groupId);
216     }
217 
218     public static void removeByUserId(long userId)
219         throws com.liferay.portal.SystemException {
220         getPersistence().removeByUserId(userId);
221     }
222 
223     public static void removeByG_U(long groupId, long userId)
224         throws com.liferay.portal.SystemException,
225             com.liferay.portlet.shopping.NoSuchCartException {
226         getPersistence().removeByG_U(groupId, userId);
227     }
228 
229     public static void removeAll() throws com.liferay.portal.SystemException {
230         getPersistence().removeAll();
231     }
232 
233     public static int countByGroupId(long groupId)
234         throws com.liferay.portal.SystemException {
235         return getPersistence().countByGroupId(groupId);
236     }
237 
238     public static int countByUserId(long userId)
239         throws com.liferay.portal.SystemException {
240         return getPersistence().countByUserId(userId);
241     }
242 
243     public static int countByG_U(long groupId, long userId)
244         throws com.liferay.portal.SystemException {
245         return getPersistence().countByG_U(groupId, userId);
246     }
247 
248     public static int countAll() throws com.liferay.portal.SystemException {
249         return getPersistence().countAll();
250     }
251 
252     public static ShoppingCartPersistence getPersistence() {
253         return _persistence;
254     }
255 
256     public void setPersistence(ShoppingCartPersistence persistence) {
257         _persistence = persistence;
258     }
259 
260     private static ShoppingCartPersistence _persistence;
261 }