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="PermissionUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class PermissionUtil {
32      public static void cacheResult(
33          com.liferay.portal.model.Permission permission) {
34          getPersistence().cacheResult(permission);
35      }
36  
37      public static void cacheResult(
38          java.util.List<com.liferay.portal.model.Permission> permissions) {
39          getPersistence().cacheResult(permissions);
40      }
41  
42      public static void clearCache() {
43          getPersistence().clearCache();
44      }
45  
46      public static com.liferay.portal.model.Permission create(long permissionId) {
47          return getPersistence().create(permissionId);
48      }
49  
50      public static com.liferay.portal.model.Permission remove(long permissionId)
51          throws com.liferay.portal.NoSuchPermissionException,
52              com.liferay.portal.SystemException {
53          return getPersistence().remove(permissionId);
54      }
55  
56      public static com.liferay.portal.model.Permission remove(
57          com.liferay.portal.model.Permission permission)
58          throws com.liferay.portal.SystemException {
59          return getPersistence().remove(permission);
60      }
61  
62      /**
63       * @deprecated Use <code>update(Permission permission, boolean merge)</code>.
64       */
65      public static com.liferay.portal.model.Permission update(
66          com.liferay.portal.model.Permission permission)
67          throws com.liferay.portal.SystemException {
68          return getPersistence().update(permission);
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        permission 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 permission 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.Permission update(
85          com.liferay.portal.model.Permission permission, boolean merge)
86          throws com.liferay.portal.SystemException {
87          return getPersistence().update(permission, merge);
88      }
89  
90      public static com.liferay.portal.model.Permission updateImpl(
91          com.liferay.portal.model.Permission permission, boolean merge)
92          throws com.liferay.portal.SystemException {
93          return getPersistence().updateImpl(permission, merge);
94      }
95  
96      public static com.liferay.portal.model.Permission findByPrimaryKey(
97          long permissionId)
98          throws com.liferay.portal.NoSuchPermissionException,
99              com.liferay.portal.SystemException {
100         return getPersistence().findByPrimaryKey(permissionId);
101     }
102 
103     public static com.liferay.portal.model.Permission fetchByPrimaryKey(
104         long permissionId) throws com.liferay.portal.SystemException {
105         return getPersistence().fetchByPrimaryKey(permissionId);
106     }
107 
108     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
109         long resourceId) throws com.liferay.portal.SystemException {
110         return getPersistence().findByResourceId(resourceId);
111     }
112 
113     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
114         long resourceId, int start, int end)
115         throws com.liferay.portal.SystemException {
116         return getPersistence().findByResourceId(resourceId, start, end);
117     }
118 
119     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
120         long resourceId, int start, int end,
121         com.liferay.portal.kernel.util.OrderByComparator obc)
122         throws com.liferay.portal.SystemException {
123         return getPersistence().findByResourceId(resourceId, start, end, obc);
124     }
125 
126     public static com.liferay.portal.model.Permission findByResourceId_First(
127         long resourceId, com.liferay.portal.kernel.util.OrderByComparator obc)
128         throws com.liferay.portal.NoSuchPermissionException,
129             com.liferay.portal.SystemException {
130         return getPersistence().findByResourceId_First(resourceId, obc);
131     }
132 
133     public static com.liferay.portal.model.Permission findByResourceId_Last(
134         long resourceId, com.liferay.portal.kernel.util.OrderByComparator obc)
135         throws com.liferay.portal.NoSuchPermissionException,
136             com.liferay.portal.SystemException {
137         return getPersistence().findByResourceId_Last(resourceId, obc);
138     }
139 
140     public static com.liferay.portal.model.Permission[] findByResourceId_PrevAndNext(
141         long permissionId, long resourceId,
142         com.liferay.portal.kernel.util.OrderByComparator obc)
143         throws com.liferay.portal.NoSuchPermissionException,
144             com.liferay.portal.SystemException {
145         return getPersistence()
146                    .findByResourceId_PrevAndNext(permissionId, resourceId, obc);
147     }
148 
149     public static com.liferay.portal.model.Permission findByA_R(
150         java.lang.String actionId, long resourceId)
151         throws com.liferay.portal.NoSuchPermissionException,
152             com.liferay.portal.SystemException {
153         return getPersistence().findByA_R(actionId, resourceId);
154     }
155 
156     public static com.liferay.portal.model.Permission fetchByA_R(
157         java.lang.String actionId, long resourceId)
158         throws com.liferay.portal.SystemException {
159         return getPersistence().fetchByA_R(actionId, resourceId);
160     }
161 
162     public static com.liferay.portal.model.Permission fetchByA_R(
163         java.lang.String actionId, long resourceId, boolean retrieveFromCache)
164         throws com.liferay.portal.SystemException {
165         return getPersistence()
166                    .fetchByA_R(actionId, resourceId, retrieveFromCache);
167     }
168 
169     public static java.util.List<Object> findWithDynamicQuery(
170         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
171         throws com.liferay.portal.SystemException {
172         return getPersistence().findWithDynamicQuery(dynamicQuery);
173     }
174 
175     public static java.util.List<Object> findWithDynamicQuery(
176         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
177         int end) throws com.liferay.portal.SystemException {
178         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
179     }
180 
181     public static java.util.List<com.liferay.portal.model.Permission> findAll()
182         throws com.liferay.portal.SystemException {
183         return getPersistence().findAll();
184     }
185 
186     public static java.util.List<com.liferay.portal.model.Permission> findAll(
187         int start, int end) throws com.liferay.portal.SystemException {
188         return getPersistence().findAll(start, end);
189     }
190 
191     public static java.util.List<com.liferay.portal.model.Permission> findAll(
192         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
193         throws com.liferay.portal.SystemException {
194         return getPersistence().findAll(start, end, obc);
195     }
196 
197     public static void removeByResourceId(long resourceId)
198         throws com.liferay.portal.SystemException {
199         getPersistence().removeByResourceId(resourceId);
200     }
201 
202     public static void removeByA_R(java.lang.String actionId, long resourceId)
203         throws com.liferay.portal.NoSuchPermissionException,
204             com.liferay.portal.SystemException {
205         getPersistence().removeByA_R(actionId, resourceId);
206     }
207 
208     public static void removeAll() throws com.liferay.portal.SystemException {
209         getPersistence().removeAll();
210     }
211 
212     public static int countByResourceId(long resourceId)
213         throws com.liferay.portal.SystemException {
214         return getPersistence().countByResourceId(resourceId);
215     }
216 
217     public static int countByA_R(java.lang.String actionId, long resourceId)
218         throws com.liferay.portal.SystemException {
219         return getPersistence().countByA_R(actionId, resourceId);
220     }
221 
222     public static int countAll() throws com.liferay.portal.SystemException {
223         return getPersistence().countAll();
224     }
225 
226     public static java.util.List<com.liferay.portal.model.Group> getGroups(
227         long pk) throws com.liferay.portal.SystemException {
228         return getPersistence().getGroups(pk);
229     }
230 
231     public static java.util.List<com.liferay.portal.model.Group> getGroups(
232         long pk, int start, int end) throws com.liferay.portal.SystemException {
233         return getPersistence().getGroups(pk, start, end);
234     }
235 
236     public static java.util.List<com.liferay.portal.model.Group> getGroups(
237         long pk, int start, int end,
238         com.liferay.portal.kernel.util.OrderByComparator obc)
239         throws com.liferay.portal.SystemException {
240         return getPersistence().getGroups(pk, start, end, obc);
241     }
242 
243     public static int getGroupsSize(long pk)
244         throws com.liferay.portal.SystemException {
245         return getPersistence().getGroupsSize(pk);
246     }
247 
248     public static boolean containsGroup(long pk, long groupPK)
249         throws com.liferay.portal.SystemException {
250         return getPersistence().containsGroup(pk, groupPK);
251     }
252 
253     public static boolean containsGroups(long pk)
254         throws com.liferay.portal.SystemException {
255         return getPersistence().containsGroups(pk);
256     }
257 
258     public static void addGroup(long pk, long groupPK)
259         throws com.liferay.portal.SystemException {
260         getPersistence().addGroup(pk, groupPK);
261     }
262 
263     public static void addGroup(long pk, com.liferay.portal.model.Group group)
264         throws com.liferay.portal.SystemException {
265         getPersistence().addGroup(pk, group);
266     }
267 
268     public static void addGroups(long pk, long[] groupPKs)
269         throws com.liferay.portal.SystemException {
270         getPersistence().addGroups(pk, groupPKs);
271     }
272 
273     public static void addGroups(long pk,
274         java.util.List<com.liferay.portal.model.Group> groups)
275         throws com.liferay.portal.SystemException {
276         getPersistence().addGroups(pk, groups);
277     }
278 
279     public static void clearGroups(long pk)
280         throws com.liferay.portal.SystemException {
281         getPersistence().clearGroups(pk);
282     }
283 
284     public static void removeGroup(long pk, long groupPK)
285         throws com.liferay.portal.SystemException {
286         getPersistence().removeGroup(pk, groupPK);
287     }
288 
289     public static void removeGroup(long pk, com.liferay.portal.model.Group group)
290         throws com.liferay.portal.SystemException {
291         getPersistence().removeGroup(pk, group);
292     }
293 
294     public static void removeGroups(long pk, long[] groupPKs)
295         throws com.liferay.portal.SystemException {
296         getPersistence().removeGroups(pk, groupPKs);
297     }
298 
299     public static void removeGroups(long pk,
300         java.util.List<com.liferay.portal.model.Group> groups)
301         throws com.liferay.portal.SystemException {
302         getPersistence().removeGroups(pk, groups);
303     }
304 
305     public static void setGroups(long pk, long[] groupPKs)
306         throws com.liferay.portal.SystemException {
307         getPersistence().setGroups(pk, groupPKs);
308     }
309 
310     public static void setGroups(long pk,
311         java.util.List<com.liferay.portal.model.Group> groups)
312         throws com.liferay.portal.SystemException {
313         getPersistence().setGroups(pk, groups);
314     }
315 
316     public static java.util.List<com.liferay.portal.model.Role> getRoles(
317         long pk) throws com.liferay.portal.SystemException {
318         return getPersistence().getRoles(pk);
319     }
320 
321     public static java.util.List<com.liferay.portal.model.Role> getRoles(
322         long pk, int start, int end) throws com.liferay.portal.SystemException {
323         return getPersistence().getRoles(pk, start, end);
324     }
325 
326     public static java.util.List<com.liferay.portal.model.Role> getRoles(
327         long pk, int start, int end,
328         com.liferay.portal.kernel.util.OrderByComparator obc)
329         throws com.liferay.portal.SystemException {
330         return getPersistence().getRoles(pk, start, end, obc);
331     }
332 
333     public static int getRolesSize(long pk)
334         throws com.liferay.portal.SystemException {
335         return getPersistence().getRolesSize(pk);
336     }
337 
338     public static boolean containsRole(long pk, long rolePK)
339         throws com.liferay.portal.SystemException {
340         return getPersistence().containsRole(pk, rolePK);
341     }
342 
343     public static boolean containsRoles(long pk)
344         throws com.liferay.portal.SystemException {
345         return getPersistence().containsRoles(pk);
346     }
347 
348     public static void addRole(long pk, long rolePK)
349         throws com.liferay.portal.SystemException {
350         getPersistence().addRole(pk, rolePK);
351     }
352 
353     public static void addRole(long pk, com.liferay.portal.model.Role role)
354         throws com.liferay.portal.SystemException {
355         getPersistence().addRole(pk, role);
356     }
357 
358     public static void addRoles(long pk, long[] rolePKs)
359         throws com.liferay.portal.SystemException {
360         getPersistence().addRoles(pk, rolePKs);
361     }
362 
363     public static void addRoles(long pk,
364         java.util.List<com.liferay.portal.model.Role> roles)
365         throws com.liferay.portal.SystemException {
366         getPersistence().addRoles(pk, roles);
367     }
368 
369     public static void clearRoles(long pk)
370         throws com.liferay.portal.SystemException {
371         getPersistence().clearRoles(pk);
372     }
373 
374     public static void removeRole(long pk, long rolePK)
375         throws com.liferay.portal.SystemException {
376         getPersistence().removeRole(pk, rolePK);
377     }
378 
379     public static void removeRole(long pk, com.liferay.portal.model.Role role)
380         throws com.liferay.portal.SystemException {
381         getPersistence().removeRole(pk, role);
382     }
383 
384     public static void removeRoles(long pk, long[] rolePKs)
385         throws com.liferay.portal.SystemException {
386         getPersistence().removeRoles(pk, rolePKs);
387     }
388 
389     public static void removeRoles(long pk,
390         java.util.List<com.liferay.portal.model.Role> roles)
391         throws com.liferay.portal.SystemException {
392         getPersistence().removeRoles(pk, roles);
393     }
394 
395     public static void setRoles(long pk, long[] rolePKs)
396         throws com.liferay.portal.SystemException {
397         getPersistence().setRoles(pk, rolePKs);
398     }
399 
400     public static void setRoles(long pk,
401         java.util.List<com.liferay.portal.model.Role> roles)
402         throws com.liferay.portal.SystemException {
403         getPersistence().setRoles(pk, roles);
404     }
405 
406     public static java.util.List<com.liferay.portal.model.User> getUsers(
407         long pk) throws com.liferay.portal.SystemException {
408         return getPersistence().getUsers(pk);
409     }
410 
411     public static java.util.List<com.liferay.portal.model.User> getUsers(
412         long pk, int start, int end) throws com.liferay.portal.SystemException {
413         return getPersistence().getUsers(pk, start, end);
414     }
415 
416     public static java.util.List<com.liferay.portal.model.User> getUsers(
417         long pk, int start, int end,
418         com.liferay.portal.kernel.util.OrderByComparator obc)
419         throws com.liferay.portal.SystemException {
420         return getPersistence().getUsers(pk, start, end, obc);
421     }
422 
423     public static int getUsersSize(long pk)
424         throws com.liferay.portal.SystemException {
425         return getPersistence().getUsersSize(pk);
426     }
427 
428     public static boolean containsUser(long pk, long userPK)
429         throws com.liferay.portal.SystemException {
430         return getPersistence().containsUser(pk, userPK);
431     }
432 
433     public static boolean containsUsers(long pk)
434         throws com.liferay.portal.SystemException {
435         return getPersistence().containsUsers(pk);
436     }
437 
438     public static void addUser(long pk, long userPK)
439         throws com.liferay.portal.SystemException {
440         getPersistence().addUser(pk, userPK);
441     }
442 
443     public static void addUser(long pk, com.liferay.portal.model.User user)
444         throws com.liferay.portal.SystemException {
445         getPersistence().addUser(pk, user);
446     }
447 
448     public static void addUsers(long pk, long[] userPKs)
449         throws com.liferay.portal.SystemException {
450         getPersistence().addUsers(pk, userPKs);
451     }
452 
453     public static void addUsers(long pk,
454         java.util.List<com.liferay.portal.model.User> users)
455         throws com.liferay.portal.SystemException {
456         getPersistence().addUsers(pk, users);
457     }
458 
459     public static void clearUsers(long pk)
460         throws com.liferay.portal.SystemException {
461         getPersistence().clearUsers(pk);
462     }
463 
464     public static void removeUser(long pk, long userPK)
465         throws com.liferay.portal.SystemException {
466         getPersistence().removeUser(pk, userPK);
467     }
468 
469     public static void removeUser(long pk, com.liferay.portal.model.User user)
470         throws com.liferay.portal.SystemException {
471         getPersistence().removeUser(pk, user);
472     }
473 
474     public static void removeUsers(long pk, long[] userPKs)
475         throws com.liferay.portal.SystemException {
476         getPersistence().removeUsers(pk, userPKs);
477     }
478 
479     public static void removeUsers(long pk,
480         java.util.List<com.liferay.portal.model.User> users)
481         throws com.liferay.portal.SystemException {
482         getPersistence().removeUsers(pk, users);
483     }
484 
485     public static void setUsers(long pk, long[] userPKs)
486         throws com.liferay.portal.SystemException {
487         getPersistence().setUsers(pk, userPKs);
488     }
489 
490     public static void setUsers(long pk,
491         java.util.List<com.liferay.portal.model.User> users)
492         throws com.liferay.portal.SystemException {
493         getPersistence().setUsers(pk, users);
494     }
495 
496     public static PermissionPersistence getPersistence() {
497         return _persistence;
498     }
499 
500     public void setPersistence(PermissionPersistence persistence) {
501         _persistence = persistence;
502     }
503 
504     private static PermissionPersistence _persistence;
505 }