001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.shopping.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.util.OrderByComparator;
021    import com.liferay.portal.kernel.util.ReferenceRegistry;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import com.liferay.portlet.shopping.model.ShoppingCoupon;
025    
026    import java.util.List;
027    
028    /**
029     * The persistence utility for the shopping coupon service. This utility wraps {@link ShoppingCouponPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
030     *
031     * <p>
032     * Caching information and settings can be found in <code>portal.properties</code>
033     * </p>
034     *
035     * @author Brian Wing Shun Chan
036     * @see ShoppingCouponPersistence
037     * @see ShoppingCouponPersistenceImpl
038     * @generated
039     */
040    public class ShoppingCouponUtil {
041            /*
042             * NOTE FOR DEVELOPERS:
043             *
044             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
045             */
046    
047            /**
048             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
049             */
050            public static void clearCache() {
051                    getPersistence().clearCache();
052            }
053    
054            /**
055             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
056             */
057            public static void clearCache(ShoppingCoupon shoppingCoupon) {
058                    getPersistence().clearCache(shoppingCoupon);
059            }
060    
061            /**
062             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
063             */
064            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
065                    throws SystemException {
066                    return getPersistence().countWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
071             */
072            public static List<ShoppingCoupon> findWithDynamicQuery(
073                    DynamicQuery dynamicQuery) throws SystemException {
074                    return getPersistence().findWithDynamicQuery(dynamicQuery);
075            }
076    
077            /**
078             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
079             */
080            public static List<ShoppingCoupon> findWithDynamicQuery(
081                    DynamicQuery dynamicQuery, int start, int end)
082                    throws SystemException {
083                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
084            }
085    
086            /**
087             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
088             */
089            public static List<ShoppingCoupon> findWithDynamicQuery(
090                    DynamicQuery dynamicQuery, int start, int end,
091                    OrderByComparator orderByComparator) throws SystemException {
092                    return getPersistence()
093                                       .findWithDynamicQuery(dynamicQuery, start, end,
094                            orderByComparator);
095            }
096    
097            /**
098             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel)
099             */
100            public static ShoppingCoupon update(ShoppingCoupon shoppingCoupon)
101                    throws SystemException {
102                    return getPersistence().update(shoppingCoupon);
103            }
104    
105            /**
106             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
107             */
108            public static ShoppingCoupon update(ShoppingCoupon shoppingCoupon,
109                    ServiceContext serviceContext) throws SystemException {
110                    return getPersistence().update(shoppingCoupon, serviceContext);
111            }
112    
113            /**
114            * Caches the shopping coupon in the entity cache if it is enabled.
115            *
116            * @param shoppingCoupon the shopping coupon
117            */
118            public static void cacheResult(
119                    com.liferay.portlet.shopping.model.ShoppingCoupon shoppingCoupon) {
120                    getPersistence().cacheResult(shoppingCoupon);
121            }
122    
123            /**
124            * Caches the shopping coupons in the entity cache if it is enabled.
125            *
126            * @param shoppingCoupons the shopping coupons
127            */
128            public static void cacheResult(
129                    java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> shoppingCoupons) {
130                    getPersistence().cacheResult(shoppingCoupons);
131            }
132    
133            /**
134            * Creates a new shopping coupon with the primary key. Does not add the shopping coupon to the database.
135            *
136            * @param couponId the primary key for the new shopping coupon
137            * @return the new shopping coupon
138            */
139            public static com.liferay.portlet.shopping.model.ShoppingCoupon create(
140                    long couponId) {
141                    return getPersistence().create(couponId);
142            }
143    
144            /**
145            * Removes the shopping coupon with the primary key from the database. Also notifies the appropriate model listeners.
146            *
147            * @param couponId the primary key of the shopping coupon
148            * @return the shopping coupon that was removed
149            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a shopping coupon with the primary key could not be found
150            * @throws SystemException if a system exception occurred
151            */
152            public static com.liferay.portlet.shopping.model.ShoppingCoupon remove(
153                    long couponId)
154                    throws com.liferay.portal.kernel.exception.SystemException,
155                            com.liferay.portlet.shopping.NoSuchCouponException {
156                    return getPersistence().remove(couponId);
157            }
158    
159            public static com.liferay.portlet.shopping.model.ShoppingCoupon updateImpl(
160                    com.liferay.portlet.shopping.model.ShoppingCoupon shoppingCoupon)
161                    throws com.liferay.portal.kernel.exception.SystemException {
162                    return getPersistence().updateImpl(shoppingCoupon);
163            }
164    
165            /**
166            * Returns the shopping coupon with the primary key or throws a {@link com.liferay.portlet.shopping.NoSuchCouponException} if it could not be found.
167            *
168            * @param couponId the primary key of the shopping coupon
169            * @return the shopping coupon
170            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a shopping coupon with the primary key could not be found
171            * @throws SystemException if a system exception occurred
172            */
173            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByPrimaryKey(
174                    long couponId)
175                    throws com.liferay.portal.kernel.exception.SystemException,
176                            com.liferay.portlet.shopping.NoSuchCouponException {
177                    return getPersistence().findByPrimaryKey(couponId);
178            }
179    
180            /**
181            * Returns the shopping coupon with the primary key or returns <code>null</code> if it could not be found.
182            *
183            * @param couponId the primary key of the shopping coupon
184            * @return the shopping coupon, or <code>null</code> if a shopping coupon with the primary key could not be found
185            * @throws SystemException if a system exception occurred
186            */
187            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByPrimaryKey(
188                    long couponId)
189                    throws com.liferay.portal.kernel.exception.SystemException {
190                    return getPersistence().fetchByPrimaryKey(couponId);
191            }
192    
193            /**
194            * Returns all the shopping coupons where groupId = &#63;.
195            *
196            * @param groupId the group ID
197            * @return the matching shopping coupons
198            * @throws SystemException if a system exception occurred
199            */
200            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findByGroupId(
201                    long groupId)
202                    throws com.liferay.portal.kernel.exception.SystemException {
203                    return getPersistence().findByGroupId(groupId);
204            }
205    
206            /**
207            * Returns a range of all the shopping coupons where groupId = &#63;.
208            *
209            * <p>
210            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
211            * </p>
212            *
213            * @param groupId the group ID
214            * @param start the lower bound of the range of shopping coupons
215            * @param end the upper bound of the range of shopping coupons (not inclusive)
216            * @return the range of matching shopping coupons
217            * @throws SystemException if a system exception occurred
218            */
219            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findByGroupId(
220                    long groupId, int start, int end)
221                    throws com.liferay.portal.kernel.exception.SystemException {
222                    return getPersistence().findByGroupId(groupId, start, end);
223            }
224    
225            /**
226            * Returns an ordered range of all the shopping coupons where groupId = &#63;.
227            *
228            * <p>
229            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
230            * </p>
231            *
232            * @param groupId the group ID
233            * @param start the lower bound of the range of shopping coupons
234            * @param end the upper bound of the range of shopping coupons (not inclusive)
235            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
236            * @return the ordered range of matching shopping coupons
237            * @throws SystemException if a system exception occurred
238            */
239            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findByGroupId(
240                    long groupId, int start, int end,
241                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
242                    throws com.liferay.portal.kernel.exception.SystemException {
243                    return getPersistence()
244                                       .findByGroupId(groupId, start, end, orderByComparator);
245            }
246    
247            /**
248            * Returns the first shopping coupon in the ordered set where groupId = &#63;.
249            *
250            * @param groupId the group ID
251            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
252            * @return the first matching shopping coupon
253            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
254            * @throws SystemException if a system exception occurred
255            */
256            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByGroupId_First(
257                    long groupId,
258                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
259                    throws com.liferay.portal.kernel.exception.SystemException,
260                            com.liferay.portlet.shopping.NoSuchCouponException {
261                    return getPersistence().findByGroupId_First(groupId, orderByComparator);
262            }
263    
264            /**
265            * Returns the first shopping coupon in the ordered set where groupId = &#63;.
266            *
267            * @param groupId the group ID
268            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
269            * @return the first matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
270            * @throws SystemException if a system exception occurred
271            */
272            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByGroupId_First(
273                    long groupId,
274                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
275                    throws com.liferay.portal.kernel.exception.SystemException {
276                    return getPersistence().fetchByGroupId_First(groupId, orderByComparator);
277            }
278    
279            /**
280            * Returns the last shopping coupon in the ordered set where groupId = &#63;.
281            *
282            * @param groupId the group ID
283            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
284            * @return the last matching shopping coupon
285            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
286            * @throws SystemException if a system exception occurred
287            */
288            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByGroupId_Last(
289                    long groupId,
290                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
291                    throws com.liferay.portal.kernel.exception.SystemException,
292                            com.liferay.portlet.shopping.NoSuchCouponException {
293                    return getPersistence().findByGroupId_Last(groupId, orderByComparator);
294            }
295    
296            /**
297            * Returns the last shopping coupon in the ordered set where groupId = &#63;.
298            *
299            * @param groupId the group ID
300            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
301            * @return the last matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
302            * @throws SystemException if a system exception occurred
303            */
304            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByGroupId_Last(
305                    long groupId,
306                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
307                    throws com.liferay.portal.kernel.exception.SystemException {
308                    return getPersistence().fetchByGroupId_Last(groupId, orderByComparator);
309            }
310    
311            /**
312            * Returns the shopping coupons before and after the current shopping coupon in the ordered set where groupId = &#63;.
313            *
314            * @param couponId the primary key of the current shopping coupon
315            * @param groupId the group ID
316            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
317            * @return the previous, current, and next shopping coupon
318            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a shopping coupon with the primary key could not be found
319            * @throws SystemException if a system exception occurred
320            */
321            public static com.liferay.portlet.shopping.model.ShoppingCoupon[] findByGroupId_PrevAndNext(
322                    long couponId, long groupId,
323                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
324                    throws com.liferay.portal.kernel.exception.SystemException,
325                            com.liferay.portlet.shopping.NoSuchCouponException {
326                    return getPersistence()
327                                       .findByGroupId_PrevAndNext(couponId, groupId,
328                            orderByComparator);
329            }
330    
331            /**
332            * Returns the shopping coupon where code = &#63; or throws a {@link com.liferay.portlet.shopping.NoSuchCouponException} if it could not be found.
333            *
334            * @param code the code
335            * @return the matching shopping coupon
336            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
337            * @throws SystemException if a system exception occurred
338            */
339            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByCode(
340                    java.lang.String code)
341                    throws com.liferay.portal.kernel.exception.SystemException,
342                            com.liferay.portlet.shopping.NoSuchCouponException {
343                    return getPersistence().findByCode(code);
344            }
345    
346            /**
347            * Returns the shopping coupon where code = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
348            *
349            * @param code the code
350            * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
351            * @throws SystemException if a system exception occurred
352            */
353            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByCode(
354                    java.lang.String code)
355                    throws com.liferay.portal.kernel.exception.SystemException {
356                    return getPersistence().fetchByCode(code);
357            }
358    
359            /**
360            * Returns the shopping coupon where code = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
361            *
362            * @param code the code
363            * @param retrieveFromCache whether to use the finder cache
364            * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
365            * @throws SystemException if a system exception occurred
366            */
367            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByCode(
368                    java.lang.String code, boolean retrieveFromCache)
369                    throws com.liferay.portal.kernel.exception.SystemException {
370                    return getPersistence().fetchByCode(code, retrieveFromCache);
371            }
372    
373            /**
374            * Returns all the shopping coupons.
375            *
376            * @return the shopping coupons
377            * @throws SystemException if a system exception occurred
378            */
379            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll()
380                    throws com.liferay.portal.kernel.exception.SystemException {
381                    return getPersistence().findAll();
382            }
383    
384            /**
385            * Returns a range of all the shopping coupons.
386            *
387            * <p>
388            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
389            * </p>
390            *
391            * @param start the lower bound of the range of shopping coupons
392            * @param end the upper bound of the range of shopping coupons (not inclusive)
393            * @return the range of shopping coupons
394            * @throws SystemException if a system exception occurred
395            */
396            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll(
397                    int start, int end)
398                    throws com.liferay.portal.kernel.exception.SystemException {
399                    return getPersistence().findAll(start, end);
400            }
401    
402            /**
403            * Returns an ordered range of all the shopping coupons.
404            *
405            * <p>
406            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
407            * </p>
408            *
409            * @param start the lower bound of the range of shopping coupons
410            * @param end the upper bound of the range of shopping coupons (not inclusive)
411            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
412            * @return the ordered range of shopping coupons
413            * @throws SystemException if a system exception occurred
414            */
415            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll(
416                    int start, int end,
417                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
418                    throws com.liferay.portal.kernel.exception.SystemException {
419                    return getPersistence().findAll(start, end, orderByComparator);
420            }
421    
422            /**
423            * Removes all the shopping coupons where groupId = &#63; from the database.
424            *
425            * @param groupId the group ID
426            * @throws SystemException if a system exception occurred
427            */
428            public static void removeByGroupId(long groupId)
429                    throws com.liferay.portal.kernel.exception.SystemException {
430                    getPersistence().removeByGroupId(groupId);
431            }
432    
433            /**
434            * Removes the shopping coupon where code = &#63; from the database.
435            *
436            * @param code the code
437            * @return the shopping coupon that was removed
438            * @throws SystemException if a system exception occurred
439            */
440            public static com.liferay.portlet.shopping.model.ShoppingCoupon removeByCode(
441                    java.lang.String code)
442                    throws com.liferay.portal.kernel.exception.SystemException,
443                            com.liferay.portlet.shopping.NoSuchCouponException {
444                    return getPersistence().removeByCode(code);
445            }
446    
447            /**
448            * Removes all the shopping coupons from the database.
449            *
450            * @throws SystemException if a system exception occurred
451            */
452            public static void removeAll()
453                    throws com.liferay.portal.kernel.exception.SystemException {
454                    getPersistence().removeAll();
455            }
456    
457            /**
458            * Returns the number of shopping coupons where groupId = &#63;.
459            *
460            * @param groupId the group ID
461            * @return the number of matching shopping coupons
462            * @throws SystemException if a system exception occurred
463            */
464            public static int countByGroupId(long groupId)
465                    throws com.liferay.portal.kernel.exception.SystemException {
466                    return getPersistence().countByGroupId(groupId);
467            }
468    
469            /**
470            * Returns the number of shopping coupons where code = &#63;.
471            *
472            * @param code the code
473            * @return the number of matching shopping coupons
474            * @throws SystemException if a system exception occurred
475            */
476            public static int countByCode(java.lang.String code)
477                    throws com.liferay.portal.kernel.exception.SystemException {
478                    return getPersistence().countByCode(code);
479            }
480    
481            /**
482            * Returns the number of shopping coupons.
483            *
484            * @return the number of shopping coupons
485            * @throws SystemException if a system exception occurred
486            */
487            public static int countAll()
488                    throws com.liferay.portal.kernel.exception.SystemException {
489                    return getPersistence().countAll();
490            }
491    
492            public static ShoppingCouponPersistence getPersistence() {
493                    if (_persistence == null) {
494                            _persistence = (ShoppingCouponPersistence)PortalBeanLocatorUtil.locate(ShoppingCouponPersistence.class.getName());
495    
496                            ReferenceRegistry.registerReference(ShoppingCouponUtil.class,
497                                    "_persistence");
498                    }
499    
500                    return _persistence;
501            }
502    
503            /**
504             * @deprecated
505             */
506            public void setPersistence(ShoppingCouponPersistence persistence) {
507            }
508    
509            private static ShoppingCouponPersistence _persistence;
510    }