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