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