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