1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  /**
26   * <a href="ResourceCodeUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ResourceCodeUtil {
32      public static void cacheResult(
33          com.liferay.portal.model.ResourceCode resourceCode) {
34          getPersistence().cacheResult(resourceCode);
35      }
36  
37      public static void cacheResult(
38          java.util.List<com.liferay.portal.model.ResourceCode> resourceCodes) {
39          getPersistence().cacheResult(resourceCodes);
40      }
41  
42      public static void clearCache() {
43          getPersistence().clearCache();
44      }
45  
46      public static com.liferay.portal.model.ResourceCode create(long codeId) {
47          return getPersistence().create(codeId);
48      }
49  
50      public static com.liferay.portal.model.ResourceCode remove(long codeId)
51          throws com.liferay.portal.NoSuchResourceCodeException,
52              com.liferay.portal.SystemException {
53          return getPersistence().remove(codeId);
54      }
55  
56      public static com.liferay.portal.model.ResourceCode remove(
57          com.liferay.portal.model.ResourceCode resourceCode)
58          throws com.liferay.portal.SystemException {
59          return getPersistence().remove(resourceCode);
60      }
61  
62      /**
63       * @deprecated Use <code>update(ResourceCode resourceCode, boolean merge)</code>.
64       */
65      public static com.liferay.portal.model.ResourceCode update(
66          com.liferay.portal.model.ResourceCode resourceCode)
67          throws com.liferay.portal.SystemException {
68          return getPersistence().update(resourceCode);
69      }
70  
71      /**
72       * Add, update, or merge, the entity. This method also calls the model
73       * listeners to trigger the proper events associated with adding, deleting,
74       * or updating an entity.
75       *
76       * @param        resourceCode the entity to add, update, or merge
77       * @param        merge boolean value for whether to merge the entity. The
78       *                default value is false. Setting merge to true is more
79       *                expensive and should only be true when resourceCode is
80       *                transient. See LEP-5473 for a detailed discussion of this
81       *                method.
82       * @return        true if the portlet can be displayed via Ajax
83       */
84      public static com.liferay.portal.model.ResourceCode update(
85          com.liferay.portal.model.ResourceCode resourceCode, boolean merge)
86          throws com.liferay.portal.SystemException {
87          return getPersistence().update(resourceCode, merge);
88      }
89  
90      public static com.liferay.portal.model.ResourceCode updateImpl(
91          com.liferay.portal.model.ResourceCode resourceCode, boolean merge)
92          throws com.liferay.portal.SystemException {
93          return getPersistence().updateImpl(resourceCode, merge);
94      }
95  
96      public static com.liferay.portal.model.ResourceCode findByPrimaryKey(
97          long codeId)
98          throws com.liferay.portal.NoSuchResourceCodeException,
99              com.liferay.portal.SystemException {
100         return getPersistence().findByPrimaryKey(codeId);
101     }
102 
103     public static com.liferay.portal.model.ResourceCode fetchByPrimaryKey(
104         long codeId) throws com.liferay.portal.SystemException {
105         return getPersistence().fetchByPrimaryKey(codeId);
106     }
107 
108     public static java.util.List<com.liferay.portal.model.ResourceCode> findByCompanyId(
109         long companyId) throws com.liferay.portal.SystemException {
110         return getPersistence().findByCompanyId(companyId);
111     }
112 
113     public static java.util.List<com.liferay.portal.model.ResourceCode> findByCompanyId(
114         long companyId, int start, int end)
115         throws com.liferay.portal.SystemException {
116         return getPersistence().findByCompanyId(companyId, start, end);
117     }
118 
119     public static java.util.List<com.liferay.portal.model.ResourceCode> findByCompanyId(
120         long companyId, int start, int end,
121         com.liferay.portal.kernel.util.OrderByComparator obc)
122         throws com.liferay.portal.SystemException {
123         return getPersistence().findByCompanyId(companyId, start, end, obc);
124     }
125 
126     public static com.liferay.portal.model.ResourceCode findByCompanyId_First(
127         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
128         throws com.liferay.portal.NoSuchResourceCodeException,
129             com.liferay.portal.SystemException {
130         return getPersistence().findByCompanyId_First(companyId, obc);
131     }
132 
133     public static com.liferay.portal.model.ResourceCode findByCompanyId_Last(
134         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
135         throws com.liferay.portal.NoSuchResourceCodeException,
136             com.liferay.portal.SystemException {
137         return getPersistence().findByCompanyId_Last(companyId, obc);
138     }
139 
140     public static com.liferay.portal.model.ResourceCode[] findByCompanyId_PrevAndNext(
141         long codeId, long companyId,
142         com.liferay.portal.kernel.util.OrderByComparator obc)
143         throws com.liferay.portal.NoSuchResourceCodeException,
144             com.liferay.portal.SystemException {
145         return getPersistence()
146                    .findByCompanyId_PrevAndNext(codeId, companyId, obc);
147     }
148 
149     public static java.util.List<com.liferay.portal.model.ResourceCode> findByName(
150         java.lang.String name) throws com.liferay.portal.SystemException {
151         return getPersistence().findByName(name);
152     }
153 
154     public static java.util.List<com.liferay.portal.model.ResourceCode> findByName(
155         java.lang.String name, int start, int end)
156         throws com.liferay.portal.SystemException {
157         return getPersistence().findByName(name, start, end);
158     }
159 
160     public static java.util.List<com.liferay.portal.model.ResourceCode> findByName(
161         java.lang.String name, int start, int end,
162         com.liferay.portal.kernel.util.OrderByComparator obc)
163         throws com.liferay.portal.SystemException {
164         return getPersistence().findByName(name, start, end, obc);
165     }
166 
167     public static com.liferay.portal.model.ResourceCode findByName_First(
168         java.lang.String name,
169         com.liferay.portal.kernel.util.OrderByComparator obc)
170         throws com.liferay.portal.NoSuchResourceCodeException,
171             com.liferay.portal.SystemException {
172         return getPersistence().findByName_First(name, obc);
173     }
174 
175     public static com.liferay.portal.model.ResourceCode findByName_Last(
176         java.lang.String name,
177         com.liferay.portal.kernel.util.OrderByComparator obc)
178         throws com.liferay.portal.NoSuchResourceCodeException,
179             com.liferay.portal.SystemException {
180         return getPersistence().findByName_Last(name, obc);
181     }
182 
183     public static com.liferay.portal.model.ResourceCode[] findByName_PrevAndNext(
184         long codeId, java.lang.String name,
185         com.liferay.portal.kernel.util.OrderByComparator obc)
186         throws com.liferay.portal.NoSuchResourceCodeException,
187             com.liferay.portal.SystemException {
188         return getPersistence().findByName_PrevAndNext(codeId, name, obc);
189     }
190 
191     public static com.liferay.portal.model.ResourceCode findByC_N_S(
192         long companyId, java.lang.String name, int scope)
193         throws com.liferay.portal.NoSuchResourceCodeException,
194             com.liferay.portal.SystemException {
195         return getPersistence().findByC_N_S(companyId, name, scope);
196     }
197 
198     public static com.liferay.portal.model.ResourceCode fetchByC_N_S(
199         long companyId, java.lang.String name, int scope)
200         throws com.liferay.portal.SystemException {
201         return getPersistence().fetchByC_N_S(companyId, name, scope);
202     }
203 
204     public static com.liferay.portal.model.ResourceCode fetchByC_N_S(
205         long companyId, java.lang.String name, int scope,
206         boolean retrieveFromCache) throws com.liferay.portal.SystemException {
207         return getPersistence()
208                    .fetchByC_N_S(companyId, name, scope, retrieveFromCache);
209     }
210 
211     public static java.util.List<Object> findWithDynamicQuery(
212         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
213         throws com.liferay.portal.SystemException {
214         return getPersistence().findWithDynamicQuery(dynamicQuery);
215     }
216 
217     public static java.util.List<Object> findWithDynamicQuery(
218         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
219         int end) throws com.liferay.portal.SystemException {
220         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
221     }
222 
223     public static java.util.List<com.liferay.portal.model.ResourceCode> findAll()
224         throws com.liferay.portal.SystemException {
225         return getPersistence().findAll();
226     }
227 
228     public static java.util.List<com.liferay.portal.model.ResourceCode> findAll(
229         int start, int end) throws com.liferay.portal.SystemException {
230         return getPersistence().findAll(start, end);
231     }
232 
233     public static java.util.List<com.liferay.portal.model.ResourceCode> findAll(
234         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
235         throws com.liferay.portal.SystemException {
236         return getPersistence().findAll(start, end, obc);
237     }
238 
239     public static void removeByCompanyId(long companyId)
240         throws com.liferay.portal.SystemException {
241         getPersistence().removeByCompanyId(companyId);
242     }
243 
244     public static void removeByName(java.lang.String name)
245         throws com.liferay.portal.SystemException {
246         getPersistence().removeByName(name);
247     }
248 
249     public static void removeByC_N_S(long companyId, java.lang.String name,
250         int scope)
251         throws com.liferay.portal.NoSuchResourceCodeException,
252             com.liferay.portal.SystemException {
253         getPersistence().removeByC_N_S(companyId, name, scope);
254     }
255 
256     public static void removeAll() throws com.liferay.portal.SystemException {
257         getPersistence().removeAll();
258     }
259 
260     public static int countByCompanyId(long companyId)
261         throws com.liferay.portal.SystemException {
262         return getPersistence().countByCompanyId(companyId);
263     }
264 
265     public static int countByName(java.lang.String name)
266         throws com.liferay.portal.SystemException {
267         return getPersistence().countByName(name);
268     }
269 
270     public static int countByC_N_S(long companyId, java.lang.String name,
271         int scope) throws com.liferay.portal.SystemException {
272         return getPersistence().countByC_N_S(companyId, name, scope);
273     }
274 
275     public static int countAll() throws com.liferay.portal.SystemException {
276         return getPersistence().countAll();
277     }
278 
279     public static ResourceCodePersistence getPersistence() {
280         return _persistence;
281     }
282 
283     public void setPersistence(ResourceCodePersistence persistence) {
284         _persistence = persistence;
285     }
286 
287     private static ResourceCodePersistence _persistence;
288 }