1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.service.persistence;
21  
22  /**
23   * <a href="PermissionUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   *
27   */
28  public class PermissionUtil {
29      public static void cacheResult(
30          com.liferay.portal.model.Permission permission) {
31          getPersistence().cacheResult(permission);
32      }
33  
34      public static void cacheResult(
35          java.util.List<com.liferay.portal.model.Permission> permissions) {
36          getPersistence().cacheResult(permissions);
37      }
38  
39      public static void clearCache() {
40          getPersistence().clearCache();
41      }
42  
43      public static com.liferay.portal.model.Permission create(long permissionId) {
44          return getPersistence().create(permissionId);
45      }
46  
47      public static com.liferay.portal.model.Permission remove(long permissionId)
48          throws com.liferay.portal.NoSuchPermissionException,
49              com.liferay.portal.SystemException {
50          return getPersistence().remove(permissionId);
51      }
52  
53      public static com.liferay.portal.model.Permission remove(
54          com.liferay.portal.model.Permission permission)
55          throws com.liferay.portal.SystemException {
56          return getPersistence().remove(permission);
57      }
58  
59      /**
60       * @deprecated Use <code>update(Permission permission, boolean merge)</code>.
61       */
62      public static com.liferay.portal.model.Permission update(
63          com.liferay.portal.model.Permission permission)
64          throws com.liferay.portal.SystemException {
65          return getPersistence().update(permission);
66      }
67  
68      /**
69       * Add, update, or merge, the entity. This method also calls the model
70       * listeners to trigger the proper events associated with adding, deleting,
71       * or updating an entity.
72       *
73       * @param        permission the entity to add, update, or merge
74       * @param        merge boolean value for whether to merge the entity. The
75       *                default value is false. Setting merge to true is more
76       *                expensive and should only be true when permission is
77       *                transient. See LEP-5473 for a detailed discussion of this
78       *                method.
79       * @return        true if the portlet can be displayed via Ajax
80       */
81      public static com.liferay.portal.model.Permission update(
82          com.liferay.portal.model.Permission permission, boolean merge)
83          throws com.liferay.portal.SystemException {
84          return getPersistence().update(permission, merge);
85      }
86  
87      public static com.liferay.portal.model.Permission updateImpl(
88          com.liferay.portal.model.Permission permission, boolean merge)
89          throws com.liferay.portal.SystemException {
90          return getPersistence().updateImpl(permission, merge);
91      }
92  
93      public static com.liferay.portal.model.Permission findByPrimaryKey(
94          long permissionId)
95          throws com.liferay.portal.NoSuchPermissionException,
96              com.liferay.portal.SystemException {
97          return getPersistence().findByPrimaryKey(permissionId);
98      }
99  
100     public static com.liferay.portal.model.Permission fetchByPrimaryKey(
101         long permissionId) throws com.liferay.portal.SystemException {
102         return getPersistence().fetchByPrimaryKey(permissionId);
103     }
104 
105     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
106         long resourceId) throws com.liferay.portal.SystemException {
107         return getPersistence().findByResourceId(resourceId);
108     }
109 
110     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
111         long resourceId, int start, int end)
112         throws com.liferay.portal.SystemException {
113         return getPersistence().findByResourceId(resourceId, start, end);
114     }
115 
116     public static java.util.List<com.liferay.portal.model.Permission> findByResourceId(
117         long resourceId, int start, int end,
118         com.liferay.portal.kernel.util.OrderByComparator obc)
119         throws com.liferay.portal.SystemException {
120         return getPersistence().findByResourceId(resourceId, start, end, obc);
121     }
122 
123     public static com.liferay.portal.model.Permission findByResourceId_First(
124         long resourceId, com.liferay.portal.kernel.util.OrderByComparator obc)
125         throws com.liferay.portal.NoSuchPermissionException,
126             com.liferay.portal.SystemException {
127         return getPersistence().findByResourceId_First(resourceId, obc);
128     }
129 
130     public static com.liferay.portal.model.Permission findByResourceId_Last(
131         long resourceId, com.liferay.portal.kernel.util.OrderByComparator obc)
132         throws com.liferay.portal.NoSuchPermissionException,
133             com.liferay.portal.SystemException {
134         return getPersistence().findByResourceId_Last(resourceId, obc);
135     }
136 
137     public static com.liferay.portal.model.Permission[] findByResourceId_PrevAndNext(
138         long permissionId, long resourceId,
139         com.liferay.portal.kernel.util.OrderByComparator obc)
140         throws com.liferay.portal.NoSuchPermissionException,
141             com.liferay.portal.SystemException {
142         return getPersistence()
143                    .findByResourceId_PrevAndNext(permissionId, resourceId, obc);
144     }
145 
146     public static com.liferay.portal.model.Permission findByA_R(
147         java.lang.String actionId, long resourceId)
148         throws com.liferay.portal.NoSuchPermissionException,
149             com.liferay.portal.SystemException {
150         return getPersistence().findByA_R(actionId, resourceId);
151     }
152 
153     public static com.liferay.portal.model.Permission fetchByA_R(
154         java.lang.String actionId, long resourceId)
155         throws com.liferay.portal.SystemException {
156         return getPersistence().fetchByA_R(actionId, resourceId);
157     }
158 
159     public static com.liferay.portal.model.Permission fetchByA_R(
160         java.lang.String actionId, long resourceId, boolean retrieveFromCache)
161         throws com.liferay.portal.SystemException {
162         return getPersistence()
163                    .fetchByA_R(actionId, resourceId, retrieveFromCache);
164     }
165 
166     public static java.util.List<Object> findWithDynamicQuery(
167         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
168         throws com.liferay.portal.SystemException {
169         return getPersistence().findWithDynamicQuery(dynamicQuery);
170     }
171 
172     public static java.util.List<Object> findWithDynamicQuery(
173         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
174         int end) throws com.liferay.portal.SystemException {
175         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
176     }
177 
178     public static java.util.List<com.liferay.portal.model.Permission> findAll()
179         throws com.liferay.portal.SystemException {
180         return getPersistence().findAll();
181     }
182 
183     public static java.util.List<com.liferay.portal.model.Permission> findAll(
184         int start, int end) throws com.liferay.portal.SystemException {
185         return getPersistence().findAll(start, end);
186     }
187 
188     public static java.util.List<com.liferay.portal.model.Permission> findAll(
189         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
190         throws com.liferay.portal.SystemException {
191         return getPersistence().findAll(start, end, obc);
192     }
193 
194     public static void removeByResourceId(long resourceId)
195         throws com.liferay.portal.SystemException {
196         getPersistence().removeByResourceId(resourceId);
197     }
198 
199     public static void removeByA_R(java.lang.String actionId, long resourceId)
200         throws com.liferay.portal.NoSuchPermissionException,
201             com.liferay.portal.SystemException {
202         getPersistence().removeByA_R(actionId, resourceId);
203     }
204 
205     public static void removeAll() throws com.liferay.portal.SystemException {
206         getPersistence().removeAll();
207     }
208 
209     public static int countByResourceId(long resourceId)
210         throws com.liferay.portal.SystemException {
211         return getPersistence().countByResourceId(resourceId);
212     }
213 
214     public static int countByA_R(java.lang.String actionId, long resourceId)
215         throws com.liferay.portal.SystemException {
216         return getPersistence().countByA_R(actionId, resourceId);
217     }
218 
219     public static int countAll() throws com.liferay.portal.SystemException {
220         return getPersistence().countAll();
221     }
222 
223     public static java.util.List<com.liferay.portal.model.Group> getGroups(
224         long pk) throws com.liferay.portal.SystemException {
225         return getPersistence().getGroups(pk);
226     }
227 
228     public static java.util.List<com.liferay.portal.model.Group> getGroups(
229         long pk, int start, int end) throws com.liferay.portal.SystemException {
230         return getPersistence().getGroups(pk, start, end);
231     }
232 
233     public static java.util.List<com.liferay.portal.model.Group> getGroups(
234         long pk, int start, int end,
235         com.liferay.portal.kernel.util.OrderByComparator obc)
236         throws com.liferay.portal.SystemException {
237         return getPersistence().getGroups(pk, start, end, obc);
238     }
239 
240     public static int getGroupsSize(long pk)
241         throws com.liferay.portal.SystemException {
242         return getPersistence().getGroupsSize(pk);
243     }
244 
245     public static boolean containsGroup(long pk, long groupPK)
246         throws com.liferay.portal.SystemException {
247         return getPersistence().containsGroup(pk, groupPK);
248     }
249 
250     public static boolean containsGroups(long pk)
251         throws com.liferay.portal.SystemException {
252         return getPersistence().containsGroups(pk);
253     }
254 
255     public static void addGroup(long pk, long groupPK)
256         throws com.liferay.portal.SystemException {
257         getPersistence().addGroup(pk, groupPK);
258     }
259 
260     public static void addGroup(long pk, com.liferay.portal.model.Group group)
261         throws com.liferay.portal.SystemException {
262         getPersistence().addGroup(pk, group);
263     }
264 
265     public static void addGroups(long pk, long[] groupPKs)
266         throws com.liferay.portal.SystemException {
267         getPersistence().addGroups(pk, groupPKs);
268     }
269 
270     public static void addGroups(long pk,
271         java.util.List<com.liferay.portal.model.Group> groups)
272         throws com.liferay.portal.SystemException {
273         getPersistence().addGroups(pk, groups);
274     }
275 
276     public static void clearGroups(long pk)
277         throws com.liferay.portal.SystemException {
278         getPersistence().clearGroups(pk);
279     }
280 
281     public static void removeGroup(long pk, long groupPK)
282         throws com.liferay.portal.SystemException {
283         getPersistence().removeGroup(pk, groupPK);
284     }
285 
286     public static void removeGroup(long pk, com.liferay.portal.model.Group group)
287         throws com.liferay.portal.SystemException {
288         getPersistence().removeGroup(pk, group);
289     }
290 
291     public static void removeGroups(long pk, long[] groupPKs)
292         throws com.liferay.portal.SystemException {
293         getPersistence().removeGroups(pk, groupPKs);
294     }
295 
296     public static void removeGroups(long pk,
297         java.util.List<com.liferay.portal.model.Group> groups)
298         throws com.liferay.portal.SystemException {
299         getPersistence().removeGroups(pk, groups);
300     }
301 
302     public static void setGroups(long pk, long[] groupPKs)
303         throws com.liferay.portal.SystemException {
304         getPersistence().setGroups(pk, groupPKs);
305     }
306 
307     public static void setGroups(long pk,
308         java.util.List<com.liferay.portal.model.Group> groups)
309         throws com.liferay.portal.SystemException {
310         getPersistence().setGroups(pk, groups);
311     }
312 
313     public static java.util.List<com.liferay.portal.model.Role> getRoles(
314         long pk) throws com.liferay.portal.SystemException {
315         return getPersistence().getRoles(pk);
316     }
317 
318     public static java.util.List<com.liferay.portal.model.Role> getRoles(
319         long pk, int start, int end) throws com.liferay.portal.SystemException {
320         return getPersistence().getRoles(pk, start, end);
321     }
322 
323     public static java.util.List<com.liferay.portal.model.Role> getRoles(
324         long pk, int start, int end,
325         com.liferay.portal.kernel.util.OrderByComparator obc)
326         throws com.liferay.portal.SystemException {
327         return getPersistence().getRoles(pk, start, end, obc);
328     }
329 
330     public static int getRolesSize(long pk)
331         throws com.liferay.portal.SystemException {
332         return getPersistence().getRolesSize(pk);
333     }
334 
335     public static boolean containsRole(long pk, long rolePK)
336         throws com.liferay.portal.SystemException {
337         return getPersistence().containsRole(pk, rolePK);
338     }
339 
340     public static boolean containsRoles(long pk)
341         throws com.liferay.portal.SystemException {
342         return getPersistence().containsRoles(pk);
343     }
344 
345     public static void addRole(long pk, long rolePK)
346         throws com.liferay.portal.SystemException {
347         getPersistence().addRole(pk, rolePK);
348     }
349 
350     public static void addRole(long pk, com.liferay.portal.model.Role role)
351         throws com.liferay.portal.SystemException {
352         getPersistence().addRole(pk, role);
353     }
354 
355     public static void addRoles(long pk, long[] rolePKs)
356         throws com.liferay.portal.SystemException {
357         getPersistence().addRoles(pk, rolePKs);
358     }
359 
360     public static void addRoles(long pk,
361         java.util.List<com.liferay.portal.model.Role> roles)
362         throws com.liferay.portal.SystemException {
363         getPersistence().addRoles(pk, roles);
364     }
365 
366     public static void clearRoles(long pk)
367         throws com.liferay.portal.SystemException {
368         getPersistence().clearRoles(pk);
369     }
370 
371     public static void removeRole(long pk, long rolePK)
372         throws com.liferay.portal.SystemException {
373         getPersistence().removeRole(pk, rolePK);
374     }
375 
376     public static void removeRole(long pk, com.liferay.portal.model.Role role)
377         throws com.liferay.portal.SystemException {
378         getPersistence().removeRole(pk, role);
379     }
380 
381     public static void removeRoles(long pk, long[] rolePKs)
382         throws com.liferay.portal.SystemException {
383         getPersistence().removeRoles(pk, rolePKs);
384     }
385 
386     public static void removeRoles(long pk,
387         java.util.List<com.liferay.portal.model.Role> roles)
388         throws com.liferay.portal.SystemException {
389         getPersistence().removeRoles(pk, roles);
390     }
391 
392     public static void setRoles(long pk, long[] rolePKs)
393         throws com.liferay.portal.SystemException {
394         getPersistence().setRoles(pk, rolePKs);
395     }
396 
397     public static void setRoles(long pk,
398         java.util.List<com.liferay.portal.model.Role> roles)
399         throws com.liferay.portal.SystemException {
400         getPersistence().setRoles(pk, roles);
401     }
402 
403     public static java.util.List<com.liferay.portal.model.User> getUsers(
404         long pk) throws com.liferay.portal.SystemException {
405         return getPersistence().getUsers(pk);
406     }
407 
408     public static java.util.List<com.liferay.portal.model.User> getUsers(
409         long pk, int start, int end) throws com.liferay.portal.SystemException {
410         return getPersistence().getUsers(pk, start, end);
411     }
412 
413     public static java.util.List<com.liferay.portal.model.User> getUsers(
414         long pk, int start, int end,
415         com.liferay.portal.kernel.util.OrderByComparator obc)
416         throws com.liferay.portal.SystemException {
417         return getPersistence().getUsers(pk, start, end, obc);
418     }
419 
420     public static int getUsersSize(long pk)
421         throws com.liferay.portal.SystemException {
422         return getPersistence().getUsersSize(pk);
423     }
424 
425     public static boolean containsUser(long pk, long userPK)
426         throws com.liferay.portal.SystemException {
427         return getPersistence().containsUser(pk, userPK);
428     }
429 
430     public static boolean containsUsers(long pk)
431         throws com.liferay.portal.SystemException {
432         return getPersistence().containsUsers(pk);
433     }
434 
435     public static void addUser(long pk, long userPK)
436         throws com.liferay.portal.SystemException {
437         getPersistence().addUser(pk, userPK);
438     }
439 
440     public static void addUser(long pk, com.liferay.portal.model.User user)
441         throws com.liferay.portal.SystemException {
442         getPersistence().addUser(pk, user);
443     }
444 
445     public static void addUsers(long pk, long[] userPKs)
446         throws com.liferay.portal.SystemException {
447         getPersistence().addUsers(pk, userPKs);
448     }
449 
450     public static void addUsers(long pk,
451         java.util.List<com.liferay.portal.model.User> users)
452         throws com.liferay.portal.SystemException {
453         getPersistence().addUsers(pk, users);
454     }
455 
456     public static void clearUsers(long pk)
457         throws com.liferay.portal.SystemException {
458         getPersistence().clearUsers(pk);
459     }
460 
461     public static void removeUser(long pk, long userPK)
462         throws com.liferay.portal.SystemException {
463         getPersistence().removeUser(pk, userPK);
464     }
465 
466     public static void removeUser(long pk, com.liferay.portal.model.User user)
467         throws com.liferay.portal.SystemException {
468         getPersistence().removeUser(pk, user);
469     }
470 
471     public static void removeUsers(long pk, long[] userPKs)
472         throws com.liferay.portal.SystemException {
473         getPersistence().removeUsers(pk, userPKs);
474     }
475 
476     public static void removeUsers(long pk,
477         java.util.List<com.liferay.portal.model.User> users)
478         throws com.liferay.portal.SystemException {
479         getPersistence().removeUsers(pk, users);
480     }
481 
482     public static void setUsers(long pk, long[] userPKs)
483         throws com.liferay.portal.SystemException {
484         getPersistence().setUsers(pk, userPKs);
485     }
486 
487     public static void setUsers(long pk,
488         java.util.List<com.liferay.portal.model.User> users)
489         throws com.liferay.portal.SystemException {
490         getPersistence().setUsers(pk, users);
491     }
492 
493     public static PermissionPersistence getPersistence() {
494         return _persistence;
495     }
496 
497     public void setPersistence(PermissionPersistence persistence) {
498         _persistence = persistence;
499     }
500 
501     private static PermissionPersistence _persistence;
502 }