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 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.NoSuchPermissionException,
38              com.liferay.portal.SystemException {
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.NoSuchPermissionException,
85              com.liferay.portal.SystemException {
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 start, int end)
101         throws com.liferay.portal.SystemException {
102         return getPersistence().findByResourceId(resourceId, start, end);
103     }
104 
105     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
106         long resourceId, int start, int end,
107         com.liferay.portal.kernel.util.OrderByComparator obc)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findByResourceId(resourceId, start, 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.NoSuchPermissionException,
115             com.liferay.portal.SystemException {
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.NoSuchPermissionException,
122             com.liferay.portal.SystemException {
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.NoSuchPermissionException,
130             com.liferay.portal.SystemException {
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.NoSuchPermissionException,
138             com.liferay.portal.SystemException {
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<Object> findWithDynamicQuery(
149         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
150         throws com.liferay.portal.SystemException {
151         return getPersistence().findWithDynamicQuery(dynamicQuery);
152     }
153 
154     public static java.util.List<Object> findWithDynamicQuery(
155         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
156         int end) throws com.liferay.portal.SystemException {
157         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
158     }
159 
160     public static java.util.List<com.liferay.portal.model.Permission> findAll()
161         throws com.liferay.portal.SystemException {
162         return getPersistence().findAll();
163     }
164 
165     public static java.util.List<com.liferay.portal.model.Permission> findAll(
166         int start, int end) throws com.liferay.portal.SystemException {
167         return getPersistence().findAll(start, end);
168     }
169 
170     public static java.util.List<com.liferay.portal.model.Permission> findAll(
171         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
172         throws com.liferay.portal.SystemException {
173         return getPersistence().findAll(start, end, obc);
174     }
175 
176     public static void removeByResourceId(long resourceId)
177         throws com.liferay.portal.SystemException {
178         getPersistence().removeByResourceId(resourceId);
179     }
180 
181     public static void removeByA_R(java.lang.String actionId, long resourceId)
182         throws com.liferay.portal.NoSuchPermissionException,
183             com.liferay.portal.SystemException {
184         getPersistence().removeByA_R(actionId, resourceId);
185     }
186 
187     public static void removeAll() throws com.liferay.portal.SystemException {
188         getPersistence().removeAll();
189     }
190 
191     public static int countByResourceId(long resourceId)
192         throws com.liferay.portal.SystemException {
193         return getPersistence().countByResourceId(resourceId);
194     }
195 
196     public static int countByA_R(java.lang.String actionId, long resourceId)
197         throws com.liferay.portal.SystemException {
198         return getPersistence().countByA_R(actionId, resourceId);
199     }
200 
201     public static int countAll() throws com.liferay.portal.SystemException {
202         return getPersistence().countAll();
203     }
204 
205     public static java.util.List<com.liferay.portal.model.Group> getGroups(
206         long pk) throws com.liferay.portal.SystemException {
207         return getPersistence().getGroups(pk);
208     }
209 
210     public static java.util.List<com.liferay.portal.model.Group> getGroups(
211         long pk, int start, int end) throws com.liferay.portal.SystemException {
212         return getPersistence().getGroups(pk, start, end);
213     }
214 
215     public static java.util.List<com.liferay.portal.model.Group> getGroups(
216         long pk, int start, int end,
217         com.liferay.portal.kernel.util.OrderByComparator obc)
218         throws com.liferay.portal.SystemException {
219         return getPersistence().getGroups(pk, start, end, obc);
220     }
221 
222     public static int getGroupsSize(long pk)
223         throws com.liferay.portal.SystemException {
224         return getPersistence().getGroupsSize(pk);
225     }
226 
227     public static boolean containsGroup(long pk, long groupPK)
228         throws com.liferay.portal.SystemException {
229         return getPersistence().containsGroup(pk, groupPK);
230     }
231 
232     public static boolean containsGroups(long pk)
233         throws com.liferay.portal.SystemException {
234         return getPersistence().containsGroups(pk);
235     }
236 
237     public static void addGroup(long pk, long groupPK)
238         throws com.liferay.portal.SystemException {
239         getPersistence().addGroup(pk, groupPK);
240     }
241 
242     public static void addGroup(long pk, com.liferay.portal.model.Group group)
243         throws com.liferay.portal.SystemException {
244         getPersistence().addGroup(pk, group);
245     }
246 
247     public static void addGroups(long pk, long[] groupPKs)
248         throws com.liferay.portal.SystemException {
249         getPersistence().addGroups(pk, groupPKs);
250     }
251 
252     public static void addGroups(long pk,
253         java.util.List<com.liferay.portal.model.Group> groups)
254         throws com.liferay.portal.SystemException {
255         getPersistence().addGroups(pk, groups);
256     }
257 
258     public static void clearGroups(long pk)
259         throws com.liferay.portal.SystemException {
260         getPersistence().clearGroups(pk);
261     }
262 
263     public static void removeGroup(long pk, long groupPK)
264         throws com.liferay.portal.SystemException {
265         getPersistence().removeGroup(pk, groupPK);
266     }
267 
268     public static void removeGroup(long pk, com.liferay.portal.model.Group group)
269         throws com.liferay.portal.SystemException {
270         getPersistence().removeGroup(pk, group);
271     }
272 
273     public static void removeGroups(long pk, long[] groupPKs)
274         throws com.liferay.portal.SystemException {
275         getPersistence().removeGroups(pk, groupPKs);
276     }
277 
278     public static void removeGroups(long pk,
279         java.util.List<com.liferay.portal.model.Group> groups)
280         throws com.liferay.portal.SystemException {
281         getPersistence().removeGroups(pk, groups);
282     }
283 
284     public static void setGroups(long pk, long[] groupPKs)
285         throws com.liferay.portal.SystemException {
286         getPersistence().setGroups(pk, groupPKs);
287     }
288 
289     public static void setGroups(long pk,
290         java.util.List<com.liferay.portal.model.Group> groups)
291         throws com.liferay.portal.SystemException {
292         getPersistence().setGroups(pk, groups);
293     }
294 
295     public static java.util.List<com.liferay.portal.model.Role> getRoles(
296         long pk) throws com.liferay.portal.SystemException {
297         return getPersistence().getRoles(pk);
298     }
299 
300     public static java.util.List<com.liferay.portal.model.Role> getRoles(
301         long pk, int start, int end) throws com.liferay.portal.SystemException {
302         return getPersistence().getRoles(pk, start, end);
303     }
304 
305     public static java.util.List<com.liferay.portal.model.Role> getRoles(
306         long pk, int start, int end,
307         com.liferay.portal.kernel.util.OrderByComparator obc)
308         throws com.liferay.portal.SystemException {
309         return getPersistence().getRoles(pk, start, end, obc);
310     }
311 
312     public static int getRolesSize(long pk)
313         throws com.liferay.portal.SystemException {
314         return getPersistence().getRolesSize(pk);
315     }
316 
317     public static boolean containsRole(long pk, long rolePK)
318         throws com.liferay.portal.SystemException {
319         return getPersistence().containsRole(pk, rolePK);
320     }
321 
322     public static boolean containsRoles(long pk)
323         throws com.liferay.portal.SystemException {
324         return getPersistence().containsRoles(pk);
325     }
326 
327     public static void addRole(long pk, long rolePK)
328         throws com.liferay.portal.SystemException {
329         getPersistence().addRole(pk, rolePK);
330     }
331 
332     public static void addRole(long pk, com.liferay.portal.model.Role role)
333         throws com.liferay.portal.SystemException {
334         getPersistence().addRole(pk, role);
335     }
336 
337     public static void addRoles(long pk, long[] rolePKs)
338         throws com.liferay.portal.SystemException {
339         getPersistence().addRoles(pk, rolePKs);
340     }
341 
342     public static void addRoles(long pk,
343         java.util.List<com.liferay.portal.model.Role> roles)
344         throws com.liferay.portal.SystemException {
345         getPersistence().addRoles(pk, roles);
346     }
347 
348     public static void clearRoles(long pk)
349         throws com.liferay.portal.SystemException {
350         getPersistence().clearRoles(pk);
351     }
352 
353     public static void removeRole(long pk, long rolePK)
354         throws com.liferay.portal.SystemException {
355         getPersistence().removeRole(pk, rolePK);
356     }
357 
358     public static void removeRole(long pk, com.liferay.portal.model.Role role)
359         throws com.liferay.portal.SystemException {
360         getPersistence().removeRole(pk, role);
361     }
362 
363     public static void removeRoles(long pk, long[] rolePKs)
364         throws com.liferay.portal.SystemException {
365         getPersistence().removeRoles(pk, rolePKs);
366     }
367 
368     public static void removeRoles(long pk,
369         java.util.List<com.liferay.portal.model.Role> roles)
370         throws com.liferay.portal.SystemException {
371         getPersistence().removeRoles(pk, roles);
372     }
373 
374     public static void setRoles(long pk, long[] rolePKs)
375         throws com.liferay.portal.SystemException {
376         getPersistence().setRoles(pk, rolePKs);
377     }
378 
379     public static void setRoles(long pk,
380         java.util.List<com.liferay.portal.model.Role> roles)
381         throws com.liferay.portal.SystemException {
382         getPersistence().setRoles(pk, roles);
383     }
384 
385     public static java.util.List<com.liferay.portal.model.User> getUsers(
386         long pk) throws com.liferay.portal.SystemException {
387         return getPersistence().getUsers(pk);
388     }
389 
390     public static java.util.List<com.liferay.portal.model.User> getUsers(
391         long pk, int start, int end) throws com.liferay.portal.SystemException {
392         return getPersistence().getUsers(pk, start, end);
393     }
394 
395     public static java.util.List<com.liferay.portal.model.User> getUsers(
396         long pk, int start, int end,
397         com.liferay.portal.kernel.util.OrderByComparator obc)
398         throws com.liferay.portal.SystemException {
399         return getPersistence().getUsers(pk, start, end, obc);
400     }
401 
402     public static int getUsersSize(long pk)
403         throws com.liferay.portal.SystemException {
404         return getPersistence().getUsersSize(pk);
405     }
406 
407     public static boolean containsUser(long pk, long userPK)
408         throws com.liferay.portal.SystemException {
409         return getPersistence().containsUser(pk, userPK);
410     }
411 
412     public static boolean containsUsers(long pk)
413         throws com.liferay.portal.SystemException {
414         return getPersistence().containsUsers(pk);
415     }
416 
417     public static void addUser(long pk, long userPK)
418         throws com.liferay.portal.SystemException {
419         getPersistence().addUser(pk, userPK);
420     }
421 
422     public static void addUser(long pk, com.liferay.portal.model.User user)
423         throws com.liferay.portal.SystemException {
424         getPersistence().addUser(pk, user);
425     }
426 
427     public static void addUsers(long pk, long[] userPKs)
428         throws com.liferay.portal.SystemException {
429         getPersistence().addUsers(pk, userPKs);
430     }
431 
432     public static void addUsers(long pk,
433         java.util.List<com.liferay.portal.model.User> users)
434         throws com.liferay.portal.SystemException {
435         getPersistence().addUsers(pk, users);
436     }
437 
438     public static void clearUsers(long pk)
439         throws com.liferay.portal.SystemException {
440         getPersistence().clearUsers(pk);
441     }
442 
443     public static void removeUser(long pk, long userPK)
444         throws com.liferay.portal.SystemException {
445         getPersistence().removeUser(pk, userPK);
446     }
447 
448     public static void removeUser(long pk, com.liferay.portal.model.User user)
449         throws com.liferay.portal.SystemException {
450         getPersistence().removeUser(pk, user);
451     }
452 
453     public static void removeUsers(long pk, long[] userPKs)
454         throws com.liferay.portal.SystemException {
455         getPersistence().removeUsers(pk, userPKs);
456     }
457 
458     public static void removeUsers(long pk,
459         java.util.List<com.liferay.portal.model.User> users)
460         throws com.liferay.portal.SystemException {
461         getPersistence().removeUsers(pk, users);
462     }
463 
464     public static void setUsers(long pk, long[] userPKs)
465         throws com.liferay.portal.SystemException {
466         getPersistence().setUsers(pk, userPKs);
467     }
468 
469     public static void setUsers(long pk,
470         java.util.List<com.liferay.portal.model.User> users)
471         throws com.liferay.portal.SystemException {
472         getPersistence().setUsers(pk, users);
473     }
474 
475     public static PermissionPersistence getPersistence() {
476         return _persistence;
477     }
478 
479     public void setPersistence(PermissionPersistence persistence) {
480         _persistence = persistence;
481     }
482 
483     private static PermissionPersistence _persistence;
484 }