001    /**
002     * Copyright (c) 2000-2013 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, boolean)
099             */
100            public static ShoppingCoupon update(ShoppingCoupon shoppingCoupon,
101                    boolean merge) throws SystemException {
102                    return getPersistence().update(shoppingCoupon, merge);
103            }
104    
105            /**
106             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
107             */
108            public static ShoppingCoupon update(ShoppingCoupon shoppingCoupon,
109                    boolean merge, ServiceContext serviceContext) throws SystemException {
110                    return getPersistence().update(shoppingCoupon, merge, 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                    boolean merge)
162                    throws com.liferay.portal.kernel.exception.SystemException {
163                    return getPersistence().updateImpl(shoppingCoupon, merge);
164            }
165    
166            /**
167            * Returns the shopping coupon with the primary key or throws a {@link com.liferay.portlet.shopping.NoSuchCouponException} if it could not be found.
168            *
169            * @param couponId the primary key of the shopping coupon
170            * @return the shopping coupon
171            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a shopping coupon with the primary key could not be found
172            * @throws SystemException if a system exception occurred
173            */
174            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByPrimaryKey(
175                    long couponId)
176                    throws com.liferay.portal.kernel.exception.SystemException,
177                            com.liferay.portlet.shopping.NoSuchCouponException {
178                    return getPersistence().findByPrimaryKey(couponId);
179            }
180    
181            /**
182            * Returns the shopping coupon with the primary key or returns <code>null</code> if it could not be found.
183            *
184            * @param couponId the primary key of the shopping coupon
185            * @return the shopping coupon, or <code>null</code> if a shopping coupon with the primary key could not be found
186            * @throws SystemException if a system exception occurred
187            */
188            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByPrimaryKey(
189                    long couponId)
190                    throws com.liferay.portal.kernel.exception.SystemException {
191                    return getPersistence().fetchByPrimaryKey(couponId);
192            }
193    
194            /**
195            * Returns all the shopping coupons where groupId = &#63;.
196            *
197            * @param groupId the group ID
198            * @return the matching shopping coupons
199            * @throws SystemException if a system exception occurred
200            */
201            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findByGroupId(
202                    long groupId)
203                    throws com.liferay.portal.kernel.exception.SystemException {
204                    return getPersistence().findByGroupId(groupId);
205            }
206    
207            /**
208            * Returns a range of all the shopping coupons where groupId = &#63;.
209            *
210            * <p>
211            * 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.
212            * </p>
213            *
214            * @param groupId the group ID
215            * @param start the lower bound of the range of shopping coupons
216            * @param end the upper bound of the range of shopping coupons (not inclusive)
217            * @return the range of matching shopping coupons
218            * @throws SystemException if a system exception occurred
219            */
220            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findByGroupId(
221                    long groupId, int start, int end)
222                    throws com.liferay.portal.kernel.exception.SystemException {
223                    return getPersistence().findByGroupId(groupId, start, end);
224            }
225    
226            /**
227            * Returns an ordered range of all the shopping coupons where groupId = &#63;.
228            *
229            * <p>
230            * 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.
231            * </p>
232            *
233            * @param groupId the group ID
234            * @param start the lower bound of the range of shopping coupons
235            * @param end the upper bound of the range of shopping coupons (not inclusive)
236            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
237            * @return the ordered range of matching shopping coupons
238            * @throws SystemException if a system exception occurred
239            */
240            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findByGroupId(
241                    long groupId, int start, int end,
242                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
243                    throws com.liferay.portal.kernel.exception.SystemException {
244                    return getPersistence()
245                                       .findByGroupId(groupId, start, end, orderByComparator);
246            }
247    
248            /**
249            * Returns the first shopping coupon in the ordered set where groupId = &#63;.
250            *
251            * @param groupId the group ID
252            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
253            * @return the first matching shopping coupon
254            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
255            * @throws SystemException if a system exception occurred
256            */
257            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByGroupId_First(
258                    long groupId,
259                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
260                    throws com.liferay.portal.kernel.exception.SystemException,
261                            com.liferay.portlet.shopping.NoSuchCouponException {
262                    return getPersistence().findByGroupId_First(groupId, orderByComparator);
263            }
264    
265            /**
266            * Returns the first shopping coupon in the ordered set where groupId = &#63;.
267            *
268            * @param groupId the group ID
269            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
270            * @return the first matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
271            * @throws SystemException if a system exception occurred
272            */
273            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByGroupId_First(
274                    long groupId,
275                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
276                    throws com.liferay.portal.kernel.exception.SystemException {
277                    return getPersistence().fetchByGroupId_First(groupId, orderByComparator);
278            }
279    
280            /**
281            * Returns the last shopping coupon in the ordered set where groupId = &#63;.
282            *
283            * @param groupId the group ID
284            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
285            * @return the last matching shopping coupon
286            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
287            * @throws SystemException if a system exception occurred
288            */
289            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByGroupId_Last(
290                    long groupId,
291                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
292                    throws com.liferay.portal.kernel.exception.SystemException,
293                            com.liferay.portlet.shopping.NoSuchCouponException {
294                    return getPersistence().findByGroupId_Last(groupId, orderByComparator);
295            }
296    
297            /**
298            * Returns the last shopping coupon in the ordered set where groupId = &#63;.
299            *
300            * @param groupId the group ID
301            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
302            * @return the last matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
303            * @throws SystemException if a system exception occurred
304            */
305            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByGroupId_Last(
306                    long groupId,
307                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
308                    throws com.liferay.portal.kernel.exception.SystemException {
309                    return getPersistence().fetchByGroupId_Last(groupId, orderByComparator);
310            }
311    
312            /**
313            * Returns the shopping coupons before and after the current shopping coupon in the ordered set where groupId = &#63;.
314            *
315            * @param couponId the primary key of the current shopping coupon
316            * @param groupId the group ID
317            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
318            * @return the previous, current, and next shopping coupon
319            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a shopping coupon with the primary key could not be found
320            * @throws SystemException if a system exception occurred
321            */
322            public static com.liferay.portlet.shopping.model.ShoppingCoupon[] findByGroupId_PrevAndNext(
323                    long couponId, long groupId,
324                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
325                    throws com.liferay.portal.kernel.exception.SystemException,
326                            com.liferay.portlet.shopping.NoSuchCouponException {
327                    return getPersistence()
328                                       .findByGroupId_PrevAndNext(couponId, groupId,
329                            orderByComparator);
330            }
331    
332            /**
333            * Returns the shopping coupon where code = &#63; or throws a {@link com.liferay.portlet.shopping.NoSuchCouponException} if it could not be found.
334            *
335            * @param code the code
336            * @return the matching shopping coupon
337            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
338            * @throws SystemException if a system exception occurred
339            */
340            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByCode(
341                    java.lang.String code)
342                    throws com.liferay.portal.kernel.exception.SystemException,
343                            com.liferay.portlet.shopping.NoSuchCouponException {
344                    return getPersistence().findByCode(code);
345            }
346    
347            /**
348            * Returns the shopping coupon where code = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
349            *
350            * @param code the code
351            * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
352            * @throws SystemException if a system exception occurred
353            */
354            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByCode(
355                    java.lang.String code)
356                    throws com.liferay.portal.kernel.exception.SystemException {
357                    return getPersistence().fetchByCode(code);
358            }
359    
360            /**
361            * Returns the shopping coupon where code = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
362            *
363            * @param code the code
364            * @param retrieveFromCache whether to use the finder cache
365            * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
366            * @throws SystemException if a system exception occurred
367            */
368            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByCode(
369                    java.lang.String code, boolean retrieveFromCache)
370                    throws com.liferay.portal.kernel.exception.SystemException {
371                    return getPersistence().fetchByCode(code, retrieveFromCache);
372            }
373    
374            /**
375            * Returns all the shopping coupons.
376            *
377            * @return the shopping coupons
378            * @throws SystemException if a system exception occurred
379            */
380            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll()
381                    throws com.liferay.portal.kernel.exception.SystemException {
382                    return getPersistence().findAll();
383            }
384    
385            /**
386            * Returns a range of all the shopping coupons.
387            *
388            * <p>
389            * 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.
390            * </p>
391            *
392            * @param start the lower bound of the range of shopping coupons
393            * @param end the upper bound of the range of shopping coupons (not inclusive)
394            * @return the range of shopping coupons
395            * @throws SystemException if a system exception occurred
396            */
397            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll(
398                    int start, int end)
399                    throws com.liferay.portal.kernel.exception.SystemException {
400                    return getPersistence().findAll(start, end);
401            }
402    
403            /**
404            * Returns an ordered range of all the shopping coupons.
405            *
406            * <p>
407            * 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.
408            * </p>
409            *
410            * @param start the lower bound of the range of shopping coupons
411            * @param end the upper bound of the range of shopping coupons (not inclusive)
412            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
413            * @return the ordered range of shopping coupons
414            * @throws SystemException if a system exception occurred
415            */
416            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll(
417                    int start, int end,
418                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
419                    throws com.liferay.portal.kernel.exception.SystemException {
420                    return getPersistence().findAll(start, end, orderByComparator);
421            }
422    
423            /**
424            * Removes all the shopping coupons where groupId = &#63; from the database.
425            *
426            * @param groupId the group ID
427            * @throws SystemException if a system exception occurred
428            */
429            public static void removeByGroupId(long groupId)
430                    throws com.liferay.portal.kernel.exception.SystemException {
431                    getPersistence().removeByGroupId(groupId);
432            }
433    
434            /**
435            * Removes the shopping coupon where code = &#63; from the database.
436            *
437            * @param code the code
438            * @return the shopping coupon that was removed
439            * @throws SystemException if a system exception occurred
440            */
441            public static com.liferay.portlet.shopping.model.ShoppingCoupon removeByCode(
442                    java.lang.String code)
443                    throws com.liferay.portal.kernel.exception.SystemException,
444                            com.liferay.portlet.shopping.NoSuchCouponException {
445                    return getPersistence().removeByCode(code);
446            }
447    
448            /**
449            * Removes all the shopping coupons from the database.
450            *
451            * @throws SystemException if a system exception occurred
452            */
453            public static void removeAll()
454                    throws com.liferay.portal.kernel.exception.SystemException {
455                    getPersistence().removeAll();
456            }
457    
458            /**
459            * Returns the number of shopping coupons where groupId = &#63;.
460            *
461            * @param groupId the group ID
462            * @return the number of matching shopping coupons
463            * @throws SystemException if a system exception occurred
464            */
465            public static int countByGroupId(long groupId)
466                    throws com.liferay.portal.kernel.exception.SystemException {
467                    return getPersistence().countByGroupId(groupId);
468            }
469    
470            /**
471            * Returns the number of shopping coupons where code = &#63;.
472            *
473            * @param code the code
474            * @return the number of matching shopping coupons
475            * @throws SystemException if a system exception occurred
476            */
477            public static int countByCode(java.lang.String code)
478                    throws com.liferay.portal.kernel.exception.SystemException {
479                    return getPersistence().countByCode(code);
480            }
481    
482            /**
483            * Returns the number of shopping coupons.
484            *
485            * @return the number of shopping coupons
486            * @throws SystemException if a system exception occurred
487            */
488            public static int countAll()
489                    throws com.liferay.portal.kernel.exception.SystemException {
490                    return getPersistence().countAll();
491            }
492    
493            public static ShoppingCouponPersistence getPersistence() {
494                    if (_persistence == null) {
495                            _persistence = (ShoppingCouponPersistence)PortalBeanLocatorUtil.locate(ShoppingCouponPersistence.class.getName());
496    
497                            ReferenceRegistry.registerReference(ShoppingCouponUtil.class,
498                                    "_persistence");
499                    }
500    
501                    return _persistence;
502            }
503    
504            /**
505             * @deprecated
506             */
507            public void setPersistence(ShoppingCouponPersistence persistence) {
508            }
509    
510            private static ShoppingCouponPersistence _persistence;
511    }