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