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, 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            * <p>
252            * 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.
253            * </p>
254            *
255            * @param groupId the group ID
256            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
257            * @return the first matching shopping coupon
258            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
259            * @throws SystemException if a system exception occurred
260            */
261            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByGroupId_First(
262                    long groupId,
263                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
264                    throws com.liferay.portal.kernel.exception.SystemException,
265                            com.liferay.portlet.shopping.NoSuchCouponException {
266                    return getPersistence().findByGroupId_First(groupId, orderByComparator);
267            }
268    
269            /**
270            * Returns the last shopping coupon in the ordered set where groupId = &#63;.
271            *
272            * <p>
273            * 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.
274            * </p>
275            *
276            * @param groupId the group ID
277            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
278            * @return the last matching shopping coupon
279            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
280            * @throws SystemException if a system exception occurred
281            */
282            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByGroupId_Last(
283                    long groupId,
284                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
285                    throws com.liferay.portal.kernel.exception.SystemException,
286                            com.liferay.portlet.shopping.NoSuchCouponException {
287                    return getPersistence().findByGroupId_Last(groupId, orderByComparator);
288            }
289    
290            /**
291            * Returns the shopping coupons before and after the current shopping coupon in the ordered set where groupId = &#63;.
292            *
293            * <p>
294            * 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.
295            * </p>
296            *
297            * @param couponId the primary key of the current shopping coupon
298            * @param groupId the group ID
299            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
300            * @return the previous, current, and next shopping coupon
301            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a shopping coupon with the primary key could not be found
302            * @throws SystemException if a system exception occurred
303            */
304            public static com.liferay.portlet.shopping.model.ShoppingCoupon[] findByGroupId_PrevAndNext(
305                    long couponId, long groupId,
306                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
307                    throws com.liferay.portal.kernel.exception.SystemException,
308                            com.liferay.portlet.shopping.NoSuchCouponException {
309                    return getPersistence()
310                                       .findByGroupId_PrevAndNext(couponId, groupId,
311                            orderByComparator);
312            }
313    
314            /**
315            * Returns the shopping coupon where code = &#63; or throws a {@link com.liferay.portlet.shopping.NoSuchCouponException} if it could not be found.
316            *
317            * @param code the code
318            * @return the matching shopping coupon
319            * @throws com.liferay.portlet.shopping.NoSuchCouponException if a matching shopping coupon could not be found
320            * @throws SystemException if a system exception occurred
321            */
322            public static com.liferay.portlet.shopping.model.ShoppingCoupon findByCode(
323                    java.lang.String code)
324                    throws com.liferay.portal.kernel.exception.SystemException,
325                            com.liferay.portlet.shopping.NoSuchCouponException {
326                    return getPersistence().findByCode(code);
327            }
328    
329            /**
330            * Returns the shopping coupon where code = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
331            *
332            * @param code the code
333            * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
334            * @throws SystemException if a system exception occurred
335            */
336            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByCode(
337                    java.lang.String code)
338                    throws com.liferay.portal.kernel.exception.SystemException {
339                    return getPersistence().fetchByCode(code);
340            }
341    
342            /**
343            * Returns the shopping coupon where code = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
344            *
345            * @param code the code
346            * @param retrieveFromCache whether to use the finder cache
347            * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found
348            * @throws SystemException if a system exception occurred
349            */
350            public static com.liferay.portlet.shopping.model.ShoppingCoupon fetchByCode(
351                    java.lang.String code, boolean retrieveFromCache)
352                    throws com.liferay.portal.kernel.exception.SystemException {
353                    return getPersistence().fetchByCode(code, retrieveFromCache);
354            }
355    
356            /**
357            * Returns all the shopping coupons.
358            *
359            * @return the shopping coupons
360            * @throws SystemException if a system exception occurred
361            */
362            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll()
363                    throws com.liferay.portal.kernel.exception.SystemException {
364                    return getPersistence().findAll();
365            }
366    
367            /**
368            * Returns a range of all the shopping coupons.
369            *
370            * <p>
371            * 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.
372            * </p>
373            *
374            * @param start the lower bound of the range of shopping coupons
375            * @param end the upper bound of the range of shopping coupons (not inclusive)
376            * @return the range of 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                    int start, int end)
381                    throws com.liferay.portal.kernel.exception.SystemException {
382                    return getPersistence().findAll(start, end);
383            }
384    
385            /**
386            * Returns an ordered 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            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
395            * @return the ordered range of shopping coupons
396            * @throws SystemException if a system exception occurred
397            */
398            public static java.util.List<com.liferay.portlet.shopping.model.ShoppingCoupon> findAll(
399                    int start, int end,
400                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
401                    throws com.liferay.portal.kernel.exception.SystemException {
402                    return getPersistence().findAll(start, end, orderByComparator);
403            }
404    
405            /**
406            * Removes all the shopping coupons where groupId = &#63; from the database.
407            *
408            * @param groupId the group ID
409            * @throws SystemException if a system exception occurred
410            */
411            public static void removeByGroupId(long groupId)
412                    throws com.liferay.portal.kernel.exception.SystemException {
413                    getPersistence().removeByGroupId(groupId);
414            }
415    
416            /**
417            * Removes the shopping coupon where code = &#63; from the database.
418            *
419            * @param code the code
420            * @throws SystemException if a system exception occurred
421            */
422            public static void removeByCode(java.lang.String code)
423                    throws com.liferay.portal.kernel.exception.SystemException,
424                            com.liferay.portlet.shopping.NoSuchCouponException {
425                    getPersistence().removeByCode(code);
426            }
427    
428            /**
429            * Removes all the shopping coupons from the database.
430            *
431            * @throws SystemException if a system exception occurred
432            */
433            public static void removeAll()
434                    throws com.liferay.portal.kernel.exception.SystemException {
435                    getPersistence().removeAll();
436            }
437    
438            /**
439            * Returns the number of shopping coupons where groupId = &#63;.
440            *
441            * @param groupId the group ID
442            * @return the number of matching shopping coupons
443            * @throws SystemException if a system exception occurred
444            */
445            public static int countByGroupId(long groupId)
446                    throws com.liferay.portal.kernel.exception.SystemException {
447                    return getPersistence().countByGroupId(groupId);
448            }
449    
450            /**
451            * Returns the number of shopping coupons where code = &#63;.
452            *
453            * @param code the code
454            * @return the number of matching shopping coupons
455            * @throws SystemException if a system exception occurred
456            */
457            public static int countByCode(java.lang.String code)
458                    throws com.liferay.portal.kernel.exception.SystemException {
459                    return getPersistence().countByCode(code);
460            }
461    
462            /**
463            * Returns the number of shopping coupons.
464            *
465            * @return the number of shopping coupons
466            * @throws SystemException if a system exception occurred
467            */
468            public static int countAll()
469                    throws com.liferay.portal.kernel.exception.SystemException {
470                    return getPersistence().countAll();
471            }
472    
473            public static ShoppingCouponPersistence getPersistence() {
474                    if (_persistence == null) {
475                            _persistence = (ShoppingCouponPersistence)PortalBeanLocatorUtil.locate(ShoppingCouponPersistence.class.getName());
476    
477                            ReferenceRegistry.registerReference(ShoppingCouponUtil.class,
478                                    "_persistence");
479                    }
480    
481                    return _persistence;
482            }
483    
484            public void setPersistence(ShoppingCouponPersistence persistence) {
485                    _persistence = persistence;
486    
487                    ReferenceRegistry.registerReference(ShoppingCouponUtil.class,
488                            "_persistence");
489            }
490    
491            private static ShoppingCouponPersistence _persistence;
492    }