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="ResourcePermissionUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ResourcePermissionUtil {
32      public static void cacheResult(
33          com.liferay.portal.model.ResourcePermission resourcePermission) {
34          getPersistence().cacheResult(resourcePermission);
35      }
36  
37      public static void cacheResult(
38          java.util.List<com.liferay.portal.model.ResourcePermission> resourcePermissions) {
39          getPersistence().cacheResult(resourcePermissions);
40      }
41  
42      public static void clearCache() {
43          getPersistence().clearCache();
44      }
45  
46      public static com.liferay.portal.model.ResourcePermission create(
47          long resourcePermissionId) {
48          return getPersistence().create(resourcePermissionId);
49      }
50  
51      public static com.liferay.portal.model.ResourcePermission remove(
52          long resourcePermissionId)
53          throws com.liferay.portal.NoSuchResourcePermissionException,
54              com.liferay.portal.SystemException {
55          return getPersistence().remove(resourcePermissionId);
56      }
57  
58      public static com.liferay.portal.model.ResourcePermission remove(
59          com.liferay.portal.model.ResourcePermission resourcePermission)
60          throws com.liferay.portal.SystemException {
61          return getPersistence().remove(resourcePermission);
62      }
63  
64      /**
65       * @deprecated Use <code>update(ResourcePermission resourcePermission, boolean merge)</code>.
66       */
67      public static com.liferay.portal.model.ResourcePermission update(
68          com.liferay.portal.model.ResourcePermission resourcePermission)
69          throws com.liferay.portal.SystemException {
70          return getPersistence().update(resourcePermission);
71      }
72  
73      /**
74       * Add, update, or merge, the entity. This method also calls the model
75       * listeners to trigger the proper events associated with adding, deleting,
76       * or updating an entity.
77       *
78       * @param        resourcePermission the entity to add, update, or merge
79       * @param        merge boolean value for whether to merge the entity. The
80       *                default value is false. Setting merge to true is more
81       *                expensive and should only be true when resourcePermission is
82       *                transient. See LEP-5473 for a detailed discussion of this
83       *                method.
84       * @return        true if the portlet can be displayed via Ajax
85       */
86      public static com.liferay.portal.model.ResourcePermission update(
87          com.liferay.portal.model.ResourcePermission resourcePermission,
88          boolean merge) throws com.liferay.portal.SystemException {
89          return getPersistence().update(resourcePermission, merge);
90      }
91  
92      public static com.liferay.portal.model.ResourcePermission updateImpl(
93          com.liferay.portal.model.ResourcePermission resourcePermission,
94          boolean merge) throws com.liferay.portal.SystemException {
95          return getPersistence().updateImpl(resourcePermission, merge);
96      }
97  
98      public static com.liferay.portal.model.ResourcePermission findByPrimaryKey(
99          long resourcePermissionId)
100         throws com.liferay.portal.NoSuchResourcePermissionException,
101             com.liferay.portal.SystemException {
102         return getPersistence().findByPrimaryKey(resourcePermissionId);
103     }
104 
105     public static com.liferay.portal.model.ResourcePermission fetchByPrimaryKey(
106         long resourcePermissionId) throws com.liferay.portal.SystemException {
107         return getPersistence().fetchByPrimaryKey(resourcePermissionId);
108     }
109 
110     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByRoleId(
111         long roleId) throws com.liferay.portal.SystemException {
112         return getPersistence().findByRoleId(roleId);
113     }
114 
115     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByRoleId(
116         long roleId, int start, int end)
117         throws com.liferay.portal.SystemException {
118         return getPersistence().findByRoleId(roleId, start, end);
119     }
120 
121     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByRoleId(
122         long roleId, int start, int end,
123         com.liferay.portal.kernel.util.OrderByComparator obc)
124         throws com.liferay.portal.SystemException {
125         return getPersistence().findByRoleId(roleId, start, end, obc);
126     }
127 
128     public static com.liferay.portal.model.ResourcePermission findByRoleId_First(
129         long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
130         throws com.liferay.portal.NoSuchResourcePermissionException,
131             com.liferay.portal.SystemException {
132         return getPersistence().findByRoleId_First(roleId, obc);
133     }
134 
135     public static com.liferay.portal.model.ResourcePermission findByRoleId_Last(
136         long roleId, com.liferay.portal.kernel.util.OrderByComparator obc)
137         throws com.liferay.portal.NoSuchResourcePermissionException,
138             com.liferay.portal.SystemException {
139         return getPersistence().findByRoleId_Last(roleId, obc);
140     }
141 
142     public static com.liferay.portal.model.ResourcePermission[] findByRoleId_PrevAndNext(
143         long resourcePermissionId, long roleId,
144         com.liferay.portal.kernel.util.OrderByComparator obc)
145         throws com.liferay.portal.NoSuchResourcePermissionException,
146             com.liferay.portal.SystemException {
147         return getPersistence()
148                    .findByRoleId_PrevAndNext(resourcePermissionId, roleId, obc);
149     }
150 
151     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByC_N_S(
152         long companyId, java.lang.String name, int scope)
153         throws com.liferay.portal.SystemException {
154         return getPersistence().findByC_N_S(companyId, name, scope);
155     }
156 
157     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByC_N_S(
158         long companyId, java.lang.String name, int scope, int start, int end)
159         throws com.liferay.portal.SystemException {
160         return getPersistence().findByC_N_S(companyId, name, scope, start, end);
161     }
162 
163     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByC_N_S(
164         long companyId, java.lang.String name, int scope, int start, int end,
165         com.liferay.portal.kernel.util.OrderByComparator obc)
166         throws com.liferay.portal.SystemException {
167         return getPersistence()
168                    .findByC_N_S(companyId, name, scope, start, end, obc);
169     }
170 
171     public static com.liferay.portal.model.ResourcePermission findByC_N_S_First(
172         long companyId, java.lang.String name, int scope,
173         com.liferay.portal.kernel.util.OrderByComparator obc)
174         throws com.liferay.portal.NoSuchResourcePermissionException,
175             com.liferay.portal.SystemException {
176         return getPersistence().findByC_N_S_First(companyId, name, scope, obc);
177     }
178 
179     public static com.liferay.portal.model.ResourcePermission findByC_N_S_Last(
180         long companyId, java.lang.String name, int scope,
181         com.liferay.portal.kernel.util.OrderByComparator obc)
182         throws com.liferay.portal.NoSuchResourcePermissionException,
183             com.liferay.portal.SystemException {
184         return getPersistence().findByC_N_S_Last(companyId, name, scope, obc);
185     }
186 
187     public static com.liferay.portal.model.ResourcePermission[] findByC_N_S_PrevAndNext(
188         long resourcePermissionId, long companyId, java.lang.String name,
189         int scope, com.liferay.portal.kernel.util.OrderByComparator obc)
190         throws com.liferay.portal.NoSuchResourcePermissionException,
191             com.liferay.portal.SystemException {
192         return getPersistence()
193                    .findByC_N_S_PrevAndNext(resourcePermissionId, companyId,
194             name, scope, obc);
195     }
196 
197     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByC_N_S_P(
198         long companyId, java.lang.String name, int scope,
199         java.lang.String primKey) throws com.liferay.portal.SystemException {
200         return getPersistence().findByC_N_S_P(companyId, name, scope, primKey);
201     }
202 
203     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByC_N_S_P(
204         long companyId, java.lang.String name, int scope,
205         java.lang.String primKey, int start, int end)
206         throws com.liferay.portal.SystemException {
207         return getPersistence()
208                    .findByC_N_S_P(companyId, name, scope, primKey, start, end);
209     }
210 
211     public static java.util.List<com.liferay.portal.model.ResourcePermission> findByC_N_S_P(
212         long companyId, java.lang.String name, int scope,
213         java.lang.String primKey, int start, int end,
214         com.liferay.portal.kernel.util.OrderByComparator obc)
215         throws com.liferay.portal.SystemException {
216         return getPersistence()
217                    .findByC_N_S_P(companyId, name, scope, primKey, start, end,
218             obc);
219     }
220 
221     public static com.liferay.portal.model.ResourcePermission findByC_N_S_P_First(
222         long companyId, java.lang.String name, int scope,
223         java.lang.String primKey,
224         com.liferay.portal.kernel.util.OrderByComparator obc)
225         throws com.liferay.portal.NoSuchResourcePermissionException,
226             com.liferay.portal.SystemException {
227         return getPersistence()
228                    .findByC_N_S_P_First(companyId, name, scope, primKey, obc);
229     }
230 
231     public static com.liferay.portal.model.ResourcePermission findByC_N_S_P_Last(
232         long companyId, java.lang.String name, int scope,
233         java.lang.String primKey,
234         com.liferay.portal.kernel.util.OrderByComparator obc)
235         throws com.liferay.portal.NoSuchResourcePermissionException,
236             com.liferay.portal.SystemException {
237         return getPersistence()
238                    .findByC_N_S_P_Last(companyId, name, scope, primKey, obc);
239     }
240 
241     public static com.liferay.portal.model.ResourcePermission[] findByC_N_S_P_PrevAndNext(
242         long resourcePermissionId, long companyId, java.lang.String name,
243         int scope, java.lang.String primKey,
244         com.liferay.portal.kernel.util.OrderByComparator obc)
245         throws com.liferay.portal.NoSuchResourcePermissionException,
246             com.liferay.portal.SystemException {
247         return getPersistence()
248                    .findByC_N_S_P_PrevAndNext(resourcePermissionId, companyId,
249             name, scope, primKey, obc);
250     }
251 
252     public static com.liferay.portal.model.ResourcePermission findByC_N_S_P_R(
253         long companyId, java.lang.String name, int scope,
254         java.lang.String primKey, long roleId)
255         throws com.liferay.portal.NoSuchResourcePermissionException,
256             com.liferay.portal.SystemException {
257         return getPersistence()
258                    .findByC_N_S_P_R(companyId, name, scope, primKey, roleId);
259     }
260 
261     public static com.liferay.portal.model.ResourcePermission fetchByC_N_S_P_R(
262         long companyId, java.lang.String name, int scope,
263         java.lang.String primKey, long roleId)
264         throws com.liferay.portal.SystemException {
265         return getPersistence()
266                    .fetchByC_N_S_P_R(companyId, name, scope, primKey, roleId);
267     }
268 
269     public static com.liferay.portal.model.ResourcePermission fetchByC_N_S_P_R(
270         long companyId, java.lang.String name, int scope,
271         java.lang.String primKey, long roleId, boolean retrieveFromCache)
272         throws com.liferay.portal.SystemException {
273         return getPersistence()
274                    .fetchByC_N_S_P_R(companyId, name, scope, primKey, roleId,
275             retrieveFromCache);
276     }
277 
278     public static java.util.List<Object> findWithDynamicQuery(
279         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
280         throws com.liferay.portal.SystemException {
281         return getPersistence().findWithDynamicQuery(dynamicQuery);
282     }
283 
284     public static java.util.List<Object> findWithDynamicQuery(
285         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
286         int end) throws com.liferay.portal.SystemException {
287         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
288     }
289 
290     public static java.util.List<com.liferay.portal.model.ResourcePermission> findAll()
291         throws com.liferay.portal.SystemException {
292         return getPersistence().findAll();
293     }
294 
295     public static java.util.List<com.liferay.portal.model.ResourcePermission> findAll(
296         int start, int end) throws com.liferay.portal.SystemException {
297         return getPersistence().findAll(start, end);
298     }
299 
300     public static java.util.List<com.liferay.portal.model.ResourcePermission> findAll(
301         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
302         throws com.liferay.portal.SystemException {
303         return getPersistence().findAll(start, end, obc);
304     }
305 
306     public static void removeByRoleId(long roleId)
307         throws com.liferay.portal.SystemException {
308         getPersistence().removeByRoleId(roleId);
309     }
310 
311     public static void removeByC_N_S(long companyId, java.lang.String name,
312         int scope) throws com.liferay.portal.SystemException {
313         getPersistence().removeByC_N_S(companyId, name, scope);
314     }
315 
316     public static void removeByC_N_S_P(long companyId, java.lang.String name,
317         int scope, java.lang.String primKey)
318         throws com.liferay.portal.SystemException {
319         getPersistence().removeByC_N_S_P(companyId, name, scope, primKey);
320     }
321 
322     public static void removeByC_N_S_P_R(long companyId, java.lang.String name,
323         int scope, java.lang.String primKey, long roleId)
324         throws com.liferay.portal.NoSuchResourcePermissionException,
325             com.liferay.portal.SystemException {
326         getPersistence()
327             .removeByC_N_S_P_R(companyId, name, scope, primKey, roleId);
328     }
329 
330     public static void removeAll() throws com.liferay.portal.SystemException {
331         getPersistence().removeAll();
332     }
333 
334     public static int countByRoleId(long roleId)
335         throws com.liferay.portal.SystemException {
336         return getPersistence().countByRoleId(roleId);
337     }
338 
339     public static int countByC_N_S(long companyId, java.lang.String name,
340         int scope) throws com.liferay.portal.SystemException {
341         return getPersistence().countByC_N_S(companyId, name, scope);
342     }
343 
344     public static int countByC_N_S_P(long companyId, java.lang.String name,
345         int scope, java.lang.String primKey)
346         throws com.liferay.portal.SystemException {
347         return getPersistence().countByC_N_S_P(companyId, name, scope, primKey);
348     }
349 
350     public static int countByC_N_S_P_R(long companyId, java.lang.String name,
351         int scope, java.lang.String primKey, long roleId)
352         throws com.liferay.portal.SystemException {
353         return getPersistence()
354                    .countByC_N_S_P_R(companyId, name, scope, primKey, roleId);
355     }
356 
357     public static int countAll() throws com.liferay.portal.SystemException {
358         return getPersistence().countAll();
359     }
360 
361     public static ResourcePermissionPersistence getPersistence() {
362         return _persistence;
363     }
364 
365     public void setPersistence(ResourcePermissionPersistence persistence) {
366         _persistence = persistence;
367     }
368 
369     private static ResourcePermissionPersistence _persistence;
370 }