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