1   /**
2    * Copyright (c) 2000-2008 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 com.liferay.portal.model.Permission create(long permissionId) {
33          return getPersistence().create(permissionId);
34      }
35  
36      public static com.liferay.portal.model.Permission remove(long permissionId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchPermissionException {
39          return getPersistence().remove(permissionId);
40      }
41  
42      public static com.liferay.portal.model.Permission remove(
43          com.liferay.portal.model.Permission permission)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(permission);
46      }
47  
48      /**
49       * @deprecated Use <code>update(Permission permission, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.Permission update(
52          com.liferay.portal.model.Permission permission)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(permission);
55      }
56  
57      /**
58       * Add, update, or merge, the entity. This method also calls the model
59       * listeners to trigger the proper events associated with adding, deleting,
60       * or updating an entity.
61       *
62       * @param        permission the entity to add, update, or merge
63       * @param        merge boolean value for whether to merge the entity. The
64       *                default value is false. Setting merge to true is more
65       *                expensive and should only be true when permission is
66       *                transient. See LEP-5473 for a detailed discussion of this
67       *                method.
68       * @return        true if the portlet can be displayed via Ajax
69       */
70      public static com.liferay.portal.model.Permission update(
71          com.liferay.portal.model.Permission permission, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(permission, merge);
74      }
75  
76      public static com.liferay.portal.model.Permission updateImpl(
77          com.liferay.portal.model.Permission permission, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(permission, merge);
80      }
81  
82      public static com.liferay.portal.model.Permission findByPrimaryKey(
83          long permissionId)
84          throws com.liferay.portal.SystemException,
85              com.liferay.portal.NoSuchPermissionException {
86          return getPersistence().findByPrimaryKey(permissionId);
87      }
88  
89      public static com.liferay.portal.model.Permission fetchByPrimaryKey(
90          long permissionId) throws com.liferay.portal.SystemException {
91          return getPersistence().fetchByPrimaryKey(permissionId);
92      }
93  
94      public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
95          long resourceId) throws com.liferay.portal.SystemException {
96          return getPersistence().findByResourceId(resourceId);
97      }
98  
99      public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
100         long resourceId, int begin, int end)
101         throws com.liferay.portal.SystemException {
102         return getPersistence().findByResourceId(resourceId, begin, end);
103     }
104 
105     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
106         long resourceId, int begin, int end,
107         com.liferay.portal.kernel.util.OrderByComparator obc)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findByResourceId(resourceId, begin, end, obc);
110     }
111 
112     public static com.liferay.portal.model.Permission findByResourceId_First(
113         long resourceId, com.liferay.portal.kernel.util.OrderByComparator obc)
114         throws com.liferay.portal.SystemException,
115             com.liferay.portal.NoSuchPermissionException {
116         return getPersistence().findByResourceId_First(resourceId, obc);
117     }
118 
119     public static com.liferay.portal.model.Permission findByResourceId_Last(
120         long resourceId, com.liferay.portal.kernel.util.OrderByComparator obc)
121         throws com.liferay.portal.SystemException,
122             com.liferay.portal.NoSuchPermissionException {
123         return getPersistence().findByResourceId_Last(resourceId, obc);
124     }
125 
126     public static com.liferay.portal.model.Permission[] findByResourceId_PrevAndNext(
127         long permissionId, long resourceId,
128         com.liferay.portal.kernel.util.OrderByComparator obc)
129         throws com.liferay.portal.SystemException,
130             com.liferay.portal.NoSuchPermissionException {
131         return getPersistence()
132                    .findByResourceId_PrevAndNext(permissionId, resourceId, obc);
133     }
134 
135     public static com.liferay.portal.model.Permission findByA_R(
136         java.lang.String actionId, long resourceId)
137         throws com.liferay.portal.SystemException,
138             com.liferay.portal.NoSuchPermissionException {
139         return getPersistence().findByA_R(actionId, resourceId);
140     }
141 
142     public static com.liferay.portal.model.Permission fetchByA_R(
143         java.lang.String actionId, long resourceId)
144         throws com.liferay.portal.SystemException {
145         return getPersistence().fetchByA_R(actionId, resourceId);
146     }
147 
148     public static java.util.List<com.liferay.portal.model.Permission> findWithDynamicQuery(
149         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
150         throws com.liferay.portal.SystemException {
151         return getPersistence().findWithDynamicQuery(queryInitializer);
152     }
153 
154     public static java.util.List<com.liferay.portal.model.Permission> findWithDynamicQuery(
155         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
156         int begin, int end) throws com.liferay.portal.SystemException {
157         return getPersistence()
158                    .findWithDynamicQuery(queryInitializer, begin, end);
159     }
160 
161     public static java.util.List<com.liferay.portal.model.Permission> findAll()
162         throws com.liferay.portal.SystemException {
163         return getPersistence().findAll();
164     }
165 
166     public static java.util.List<com.liferay.portal.model.Permission> findAll(
167         int begin, int end) throws com.liferay.portal.SystemException {
168         return getPersistence().findAll(begin, end);
169     }
170 
171     public static java.util.List<com.liferay.portal.model.Permission> findAll(
172         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
173         throws com.liferay.portal.SystemException {
174         return getPersistence().findAll(begin, end, obc);
175     }
176 
177     public static void removeByResourceId(long resourceId)
178         throws com.liferay.portal.SystemException {
179         getPersistence().removeByResourceId(resourceId);
180     }
181 
182     public static void removeByA_R(java.lang.String actionId, long resourceId)
183         throws com.liferay.portal.SystemException,
184             com.liferay.portal.NoSuchPermissionException {
185         getPersistence().removeByA_R(actionId, resourceId);
186     }
187 
188     public static void removeAll() throws com.liferay.portal.SystemException {
189         getPersistence().removeAll();
190     }
191 
192     public static int countByResourceId(long resourceId)
193         throws com.liferay.portal.SystemException {
194         return getPersistence().countByResourceId(resourceId);
195     }
196 
197     public static int countByA_R(java.lang.String actionId, long resourceId)
198         throws com.liferay.portal.SystemException {
199         return getPersistence().countByA_R(actionId, resourceId);
200     }
201 
202     public static int countAll() throws com.liferay.portal.SystemException {
203         return getPersistence().countAll();
204     }
205 
206     public static java.util.List<com.liferay.portal.model.Group> getGroups(
207         long pk)
208         throws com.liferay.portal.SystemException,
209             com.liferay.portal.NoSuchPermissionException {
210         return getPersistence().getGroups(pk);
211     }
212 
213     public static java.util.List<com.liferay.portal.model.Group> getGroups(
214         long pk, int begin, int end)
215         throws com.liferay.portal.SystemException,
216             com.liferay.portal.NoSuchPermissionException {
217         return getPersistence().getGroups(pk, begin, end);
218     }
219 
220     public static java.util.List<com.liferay.portal.model.Group> getGroups(
221         long pk, int begin, int end,
222         com.liferay.portal.kernel.util.OrderByComparator obc)
223         throws com.liferay.portal.SystemException,
224             com.liferay.portal.NoSuchPermissionException {
225         return getPersistence().getGroups(pk, begin, end, obc);
226     }
227 
228     public static int getGroupsSize(long pk)
229         throws com.liferay.portal.SystemException {
230         return getPersistence().getGroupsSize(pk);
231     }
232 
233     public static boolean containsGroup(long pk, long groupPK)
234         throws com.liferay.portal.SystemException {
235         return getPersistence().containsGroup(pk, groupPK);
236     }
237 
238     public static boolean containsGroups(long pk)
239         throws com.liferay.portal.SystemException {
240         return getPersistence().containsGroups(pk);
241     }
242 
243     public static void addGroup(long pk, long groupPK)
244         throws com.liferay.portal.SystemException,
245             com.liferay.portal.NoSuchGroupException,
246             com.liferay.portal.NoSuchPermissionException {
247         getPersistence().addGroup(pk, groupPK);
248     }
249 
250     public static void addGroup(long pk, com.liferay.portal.model.Group group)
251         throws com.liferay.portal.SystemException,
252             com.liferay.portal.NoSuchGroupException,
253             com.liferay.portal.NoSuchPermissionException {
254         getPersistence().addGroup(pk, group);
255     }
256 
257     public static void addGroups(long pk, long[] groupPKs)
258         throws com.liferay.portal.SystemException,
259             com.liferay.portal.NoSuchGroupException,
260             com.liferay.portal.NoSuchPermissionException {
261         getPersistence().addGroups(pk, groupPKs);
262     }
263 
264     public static void addGroups(long pk,
265         java.util.List<com.liferay.portal.model.Group> groups)
266         throws com.liferay.portal.SystemException,
267             com.liferay.portal.NoSuchGroupException,
268             com.liferay.portal.NoSuchPermissionException {
269         getPersistence().addGroups(pk, groups);
270     }
271 
272     public static void clearGroups(long pk)
273         throws com.liferay.portal.SystemException,
274             com.liferay.portal.NoSuchPermissionException {
275         getPersistence().clearGroups(pk);
276     }
277 
278     public static void removeGroup(long pk, long groupPK)
279         throws com.liferay.portal.SystemException,
280             com.liferay.portal.NoSuchGroupException,
281             com.liferay.portal.NoSuchPermissionException {
282         getPersistence().removeGroup(pk, groupPK);
283     }
284 
285     public static void removeGroup(long pk, com.liferay.portal.model.Group group)
286         throws com.liferay.portal.SystemException,
287             com.liferay.portal.NoSuchGroupException,
288             com.liferay.portal.NoSuchPermissionException {
289         getPersistence().removeGroup(pk, group);
290     }
291 
292     public static void removeGroups(long pk, long[] groupPKs)
293         throws com.liferay.portal.SystemException,
294             com.liferay.portal.NoSuchGroupException,
295             com.liferay.portal.NoSuchPermissionException {
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             com.liferay.portal.NoSuchGroupException,
303             com.liferay.portal.NoSuchPermissionException {
304         getPersistence().removeGroups(pk, groups);
305     }
306 
307     public static void setGroups(long pk, long[] groupPKs)
308         throws com.liferay.portal.SystemException,
309             com.liferay.portal.NoSuchGroupException,
310             com.liferay.portal.NoSuchPermissionException {
311         getPersistence().setGroups(pk, groupPKs);
312     }
313 
314     public static void setGroups(long pk,
315         java.util.List<com.liferay.portal.model.Group> groups)
316         throws com.liferay.portal.SystemException,
317             com.liferay.portal.NoSuchGroupException,
318             com.liferay.portal.NoSuchPermissionException {
319         getPersistence().setGroups(pk, groups);
320     }
321 
322     public static java.util.List<com.liferay.portal.model.Role> getRoles(
323         long pk)
324         throws com.liferay.portal.SystemException,
325             com.liferay.portal.NoSuchPermissionException {
326         return getPersistence().getRoles(pk);
327     }
328 
329     public static java.util.List<com.liferay.portal.model.Role> getRoles(
330         long pk, int begin, int end)
331         throws com.liferay.portal.SystemException,
332             com.liferay.portal.NoSuchPermissionException {
333         return getPersistence().getRoles(pk, begin, end);
334     }
335 
336     public static java.util.List<com.liferay.portal.model.Role> getRoles(
337         long pk, int begin, int end,
338         com.liferay.portal.kernel.util.OrderByComparator obc)
339         throws com.liferay.portal.SystemException,
340             com.liferay.portal.NoSuchPermissionException {
341         return getPersistence().getRoles(pk, begin, end, obc);
342     }
343 
344     public static int getRolesSize(long pk)
345         throws com.liferay.portal.SystemException {
346         return getPersistence().getRolesSize(pk);
347     }
348 
349     public static boolean containsRole(long pk, long rolePK)
350         throws com.liferay.portal.SystemException {
351         return getPersistence().containsRole(pk, rolePK);
352     }
353 
354     public static boolean containsRoles(long pk)
355         throws com.liferay.portal.SystemException {
356         return getPersistence().containsRoles(pk);
357     }
358 
359     public static void addRole(long pk, long rolePK)
360         throws com.liferay.portal.SystemException,
361             com.liferay.portal.NoSuchRoleException,
362             com.liferay.portal.NoSuchPermissionException {
363         getPersistence().addRole(pk, rolePK);
364     }
365 
366     public static void addRole(long pk, com.liferay.portal.model.Role role)
367         throws com.liferay.portal.SystemException,
368             com.liferay.portal.NoSuchRoleException,
369             com.liferay.portal.NoSuchPermissionException {
370         getPersistence().addRole(pk, role);
371     }
372 
373     public static void addRoles(long pk, long[] rolePKs)
374         throws com.liferay.portal.SystemException,
375             com.liferay.portal.NoSuchRoleException,
376             com.liferay.portal.NoSuchPermissionException {
377         getPersistence().addRoles(pk, rolePKs);
378     }
379 
380     public static void addRoles(long pk,
381         java.util.List<com.liferay.portal.model.Role> roles)
382         throws com.liferay.portal.SystemException,
383             com.liferay.portal.NoSuchRoleException,
384             com.liferay.portal.NoSuchPermissionException {
385         getPersistence().addRoles(pk, roles);
386     }
387 
388     public static void clearRoles(long pk)
389         throws com.liferay.portal.SystemException,
390             com.liferay.portal.NoSuchPermissionException {
391         getPersistence().clearRoles(pk);
392     }
393 
394     public static void removeRole(long pk, long rolePK)
395         throws com.liferay.portal.SystemException,
396             com.liferay.portal.NoSuchRoleException,
397             com.liferay.portal.NoSuchPermissionException {
398         getPersistence().removeRole(pk, rolePK);
399     }
400 
401     public static void removeRole(long pk, com.liferay.portal.model.Role role)
402         throws com.liferay.portal.SystemException,
403             com.liferay.portal.NoSuchRoleException,
404             com.liferay.portal.NoSuchPermissionException {
405         getPersistence().removeRole(pk, role);
406     }
407 
408     public static void removeRoles(long pk, long[] rolePKs)
409         throws com.liferay.portal.SystemException,
410             com.liferay.portal.NoSuchRoleException,
411             com.liferay.portal.NoSuchPermissionException {
412         getPersistence().removeRoles(pk, rolePKs);
413     }
414 
415     public static void removeRoles(long pk,
416         java.util.List<com.liferay.portal.model.Role> roles)
417         throws com.liferay.portal.SystemException,
418             com.liferay.portal.NoSuchRoleException,
419             com.liferay.portal.NoSuchPermissionException {
420         getPersistence().removeRoles(pk, roles);
421     }
422 
423     public static void setRoles(long pk, long[] rolePKs)
424         throws com.liferay.portal.SystemException,
425             com.liferay.portal.NoSuchRoleException,
426             com.liferay.portal.NoSuchPermissionException {
427         getPersistence().setRoles(pk, rolePKs);
428     }
429 
430     public static void setRoles(long pk,
431         java.util.List<com.liferay.portal.model.Role> roles)
432         throws com.liferay.portal.SystemException,
433             com.liferay.portal.NoSuchRoleException,
434             com.liferay.portal.NoSuchPermissionException {
435         getPersistence().setRoles(pk, roles);
436     }
437 
438     public static java.util.List<com.liferay.portal.model.User> getUsers(
439         long pk)
440         throws com.liferay.portal.SystemException,
441             com.liferay.portal.NoSuchPermissionException {
442         return getPersistence().getUsers(pk);
443     }
444 
445     public static java.util.List<com.liferay.portal.model.User> getUsers(
446         long pk, int begin, int end)
447         throws com.liferay.portal.SystemException,
448             com.liferay.portal.NoSuchPermissionException {
449         return getPersistence().getUsers(pk, begin, end);
450     }
451 
452     public static java.util.List<com.liferay.portal.model.User> getUsers(
453         long pk, int begin, int end,
454         com.liferay.portal.kernel.util.OrderByComparator obc)
455         throws com.liferay.portal.SystemException,
456             com.liferay.portal.NoSuchPermissionException {
457         return getPersistence().getUsers(pk, begin, end, obc);
458     }
459 
460     public static int getUsersSize(long pk)
461         throws com.liferay.portal.SystemException {
462         return getPersistence().getUsersSize(pk);
463     }
464 
465     public static boolean containsUser(long pk, long userPK)
466         throws com.liferay.portal.SystemException {
467         return getPersistence().containsUser(pk, userPK);
468     }
469 
470     public static boolean containsUsers(long pk)
471         throws com.liferay.portal.SystemException {
472         return getPersistence().containsUsers(pk);
473     }
474 
475     public static void addUser(long pk, long userPK)
476         throws com.liferay.portal.SystemException,
477             com.liferay.portal.NoSuchPermissionException,
478             com.liferay.portal.NoSuchUserException {
479         getPersistence().addUser(pk, userPK);
480     }
481 
482     public static void addUser(long pk, com.liferay.portal.model.User user)
483         throws com.liferay.portal.SystemException,
484             com.liferay.portal.NoSuchPermissionException,
485             com.liferay.portal.NoSuchUserException {
486         getPersistence().addUser(pk, user);
487     }
488 
489     public static void addUsers(long pk, long[] userPKs)
490         throws com.liferay.portal.SystemException,
491             com.liferay.portal.NoSuchPermissionException,
492             com.liferay.portal.NoSuchUserException {
493         getPersistence().addUsers(pk, userPKs);
494     }
495 
496     public static void addUsers(long pk,
497         java.util.List<com.liferay.portal.model.User> users)
498         throws com.liferay.portal.SystemException,
499             com.liferay.portal.NoSuchPermissionException,
500             com.liferay.portal.NoSuchUserException {
501         getPersistence().addUsers(pk, users);
502     }
503 
504     public static void clearUsers(long pk)
505         throws com.liferay.portal.SystemException,
506             com.liferay.portal.NoSuchPermissionException {
507         getPersistence().clearUsers(pk);
508     }
509 
510     public static void removeUser(long pk, long userPK)
511         throws com.liferay.portal.SystemException,
512             com.liferay.portal.NoSuchPermissionException,
513             com.liferay.portal.NoSuchUserException {
514         getPersistence().removeUser(pk, userPK);
515     }
516 
517     public static void removeUser(long pk, com.liferay.portal.model.User user)
518         throws com.liferay.portal.SystemException,
519             com.liferay.portal.NoSuchPermissionException,
520             com.liferay.portal.NoSuchUserException {
521         getPersistence().removeUser(pk, user);
522     }
523 
524     public static void removeUsers(long pk, long[] userPKs)
525         throws com.liferay.portal.SystemException,
526             com.liferay.portal.NoSuchPermissionException,
527             com.liferay.portal.NoSuchUserException {
528         getPersistence().removeUsers(pk, userPKs);
529     }
530 
531     public static void removeUsers(long pk,
532         java.util.List<com.liferay.portal.model.User> users)
533         throws com.liferay.portal.SystemException,
534             com.liferay.portal.NoSuchPermissionException,
535             com.liferay.portal.NoSuchUserException {
536         getPersistence().removeUsers(pk, users);
537     }
538 
539     public static void setUsers(long pk, long[] userPKs)
540         throws com.liferay.portal.SystemException,
541             com.liferay.portal.NoSuchPermissionException,
542             com.liferay.portal.NoSuchUserException {
543         getPersistence().setUsers(pk, userPKs);
544     }
545 
546     public static void setUsers(long pk,
547         java.util.List<com.liferay.portal.model.User> users)
548         throws com.liferay.portal.SystemException,
549             com.liferay.portal.NoSuchPermissionException,
550             com.liferay.portal.NoSuchUserException {
551         getPersistence().setUsers(pk, users);
552     }
553 
554     public static PermissionPersistence getPersistence() {
555         return _getUtil()._persistence;
556     }
557 
558     public void setPersistence(PermissionPersistence persistence) {
559         _persistence = persistence;
560     }
561 
562     private static PermissionUtil _getUtil() {
563         if (_util == null) {
564             _util = (PermissionUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
565         }
566 
567         return _util;
568     }
569 
570     private static final String _UTIL = PermissionUtil.class.getName();
571     private static PermissionUtil _util;
572     private PermissionPersistence _persistence;
573 }