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