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="RoleUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class RoleUtil {
32      public static com.liferay.portal.model.Role create(long roleId) {
33          return getPersistence().create(roleId);
34      }
35  
36      public static com.liferay.portal.model.Role remove(long roleId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchRoleException {
39          return getPersistence().remove(roleId);
40      }
41  
42      public static com.liferay.portal.model.Role remove(
43          com.liferay.portal.model.Role role)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(role);
46      }
47  
48      /**
49       * @deprecated Use <code>update(Role role, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.Role update(
52          com.liferay.portal.model.Role role)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(role);
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        role 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 role 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.Role update(
71          com.liferay.portal.model.Role role, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(role, merge);
74      }
75  
76      public static com.liferay.portal.model.Role updateImpl(
77          com.liferay.portal.model.Role role, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(role, merge);
80      }
81  
82      public static com.liferay.portal.model.Role findByPrimaryKey(long roleId)
83          throws com.liferay.portal.SystemException,
84              com.liferay.portal.NoSuchRoleException {
85          return getPersistence().findByPrimaryKey(roleId);
86      }
87  
88      public static com.liferay.portal.model.Role fetchByPrimaryKey(long roleId)
89          throws com.liferay.portal.SystemException {
90          return getPersistence().fetchByPrimaryKey(roleId);
91      }
92  
93      public static java.util.List<com.liferay.portal.model.Role> findByCompanyId(
94          long companyId) throws com.liferay.portal.SystemException {
95          return getPersistence().findByCompanyId(companyId);
96      }
97  
98      public static java.util.List<com.liferay.portal.model.Role> findByCompanyId(
99          long companyId, int begin, int end)
100         throws com.liferay.portal.SystemException {
101         return getPersistence().findByCompanyId(companyId, begin, end);
102     }
103 
104     public static java.util.List<com.liferay.portal.model.Role> findByCompanyId(
105         long companyId, int begin, int end,
106         com.liferay.portal.kernel.util.OrderByComparator obc)
107         throws com.liferay.portal.SystemException {
108         return getPersistence().findByCompanyId(companyId, begin, end, obc);
109     }
110 
111     public static com.liferay.portal.model.Role findByCompanyId_First(
112         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
113         throws com.liferay.portal.SystemException,
114             com.liferay.portal.NoSuchRoleException {
115         return getPersistence().findByCompanyId_First(companyId, obc);
116     }
117 
118     public static com.liferay.portal.model.Role findByCompanyId_Last(
119         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
120         throws com.liferay.portal.SystemException,
121             com.liferay.portal.NoSuchRoleException {
122         return getPersistence().findByCompanyId_Last(companyId, obc);
123     }
124 
125     public static com.liferay.portal.model.Role[] findByCompanyId_PrevAndNext(
126         long roleId, long companyId,
127         com.liferay.portal.kernel.util.OrderByComparator obc)
128         throws com.liferay.portal.SystemException,
129             com.liferay.portal.NoSuchRoleException {
130         return getPersistence()
131                    .findByCompanyId_PrevAndNext(roleId, companyId, obc);
132     }
133 
134     public static com.liferay.portal.model.Role findByC_N(long companyId,
135         java.lang.String name)
136         throws com.liferay.portal.SystemException,
137             com.liferay.portal.NoSuchRoleException {
138         return getPersistence().findByC_N(companyId, name);
139     }
140 
141     public static com.liferay.portal.model.Role fetchByC_N(long companyId,
142         java.lang.String name) throws com.liferay.portal.SystemException {
143         return getPersistence().fetchByC_N(companyId, name);
144     }
145 
146     public static com.liferay.portal.model.Role findByC_C_C(long companyId,
147         long classNameId, long classPK)
148         throws com.liferay.portal.SystemException,
149             com.liferay.portal.NoSuchRoleException {
150         return getPersistence().findByC_C_C(companyId, classNameId, classPK);
151     }
152 
153     public static com.liferay.portal.model.Role fetchByC_C_C(long companyId,
154         long classNameId, long classPK)
155         throws com.liferay.portal.SystemException {
156         return getPersistence().fetchByC_C_C(companyId, classNameId, classPK);
157     }
158 
159     public static java.util.List<com.liferay.portal.model.Role> findWithDynamicQuery(
160         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
161         throws com.liferay.portal.SystemException {
162         return getPersistence().findWithDynamicQuery(queryInitializer);
163     }
164 
165     public static java.util.List<com.liferay.portal.model.Role> findWithDynamicQuery(
166         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
167         int begin, int end) throws com.liferay.portal.SystemException {
168         return getPersistence()
169                    .findWithDynamicQuery(queryInitializer, begin, end);
170     }
171 
172     public static java.util.List<com.liferay.portal.model.Role> findAll()
173         throws com.liferay.portal.SystemException {
174         return getPersistence().findAll();
175     }
176 
177     public static java.util.List<com.liferay.portal.model.Role> findAll(
178         int begin, int end) throws com.liferay.portal.SystemException {
179         return getPersistence().findAll(begin, end);
180     }
181 
182     public static java.util.List<com.liferay.portal.model.Role> findAll(
183         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
184         throws com.liferay.portal.SystemException {
185         return getPersistence().findAll(begin, end, obc);
186     }
187 
188     public static void removeByCompanyId(long companyId)
189         throws com.liferay.portal.SystemException {
190         getPersistence().removeByCompanyId(companyId);
191     }
192 
193     public static void removeByC_N(long companyId, java.lang.String name)
194         throws com.liferay.portal.SystemException,
195             com.liferay.portal.NoSuchRoleException {
196         getPersistence().removeByC_N(companyId, name);
197     }
198 
199     public static void removeByC_C_C(long companyId, long classNameId,
200         long classPK)
201         throws com.liferay.portal.SystemException,
202             com.liferay.portal.NoSuchRoleException {
203         getPersistence().removeByC_C_C(companyId, classNameId, classPK);
204     }
205 
206     public static void removeAll() throws com.liferay.portal.SystemException {
207         getPersistence().removeAll();
208     }
209 
210     public static int countByCompanyId(long companyId)
211         throws com.liferay.portal.SystemException {
212         return getPersistence().countByCompanyId(companyId);
213     }
214 
215     public static int countByC_N(long companyId, java.lang.String name)
216         throws com.liferay.portal.SystemException {
217         return getPersistence().countByC_N(companyId, name);
218     }
219 
220     public static int countByC_C_C(long companyId, long classNameId,
221         long classPK) throws com.liferay.portal.SystemException {
222         return getPersistence().countByC_C_C(companyId, classNameId, classPK);
223     }
224 
225     public static int countAll() throws com.liferay.portal.SystemException {
226         return getPersistence().countAll();
227     }
228 
229     public static java.util.List<com.liferay.portal.model.Group> getGroups(
230         long pk)
231         throws com.liferay.portal.SystemException,
232             com.liferay.portal.NoSuchRoleException {
233         return getPersistence().getGroups(pk);
234     }
235 
236     public static java.util.List<com.liferay.portal.model.Group> getGroups(
237         long pk, int begin, int end)
238         throws com.liferay.portal.SystemException,
239             com.liferay.portal.NoSuchRoleException {
240         return getPersistence().getGroups(pk, begin, end);
241     }
242 
243     public static java.util.List<com.liferay.portal.model.Group> getGroups(
244         long pk, int begin, int end,
245         com.liferay.portal.kernel.util.OrderByComparator obc)
246         throws com.liferay.portal.SystemException,
247             com.liferay.portal.NoSuchRoleException {
248         return getPersistence().getGroups(pk, begin, end, obc);
249     }
250 
251     public static int getGroupsSize(long pk)
252         throws com.liferay.portal.SystemException {
253         return getPersistence().getGroupsSize(pk);
254     }
255 
256     public static boolean containsGroup(long pk, long groupPK)
257         throws com.liferay.portal.SystemException {
258         return getPersistence().containsGroup(pk, groupPK);
259     }
260 
261     public static boolean containsGroups(long pk)
262         throws com.liferay.portal.SystemException {
263         return getPersistence().containsGroups(pk);
264     }
265 
266     public static void addGroup(long pk, long groupPK)
267         throws com.liferay.portal.SystemException,
268             com.liferay.portal.NoSuchGroupException,
269             com.liferay.portal.NoSuchRoleException {
270         getPersistence().addGroup(pk, groupPK);
271     }
272 
273     public static void addGroup(long pk, com.liferay.portal.model.Group group)
274         throws com.liferay.portal.SystemException,
275             com.liferay.portal.NoSuchGroupException,
276             com.liferay.portal.NoSuchRoleException {
277         getPersistence().addGroup(pk, group);
278     }
279 
280     public static void addGroups(long pk, long[] groupPKs)
281         throws com.liferay.portal.SystemException,
282             com.liferay.portal.NoSuchGroupException,
283             com.liferay.portal.NoSuchRoleException {
284         getPersistence().addGroups(pk, groupPKs);
285     }
286 
287     public static void addGroups(long pk,
288         java.util.List<com.liferay.portal.model.Group> groups)
289         throws com.liferay.portal.SystemException,
290             com.liferay.portal.NoSuchGroupException,
291             com.liferay.portal.NoSuchRoleException {
292         getPersistence().addGroups(pk, groups);
293     }
294 
295     public static void clearGroups(long pk)
296         throws com.liferay.portal.SystemException,
297             com.liferay.portal.NoSuchRoleException {
298         getPersistence().clearGroups(pk);
299     }
300 
301     public static void removeGroup(long pk, long groupPK)
302         throws com.liferay.portal.SystemException,
303             com.liferay.portal.NoSuchGroupException,
304             com.liferay.portal.NoSuchRoleException {
305         getPersistence().removeGroup(pk, groupPK);
306     }
307 
308     public static void removeGroup(long pk, com.liferay.portal.model.Group group)
309         throws com.liferay.portal.SystemException,
310             com.liferay.portal.NoSuchGroupException,
311             com.liferay.portal.NoSuchRoleException {
312         getPersistence().removeGroup(pk, group);
313     }
314 
315     public static void removeGroups(long pk, long[] groupPKs)
316         throws com.liferay.portal.SystemException,
317             com.liferay.portal.NoSuchGroupException,
318             com.liferay.portal.NoSuchRoleException {
319         getPersistence().removeGroups(pk, groupPKs);
320     }
321 
322     public static void removeGroups(long pk,
323         java.util.List<com.liferay.portal.model.Group> groups)
324         throws com.liferay.portal.SystemException,
325             com.liferay.portal.NoSuchGroupException,
326             com.liferay.portal.NoSuchRoleException {
327         getPersistence().removeGroups(pk, groups);
328     }
329 
330     public static void setGroups(long pk, long[] groupPKs)
331         throws com.liferay.portal.SystemException,
332             com.liferay.portal.NoSuchGroupException,
333             com.liferay.portal.NoSuchRoleException {
334         getPersistence().setGroups(pk, groupPKs);
335     }
336 
337     public static void setGroups(long pk,
338         java.util.List<com.liferay.portal.model.Group> groups)
339         throws com.liferay.portal.SystemException,
340             com.liferay.portal.NoSuchGroupException,
341             com.liferay.portal.NoSuchRoleException {
342         getPersistence().setGroups(pk, groups);
343     }
344 
345     public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
346         long pk)
347         throws com.liferay.portal.SystemException,
348             com.liferay.portal.NoSuchRoleException {
349         return getPersistence().getPermissions(pk);
350     }
351 
352     public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
353         long pk, int begin, int end)
354         throws com.liferay.portal.SystemException,
355             com.liferay.portal.NoSuchRoleException {
356         return getPersistence().getPermissions(pk, begin, end);
357     }
358 
359     public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
360         long pk, int begin, int end,
361         com.liferay.portal.kernel.util.OrderByComparator obc)
362         throws com.liferay.portal.SystemException,
363             com.liferay.portal.NoSuchRoleException {
364         return getPersistence().getPermissions(pk, begin, end, obc);
365     }
366 
367     public static int getPermissionsSize(long pk)
368         throws com.liferay.portal.SystemException {
369         return getPersistence().getPermissionsSize(pk);
370     }
371 
372     public static boolean containsPermission(long pk, long permissionPK)
373         throws com.liferay.portal.SystemException {
374         return getPersistence().containsPermission(pk, permissionPK);
375     }
376 
377     public static boolean containsPermissions(long pk)
378         throws com.liferay.portal.SystemException {
379         return getPersistence().containsPermissions(pk);
380     }
381 
382     public static void addPermission(long pk, long permissionPK)
383         throws com.liferay.portal.SystemException,
384             com.liferay.portal.NoSuchPermissionException,
385             com.liferay.portal.NoSuchRoleException {
386         getPersistence().addPermission(pk, permissionPK);
387     }
388 
389     public static void addPermission(long pk,
390         com.liferay.portal.model.Permission permission)
391         throws com.liferay.portal.SystemException,
392             com.liferay.portal.NoSuchPermissionException,
393             com.liferay.portal.NoSuchRoleException {
394         getPersistence().addPermission(pk, permission);
395     }
396 
397     public static void addPermissions(long pk, long[] permissionPKs)
398         throws com.liferay.portal.SystemException,
399             com.liferay.portal.NoSuchPermissionException,
400             com.liferay.portal.NoSuchRoleException {
401         getPersistence().addPermissions(pk, permissionPKs);
402     }
403 
404     public static void addPermissions(long pk,
405         java.util.List<com.liferay.portal.model.Permission> permissions)
406         throws com.liferay.portal.SystemException,
407             com.liferay.portal.NoSuchPermissionException,
408             com.liferay.portal.NoSuchRoleException {
409         getPersistence().addPermissions(pk, permissions);
410     }
411 
412     public static void clearPermissions(long pk)
413         throws com.liferay.portal.SystemException,
414             com.liferay.portal.NoSuchRoleException {
415         getPersistence().clearPermissions(pk);
416     }
417 
418     public static void removePermission(long pk, long permissionPK)
419         throws com.liferay.portal.SystemException,
420             com.liferay.portal.NoSuchPermissionException,
421             com.liferay.portal.NoSuchRoleException {
422         getPersistence().removePermission(pk, permissionPK);
423     }
424 
425     public static void removePermission(long pk,
426         com.liferay.portal.model.Permission permission)
427         throws com.liferay.portal.SystemException,
428             com.liferay.portal.NoSuchPermissionException,
429             com.liferay.portal.NoSuchRoleException {
430         getPersistence().removePermission(pk, permission);
431     }
432 
433     public static void removePermissions(long pk, long[] permissionPKs)
434         throws com.liferay.portal.SystemException,
435             com.liferay.portal.NoSuchPermissionException,
436             com.liferay.portal.NoSuchRoleException {
437         getPersistence().removePermissions(pk, permissionPKs);
438     }
439 
440     public static void removePermissions(long pk,
441         java.util.List<com.liferay.portal.model.Permission> permissions)
442         throws com.liferay.portal.SystemException,
443             com.liferay.portal.NoSuchPermissionException,
444             com.liferay.portal.NoSuchRoleException {
445         getPersistence().removePermissions(pk, permissions);
446     }
447 
448     public static void setPermissions(long pk, long[] permissionPKs)
449         throws com.liferay.portal.SystemException,
450             com.liferay.portal.NoSuchPermissionException,
451             com.liferay.portal.NoSuchRoleException {
452         getPersistence().setPermissions(pk, permissionPKs);
453     }
454 
455     public static void setPermissions(long pk,
456         java.util.List<com.liferay.portal.model.Permission> permissions)
457         throws com.liferay.portal.SystemException,
458             com.liferay.portal.NoSuchPermissionException,
459             com.liferay.portal.NoSuchRoleException {
460         getPersistence().setPermissions(pk, permissions);
461     }
462 
463     public static java.util.List<com.liferay.portal.model.User> getUsers(
464         long pk)
465         throws com.liferay.portal.SystemException,
466             com.liferay.portal.NoSuchRoleException {
467         return getPersistence().getUsers(pk);
468     }
469 
470     public static java.util.List<com.liferay.portal.model.User> getUsers(
471         long pk, int begin, int end)
472         throws com.liferay.portal.SystemException,
473             com.liferay.portal.NoSuchRoleException {
474         return getPersistence().getUsers(pk, begin, end);
475     }
476 
477     public static java.util.List<com.liferay.portal.model.User> getUsers(
478         long pk, int begin, int end,
479         com.liferay.portal.kernel.util.OrderByComparator obc)
480         throws com.liferay.portal.SystemException,
481             com.liferay.portal.NoSuchRoleException {
482         return getPersistence().getUsers(pk, begin, end, obc);
483     }
484 
485     public static int getUsersSize(long pk)
486         throws com.liferay.portal.SystemException {
487         return getPersistence().getUsersSize(pk);
488     }
489 
490     public static boolean containsUser(long pk, long userPK)
491         throws com.liferay.portal.SystemException {
492         return getPersistence().containsUser(pk, userPK);
493     }
494 
495     public static boolean containsUsers(long pk)
496         throws com.liferay.portal.SystemException {
497         return getPersistence().containsUsers(pk);
498     }
499 
500     public static void addUser(long pk, long userPK)
501         throws com.liferay.portal.SystemException,
502             com.liferay.portal.NoSuchRoleException,
503             com.liferay.portal.NoSuchUserException {
504         getPersistence().addUser(pk, userPK);
505     }
506 
507     public static void addUser(long pk, com.liferay.portal.model.User user)
508         throws com.liferay.portal.SystemException,
509             com.liferay.portal.NoSuchRoleException,
510             com.liferay.portal.NoSuchUserException {
511         getPersistence().addUser(pk, user);
512     }
513 
514     public static void addUsers(long pk, long[] userPKs)
515         throws com.liferay.portal.SystemException,
516             com.liferay.portal.NoSuchRoleException,
517             com.liferay.portal.NoSuchUserException {
518         getPersistence().addUsers(pk, userPKs);
519     }
520 
521     public static void addUsers(long pk,
522         java.util.List<com.liferay.portal.model.User> users)
523         throws com.liferay.portal.SystemException,
524             com.liferay.portal.NoSuchRoleException,
525             com.liferay.portal.NoSuchUserException {
526         getPersistence().addUsers(pk, users);
527     }
528 
529     public static void clearUsers(long pk)
530         throws com.liferay.portal.SystemException,
531             com.liferay.portal.NoSuchRoleException {
532         getPersistence().clearUsers(pk);
533     }
534 
535     public static void removeUser(long pk, long userPK)
536         throws com.liferay.portal.SystemException,
537             com.liferay.portal.NoSuchRoleException,
538             com.liferay.portal.NoSuchUserException {
539         getPersistence().removeUser(pk, userPK);
540     }
541 
542     public static void removeUser(long pk, com.liferay.portal.model.User user)
543         throws com.liferay.portal.SystemException,
544             com.liferay.portal.NoSuchRoleException,
545             com.liferay.portal.NoSuchUserException {
546         getPersistence().removeUser(pk, user);
547     }
548 
549     public static void removeUsers(long pk, long[] userPKs)
550         throws com.liferay.portal.SystemException,
551             com.liferay.portal.NoSuchRoleException,
552             com.liferay.portal.NoSuchUserException {
553         getPersistence().removeUsers(pk, userPKs);
554     }
555 
556     public static void removeUsers(long pk,
557         java.util.List<com.liferay.portal.model.User> users)
558         throws com.liferay.portal.SystemException,
559             com.liferay.portal.NoSuchRoleException,
560             com.liferay.portal.NoSuchUserException {
561         getPersistence().removeUsers(pk, users);
562     }
563 
564     public static void setUsers(long pk, long[] userPKs)
565         throws com.liferay.portal.SystemException,
566             com.liferay.portal.NoSuchRoleException,
567             com.liferay.portal.NoSuchUserException {
568         getPersistence().setUsers(pk, userPKs);
569     }
570 
571     public static void setUsers(long pk,
572         java.util.List<com.liferay.portal.model.User> users)
573         throws com.liferay.portal.SystemException,
574             com.liferay.portal.NoSuchRoleException,
575             com.liferay.portal.NoSuchUserException {
576         getPersistence().setUsers(pk, users);
577     }
578 
579     public static RolePersistence getPersistence() {
580         return _getUtil()._persistence;
581     }
582 
583     public void setPersistence(RolePersistence persistence) {
584         _persistence = persistence;
585     }
586 
587     private static RoleUtil _getUtil() {
588         if (_util == null) {
589             _util = (RoleUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
590         }
591 
592         return _util;
593     }
594 
595     private static final String _UTIL = RoleUtil.class.getName();
596     private static RoleUtil _util;
597     private RolePersistence _persistence;
598 }