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