1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.SystemException;
18  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
19  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
20  import com.liferay.portal.kernel.util.ReferenceRegistry;
21  import com.liferay.portal.model.Resource;
22  
23  import java.util.List;
24  
25  /**
26   * <a href="ResourceUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * <p>
29   * ServiceBuilder generated this class. Modifications in this class will be
30   * overwritten the next time is generated.
31   * </p>
32   *
33   * @author    Brian Wing Shun Chan
34   * @see       ResourcePersistence
35   * @see       ResourcePersistenceImpl
36   * @generated
37   */
38  public class ResourceUtil {
39      /**
40       * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
41       */
42      public static void clearCache() {
43          getPersistence().clearCache();
44      }
45  
46      /**
47       * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(Resource)
48       */
49      public static void clearCache(Resource resource) {
50          getPersistence().clearCache(resource);
51      }
52  
53      /**
54       * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
55       */
56      public int countWithDynamicQuery(DynamicQuery dynamicQuery)
57          throws SystemException {
58          return getPersistence().countWithDynamicQuery(dynamicQuery);
59      }
60  
61      /**
62       * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
63       */
64      public static List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
65          throws SystemException {
66          return getPersistence().findWithDynamicQuery(dynamicQuery);
67      }
68  
69      /**
70       * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
71       */
72      public static List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
73          int start, int end) throws SystemException {
74          return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
75      }
76  
77      /**
78       * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
79       */
80      public static Resource remove(Resource resource) throws SystemException {
81          return getPersistence().remove(resource);
82      }
83  
84      /**
85       * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
86       */
87      public static Resource update(Resource resource, boolean merge)
88          throws SystemException {
89          return getPersistence().update(resource, merge);
90      }
91  
92      public static void cacheResult(com.liferay.portal.model.Resource resource) {
93          getPersistence().cacheResult(resource);
94      }
95  
96      public static void cacheResult(
97          java.util.List<com.liferay.portal.model.Resource> resources) {
98          getPersistence().cacheResult(resources);
99      }
100 
101     public static com.liferay.portal.model.Resource create(long resourceId) {
102         return getPersistence().create(resourceId);
103     }
104 
105     public static com.liferay.portal.model.Resource remove(long resourceId)
106         throws com.liferay.portal.NoSuchResourceException,
107             com.liferay.portal.SystemException {
108         return getPersistence().remove(resourceId);
109     }
110 
111     /**
112      * @deprecated Use {@link com.liferay.portal.service.persistence.BasePersistence.#update(com.liferay.portal.model.BaseModel, boolean)}.
113      */
114     public static com.liferay.portal.model.Resource update(
115         com.liferay.portal.model.Resource resource)
116         throws com.liferay.portal.SystemException {
117         return getPersistence().update(resource);
118     }
119 
120     public static com.liferay.portal.model.Resource updateImpl(
121         com.liferay.portal.model.Resource resource, boolean merge)
122         throws com.liferay.portal.SystemException {
123         return getPersistence().updateImpl(resource, merge);
124     }
125 
126     public static com.liferay.portal.model.Resource findByPrimaryKey(
127         long resourceId)
128         throws com.liferay.portal.NoSuchResourceException,
129             com.liferay.portal.SystemException {
130         return getPersistence().findByPrimaryKey(resourceId);
131     }
132 
133     public static com.liferay.portal.model.Resource fetchByPrimaryKey(
134         long resourceId) throws com.liferay.portal.SystemException {
135         return getPersistence().fetchByPrimaryKey(resourceId);
136     }
137 
138     public static java.util.List<com.liferay.portal.model.Resource> findByCodeId(
139         long codeId) throws com.liferay.portal.SystemException {
140         return getPersistence().findByCodeId(codeId);
141     }
142 
143     public static java.util.List<com.liferay.portal.model.Resource> findByCodeId(
144         long codeId, int start, int end)
145         throws com.liferay.portal.SystemException {
146         return getPersistence().findByCodeId(codeId, start, end);
147     }
148 
149     public static java.util.List<com.liferay.portal.model.Resource> findByCodeId(
150         long codeId, int start, int end,
151         com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
152         throws com.liferay.portal.SystemException {
153         return getPersistence()
154                    .findByCodeId(codeId, start, end, orderByComparator);
155     }
156 
157     public static com.liferay.portal.model.Resource findByCodeId_First(
158         long codeId,
159         com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
160         throws com.liferay.portal.NoSuchResourceException,
161             com.liferay.portal.SystemException {
162         return getPersistence().findByCodeId_First(codeId, orderByComparator);
163     }
164 
165     public static com.liferay.portal.model.Resource findByCodeId_Last(
166         long codeId,
167         com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
168         throws com.liferay.portal.NoSuchResourceException,
169             com.liferay.portal.SystemException {
170         return getPersistence().findByCodeId_Last(codeId, orderByComparator);
171     }
172 
173     public static com.liferay.portal.model.Resource[] findByCodeId_PrevAndNext(
174         long resourceId, long codeId,
175         com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
176         throws com.liferay.portal.NoSuchResourceException,
177             com.liferay.portal.SystemException {
178         return getPersistence()
179                    .findByCodeId_PrevAndNext(resourceId, codeId,
180             orderByComparator);
181     }
182 
183     public static com.liferay.portal.model.Resource findByC_P(long codeId,
184         java.lang.String primKey)
185         throws com.liferay.portal.NoSuchResourceException,
186             com.liferay.portal.SystemException {
187         return getPersistence().findByC_P(codeId, primKey);
188     }
189 
190     public static com.liferay.portal.model.Resource fetchByC_P(long codeId,
191         java.lang.String primKey) throws com.liferay.portal.SystemException {
192         return getPersistence().fetchByC_P(codeId, primKey);
193     }
194 
195     public static com.liferay.portal.model.Resource fetchByC_P(long codeId,
196         java.lang.String primKey, boolean retrieveFromCache)
197         throws com.liferay.portal.SystemException {
198         return getPersistence().fetchByC_P(codeId, primKey, retrieveFromCache);
199     }
200 
201     public static java.util.List<com.liferay.portal.model.Resource> findAll()
202         throws com.liferay.portal.SystemException {
203         return getPersistence().findAll();
204     }
205 
206     public static java.util.List<com.liferay.portal.model.Resource> findAll(
207         int start, int end) throws com.liferay.portal.SystemException {
208         return getPersistence().findAll(start, end);
209     }
210 
211     public static java.util.List<com.liferay.portal.model.Resource> findAll(
212         int start, int end,
213         com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
214         throws com.liferay.portal.SystemException {
215         return getPersistence().findAll(start, end, orderByComparator);
216     }
217 
218     public static void removeByCodeId(long codeId)
219         throws com.liferay.portal.SystemException {
220         getPersistence().removeByCodeId(codeId);
221     }
222 
223     public static void removeByC_P(long codeId, java.lang.String primKey)
224         throws com.liferay.portal.NoSuchResourceException,
225             com.liferay.portal.SystemException {
226         getPersistence().removeByC_P(codeId, primKey);
227     }
228 
229     public static void removeAll() throws com.liferay.portal.SystemException {
230         getPersistence().removeAll();
231     }
232 
233     public static int countByCodeId(long codeId)
234         throws com.liferay.portal.SystemException {
235         return getPersistence().countByCodeId(codeId);
236     }
237 
238     public static int countByC_P(long codeId, java.lang.String primKey)
239         throws com.liferay.portal.SystemException {
240         return getPersistence().countByC_P(codeId, primKey);
241     }
242 
243     public static int countAll() throws com.liferay.portal.SystemException {
244         return getPersistence().countAll();
245     }
246 
247     public static ResourcePersistence getPersistence() {
248         if (_persistence == null) {
249             _persistence = (ResourcePersistence)PortalBeanLocatorUtil.locate(ResourcePersistence.class.getName());
250 
251             ReferenceRegistry.registerReference(ResourceUtil.class,
252                 "_persistence");
253         }
254 
255         return _persistence;
256     }
257 
258     public void setPersistence(ResourcePersistence persistence) {
259         _persistence = persistence;
260 
261         ReferenceRegistry.registerReference(ResourceUtil.class, "_persistence");
262     }
263 
264     private static ResourcePersistence _persistence;
265 }