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.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.kernel.util.ReferenceRegistry;
022    import com.liferay.portal.model.Resource;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the resource service. This utility wraps {@link ResourcePersistenceImpl} 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     * Caching information and settings can be found in <code>portal.properties</code>
032     * </p>
033     *
034     * @author Brian Wing Shun Chan
035     * @see ResourcePersistence
036     * @see ResourcePersistenceImpl
037     * @generated
038     */
039    public class ResourceUtil {
040            /*
041             * NOTE FOR DEVELOPERS:
042             *
043             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
044             */
045    
046            /**
047             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
048             */
049            public static void clearCache() {
050                    getPersistence().clearCache();
051            }
052    
053            /**
054             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
055             */
056            public static void clearCache(Resource resource) {
057                    getPersistence().clearCache(resource);
058            }
059    
060            /**
061             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
062             */
063            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
064                    throws SystemException {
065                    return getPersistence().countWithDynamicQuery(dynamicQuery);
066            }
067    
068            /**
069             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
070             */
071            public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery)
072                    throws SystemException {
073                    return getPersistence().findWithDynamicQuery(dynamicQuery);
074            }
075    
076            /**
077             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
078             */
079            public static List<Resource> findWithDynamicQuery(
080                    DynamicQuery dynamicQuery, int start, int end)
081                    throws SystemException {
082                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
083            }
084    
085            /**
086             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
087             */
088            public static List<Resource> findWithDynamicQuery(
089                    DynamicQuery dynamicQuery, int start, int end,
090                    OrderByComparator orderByComparator) throws SystemException {
091                    return getPersistence()
092                                       .findWithDynamicQuery(dynamicQuery, start, end,
093                            orderByComparator);
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
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
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. Does not add the resource to the database.
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
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            * Returns 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
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            * Returns 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
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            * Returns all the resources where codeId = &#63;.
191            *
192            * @param codeId the code ID
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            * Returns 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
209            * @param start the lower bound of the range of resources
210            * @param end the upper bound of the range of resources (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            * Returns 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
228            * @param start the lower bound of the range of resources
229            * @param end the upper bound of the range of resources (not inclusive)
230            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
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            * Returns the first resource in the ordered set where codeId = &#63;.
244            *
245            * @param codeId the code ID
246            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
247            * @return the first matching resource
248            * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
249            * @throws SystemException if a system exception occurred
250            */
251            public static com.liferay.portal.model.Resource findByCodeId_First(
252                    long codeId,
253                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
254                    throws com.liferay.portal.NoSuchResourceException,
255                            com.liferay.portal.kernel.exception.SystemException {
256                    return getPersistence().findByCodeId_First(codeId, orderByComparator);
257            }
258    
259            /**
260            * Returns the first resource in the ordered set where codeId = &#63;.
261            *
262            * @param codeId the code ID
263            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
264            * @return the first matching resource, or <code>null</code> if a matching resource could not be found
265            * @throws SystemException if a system exception occurred
266            */
267            public static com.liferay.portal.model.Resource fetchByCodeId_First(
268                    long codeId,
269                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
270                    throws com.liferay.portal.kernel.exception.SystemException {
271                    return getPersistence().fetchByCodeId_First(codeId, orderByComparator);
272            }
273    
274            /**
275            * Returns the last resource in the ordered set where codeId = &#63;.
276            *
277            * @param codeId the code ID
278            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
279            * @return the last matching resource
280            * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
281            * @throws SystemException if a system exception occurred
282            */
283            public static com.liferay.portal.model.Resource findByCodeId_Last(
284                    long codeId,
285                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
286                    throws com.liferay.portal.NoSuchResourceException,
287                            com.liferay.portal.kernel.exception.SystemException {
288                    return getPersistence().findByCodeId_Last(codeId, orderByComparator);
289            }
290    
291            /**
292            * Returns the last resource in the ordered set where codeId = &#63;.
293            *
294            * @param codeId the code ID
295            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
296            * @return the last matching resource, or <code>null</code> if a matching resource could not be found
297            * @throws SystemException if a system exception occurred
298            */
299            public static com.liferay.portal.model.Resource fetchByCodeId_Last(
300                    long codeId,
301                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
302                    throws com.liferay.portal.kernel.exception.SystemException {
303                    return getPersistence().fetchByCodeId_Last(codeId, orderByComparator);
304            }
305    
306            /**
307            * Returns the resources before and after the current resource in the ordered set where codeId = &#63;.
308            *
309            * @param resourceId the primary key of the current resource
310            * @param codeId the code ID
311            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
312            * @return the previous, current, and next resource
313            * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found
314            * @throws SystemException if a system exception occurred
315            */
316            public static com.liferay.portal.model.Resource[] findByCodeId_PrevAndNext(
317                    long resourceId, long codeId,
318                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
319                    throws com.liferay.portal.NoSuchResourceException,
320                            com.liferay.portal.kernel.exception.SystemException {
321                    return getPersistence()
322                                       .findByCodeId_PrevAndNext(resourceId, codeId,
323                            orderByComparator);
324            }
325    
326            /**
327            * Returns all the resources where primKey = &#63;.
328            *
329            * @param primKey the prim key
330            * @return the matching resources
331            * @throws SystemException if a system exception occurred
332            */
333            public static java.util.List<com.liferay.portal.model.Resource> findByPrimKey(
334                    java.lang.String primKey)
335                    throws com.liferay.portal.kernel.exception.SystemException {
336                    return getPersistence().findByPrimKey(primKey);
337            }
338    
339            /**
340            * Returns a range of all the resources where primKey = &#63;.
341            *
342            * <p>
343            * 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.
344            * </p>
345            *
346            * @param primKey the prim key
347            * @param start the lower bound of the range of resources
348            * @param end the upper bound of the range of resources (not inclusive)
349            * @return the range of matching resources
350            * @throws SystemException if a system exception occurred
351            */
352            public static java.util.List<com.liferay.portal.model.Resource> findByPrimKey(
353                    java.lang.String primKey, int start, int end)
354                    throws com.liferay.portal.kernel.exception.SystemException {
355                    return getPersistence().findByPrimKey(primKey, start, end);
356            }
357    
358            /**
359            * Returns an ordered range of all the resources where primKey = &#63;.
360            *
361            * <p>
362            * 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.
363            * </p>
364            *
365            * @param primKey the prim key
366            * @param start the lower bound of the range of resources
367            * @param end the upper bound of the range of resources (not inclusive)
368            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
369            * @return the ordered range of matching resources
370            * @throws SystemException if a system exception occurred
371            */
372            public static java.util.List<com.liferay.portal.model.Resource> findByPrimKey(
373                    java.lang.String primKey, int start, int end,
374                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
375                    throws com.liferay.portal.kernel.exception.SystemException {
376                    return getPersistence()
377                                       .findByPrimKey(primKey, start, end, orderByComparator);
378            }
379    
380            /**
381            * Returns the first resource in the ordered set where primKey = &#63;.
382            *
383            * @param primKey the prim key
384            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
385            * @return the first matching resource
386            * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
387            * @throws SystemException if a system exception occurred
388            */
389            public static com.liferay.portal.model.Resource findByPrimKey_First(
390                    java.lang.String primKey,
391                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
392                    throws com.liferay.portal.NoSuchResourceException,
393                            com.liferay.portal.kernel.exception.SystemException {
394                    return getPersistence().findByPrimKey_First(primKey, orderByComparator);
395            }
396    
397            /**
398            * Returns the first resource in the ordered set where primKey = &#63;.
399            *
400            * @param primKey the prim key
401            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
402            * @return the first matching resource, or <code>null</code> if a matching resource could not be found
403            * @throws SystemException if a system exception occurred
404            */
405            public static com.liferay.portal.model.Resource fetchByPrimKey_First(
406                    java.lang.String primKey,
407                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
408                    throws com.liferay.portal.kernel.exception.SystemException {
409                    return getPersistence().fetchByPrimKey_First(primKey, orderByComparator);
410            }
411    
412            /**
413            * Returns the last resource in the ordered set where primKey = &#63;.
414            *
415            * @param primKey the prim key
416            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
417            * @return the last matching resource
418            * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
419            * @throws SystemException if a system exception occurred
420            */
421            public static com.liferay.portal.model.Resource findByPrimKey_Last(
422                    java.lang.String primKey,
423                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
424                    throws com.liferay.portal.NoSuchResourceException,
425                            com.liferay.portal.kernel.exception.SystemException {
426                    return getPersistence().findByPrimKey_Last(primKey, orderByComparator);
427            }
428    
429            /**
430            * Returns the last resource in the ordered set where primKey = &#63;.
431            *
432            * @param primKey the prim key
433            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
434            * @return the last matching resource, or <code>null</code> if a matching resource could not be found
435            * @throws SystemException if a system exception occurred
436            */
437            public static com.liferay.portal.model.Resource fetchByPrimKey_Last(
438                    java.lang.String primKey,
439                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
440                    throws com.liferay.portal.kernel.exception.SystemException {
441                    return getPersistence().fetchByPrimKey_Last(primKey, orderByComparator);
442            }
443    
444            /**
445            * Returns the resources before and after the current resource in the ordered set where primKey = &#63;.
446            *
447            * @param resourceId the primary key of the current resource
448            * @param primKey the prim key
449            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
450            * @return the previous, current, and next resource
451            * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found
452            * @throws SystemException if a system exception occurred
453            */
454            public static com.liferay.portal.model.Resource[] findByPrimKey_PrevAndNext(
455                    long resourceId, java.lang.String primKey,
456                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
457                    throws com.liferay.portal.NoSuchResourceException,
458                            com.liferay.portal.kernel.exception.SystemException {
459                    return getPersistence()
460                                       .findByPrimKey_PrevAndNext(resourceId, primKey,
461                            orderByComparator);
462            }
463    
464            /**
465            * Returns the resource where codeId = &#63; and primKey = &#63; or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found.
466            *
467            * @param codeId the code ID
468            * @param primKey the prim key
469            * @return the matching resource
470            * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
471            * @throws SystemException if a system exception occurred
472            */
473            public static com.liferay.portal.model.Resource findByC_P(long codeId,
474                    java.lang.String primKey)
475                    throws com.liferay.portal.NoSuchResourceException,
476                            com.liferay.portal.kernel.exception.SystemException {
477                    return getPersistence().findByC_P(codeId, primKey);
478            }
479    
480            /**
481            * Returns the resource where codeId = &#63; and primKey = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
482            *
483            * @param codeId the code ID
484            * @param primKey the prim key
485            * @return the matching resource, or <code>null</code> if a matching resource could not be found
486            * @throws SystemException if a system exception occurred
487            */
488            public static com.liferay.portal.model.Resource fetchByC_P(long codeId,
489                    java.lang.String primKey)
490                    throws com.liferay.portal.kernel.exception.SystemException {
491                    return getPersistence().fetchByC_P(codeId, primKey);
492            }
493    
494            /**
495            * Returns the resource where codeId = &#63; and primKey = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
496            *
497            * @param codeId the code ID
498            * @param primKey the prim key
499            * @param retrieveFromCache whether to use the finder cache
500            * @return the matching resource, or <code>null</code> if a matching resource could not be found
501            * @throws SystemException if a system exception occurred
502            */
503            public static com.liferay.portal.model.Resource fetchByC_P(long codeId,
504                    java.lang.String primKey, boolean retrieveFromCache)
505                    throws com.liferay.portal.kernel.exception.SystemException {
506                    return getPersistence().fetchByC_P(codeId, primKey, retrieveFromCache);
507            }
508    
509            /**
510            * Returns all the resources.
511            *
512            * @return the resources
513            * @throws SystemException if a system exception occurred
514            */
515            public static java.util.List<com.liferay.portal.model.Resource> findAll()
516                    throws com.liferay.portal.kernel.exception.SystemException {
517                    return getPersistence().findAll();
518            }
519    
520            /**
521            * Returns a range of all the resources.
522            *
523            * <p>
524            * 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.
525            * </p>
526            *
527            * @param start the lower bound of the range of resources
528            * @param end the upper bound of the range of resources (not inclusive)
529            * @return the range of resources
530            * @throws SystemException if a system exception occurred
531            */
532            public static java.util.List<com.liferay.portal.model.Resource> findAll(
533                    int start, int end)
534                    throws com.liferay.portal.kernel.exception.SystemException {
535                    return getPersistence().findAll(start, end);
536            }
537    
538            /**
539            * Returns an ordered range of all the resources.
540            *
541            * <p>
542            * 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.
543            * </p>
544            *
545            * @param start the lower bound of the range of resources
546            * @param end the upper bound of the range of resources (not inclusive)
547            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
548            * @return the ordered range of resources
549            * @throws SystemException if a system exception occurred
550            */
551            public static java.util.List<com.liferay.portal.model.Resource> findAll(
552                    int start, int end,
553                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
554                    throws com.liferay.portal.kernel.exception.SystemException {
555                    return getPersistence().findAll(start, end, orderByComparator);
556            }
557    
558            /**
559            * Removes all the resources where codeId = &#63; from the database.
560            *
561            * @param codeId the code ID
562            * @throws SystemException if a system exception occurred
563            */
564            public static void removeByCodeId(long codeId)
565                    throws com.liferay.portal.kernel.exception.SystemException {
566                    getPersistence().removeByCodeId(codeId);
567            }
568    
569            /**
570            * Removes all the resources where primKey = &#63; from the database.
571            *
572            * @param primKey the prim key
573            * @throws SystemException if a system exception occurred
574            */
575            public static void removeByPrimKey(java.lang.String primKey)
576                    throws com.liferay.portal.kernel.exception.SystemException {
577                    getPersistence().removeByPrimKey(primKey);
578            }
579    
580            /**
581            * Removes the resource where codeId = &#63; and primKey = &#63; from the database.
582            *
583            * @param codeId the code ID
584            * @param primKey the prim key
585            * @return the resource that was removed
586            * @throws SystemException if a system exception occurred
587            */
588            public static com.liferay.portal.model.Resource removeByC_P(long codeId,
589                    java.lang.String primKey)
590                    throws com.liferay.portal.NoSuchResourceException,
591                            com.liferay.portal.kernel.exception.SystemException {
592                    return getPersistence().removeByC_P(codeId, primKey);
593            }
594    
595            /**
596            * Removes all the resources from the database.
597            *
598            * @throws SystemException if a system exception occurred
599            */
600            public static void removeAll()
601                    throws com.liferay.portal.kernel.exception.SystemException {
602                    getPersistence().removeAll();
603            }
604    
605            /**
606            * Returns the number of resources where codeId = &#63;.
607            *
608            * @param codeId the code ID
609            * @return the number of matching resources
610            * @throws SystemException if a system exception occurred
611            */
612            public static int countByCodeId(long codeId)
613                    throws com.liferay.portal.kernel.exception.SystemException {
614                    return getPersistence().countByCodeId(codeId);
615            }
616    
617            /**
618            * Returns the number of resources where primKey = &#63;.
619            *
620            * @param primKey the prim key
621            * @return the number of matching resources
622            * @throws SystemException if a system exception occurred
623            */
624            public static int countByPrimKey(java.lang.String primKey)
625                    throws com.liferay.portal.kernel.exception.SystemException {
626                    return getPersistence().countByPrimKey(primKey);
627            }
628    
629            /**
630            * Returns the number of resources where codeId = &#63; and primKey = &#63;.
631            *
632            * @param codeId the code ID
633            * @param primKey the prim key
634            * @return the number of matching resources
635            * @throws SystemException if a system exception occurred
636            */
637            public static int countByC_P(long codeId, java.lang.String primKey)
638                    throws com.liferay.portal.kernel.exception.SystemException {
639                    return getPersistence().countByC_P(codeId, primKey);
640            }
641    
642            /**
643            * Returns the number of resources.
644            *
645            * @return the number of resources
646            * @throws SystemException if a system exception occurred
647            */
648            public static int countAll()
649                    throws com.liferay.portal.kernel.exception.SystemException {
650                    return getPersistence().countAll();
651            }
652    
653            public static ResourcePersistence getPersistence() {
654                    if (_persistence == null) {
655                            _persistence = (ResourcePersistence)PortalBeanLocatorUtil.locate(ResourcePersistence.class.getName());
656    
657                            ReferenceRegistry.registerReference(ResourceUtil.class,
658                                    "_persistence");
659                    }
660    
661                    return _persistence;
662            }
663    
664            /**
665             * @deprecated
666             */
667            public void setPersistence(ResourcePersistence persistence) {
668            }
669    
670            private static ResourcePersistence _persistence;
671    }