1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
13   */
14  
15  package com.liferay.portal.service;
16  
17  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
18  import com.liferay.portal.kernel.util.MethodCache;
19  import com.liferay.portal.kernel.util.ReferenceRegistry;
20  
21  /**
22   * <a href="PermissionServiceUtil.java.html"><b><i>View Source</i></b></a>
23   *
24   * <p>
25   * ServiceBuilder generated this class. Modifications in this class will be
26   * overwritten the next time is generated.
27   * </p>
28   *
29   * <p>
30   * This class provides static methods for the
31   * {@link PermissionService} bean. The static methods of
32   * this class calls the same methods of the bean instance. It's convenient to be
33   * able to just write one line to call a method on a bean instead of writing a
34   * lookup call and a method call.
35   * </p>
36   *
37   * @author    Brian Wing Shun Chan
38   * @see       PermissionService
39   * @generated
40   */
41  public class PermissionServiceUtil {
42      public static void checkPermission(long groupId, long resourceId)
43          throws com.liferay.portal.PortalException,
44              com.liferay.portal.SystemException {
45          getService().checkPermission(groupId, resourceId);
46      }
47  
48      public static void checkPermission(long groupId, java.lang.String name,
49          long primKey)
50          throws com.liferay.portal.PortalException,
51              com.liferay.portal.SystemException {
52          getService().checkPermission(groupId, name, primKey);
53      }
54  
55      public static void checkPermission(long groupId, java.lang.String name,
56          java.lang.String primKey)
57          throws com.liferay.portal.PortalException,
58              com.liferay.portal.SystemException {
59          getService().checkPermission(groupId, name, primKey);
60      }
61  
62      public static boolean hasGroupPermission(long groupId,
63          java.lang.String actionId, long resourceId)
64          throws com.liferay.portal.SystemException {
65          return getService().hasGroupPermission(groupId, actionId, resourceId);
66      }
67  
68      public static boolean hasUserPermission(long userId,
69          java.lang.String actionId, long resourceId)
70          throws com.liferay.portal.SystemException {
71          return getService().hasUserPermission(userId, actionId, resourceId);
72      }
73  
74      public static boolean hasUserPermissions(long userId, long groupId,
75          java.util.List<com.liferay.portal.model.Resource> resources,
76          java.lang.String actionId,
77          com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          return getService()
81                     .hasUserPermissions(userId, groupId, resources, actionId,
82              permissionCheckerBag);
83      }
84  
85      public static void setGroupPermissions(long groupId,
86          java.lang.String[] actionIds, long resourceId)
87          throws com.liferay.portal.PortalException,
88              com.liferay.portal.SystemException {
89          getService().setGroupPermissions(groupId, actionIds, resourceId);
90      }
91  
92      public static void setGroupPermissions(java.lang.String className,
93          java.lang.String classPK, long groupId, java.lang.String[] actionIds,
94          long resourceId)
95          throws com.liferay.portal.PortalException,
96              com.liferay.portal.SystemException {
97          getService()
98              .setGroupPermissions(className, classPK, groupId, actionIds,
99              resourceId);
100     }
101 
102     public static void setOrgGroupPermissions(long organizationId,
103         long groupId, java.lang.String[] actionIds, long resourceId)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException {
106         getService()
107             .setOrgGroupPermissions(organizationId, groupId, actionIds,
108             resourceId);
109     }
110 
111     public static void setRolePermission(long roleId, long groupId,
112         java.lang.String name, int scope, java.lang.String primKey,
113         java.lang.String actionId)
114         throws com.liferay.portal.PortalException,
115             com.liferay.portal.SystemException {
116         getService()
117             .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
118     }
119 
120     public static void setRolePermissions(long roleId, long groupId,
121         java.lang.String[] actionIds, long resourceId)
122         throws com.liferay.portal.PortalException,
123             com.liferay.portal.SystemException {
124         getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
125     }
126 
127     public static void setUserPermissions(long userId, long groupId,
128         java.lang.String[] actionIds, long resourceId)
129         throws com.liferay.portal.PortalException,
130             com.liferay.portal.SystemException {
131         getService().setUserPermissions(userId, groupId, actionIds, resourceId);
132     }
133 
134     public static void unsetRolePermission(long roleId, long groupId,
135         long permissionId)
136         throws com.liferay.portal.PortalException,
137             com.liferay.portal.SystemException {
138         getService().unsetRolePermission(roleId, groupId, permissionId);
139     }
140 
141     public static void unsetRolePermission(long roleId, long groupId,
142         java.lang.String name, int scope, java.lang.String primKey,
143         java.lang.String actionId)
144         throws com.liferay.portal.PortalException,
145             com.liferay.portal.SystemException {
146         getService()
147             .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
148     }
149 
150     public static void unsetRolePermissions(long roleId, long groupId,
151         java.lang.String name, int scope, java.lang.String actionId)
152         throws com.liferay.portal.PortalException,
153             com.liferay.portal.SystemException {
154         getService().unsetRolePermissions(roleId, groupId, name, scope, actionId);
155     }
156 
157     public static void unsetUserPermissions(long userId, long groupId,
158         java.lang.String[] actionIds, long resourceId)
159         throws com.liferay.portal.PortalException,
160             com.liferay.portal.SystemException {
161         getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
162     }
163 
164     public static PermissionService getService() {
165         if (_service == null) {
166             _service = (PermissionService)PortalBeanLocatorUtil.locate(PermissionService.class.getName());
167 
168             ReferenceRegistry.registerReference(PermissionServiceUtil.class,
169                 "_service");
170             MethodCache.remove(PermissionService.class);
171         }
172 
173         return _service;
174     }
175 
176     public void setService(PermissionService service) {
177         MethodCache.remove(PermissionService.class);
178 
179         _service = service;
180 
181         ReferenceRegistry.registerReference(PermissionServiceUtil.class,
182             "_service");
183         MethodCache.remove(PermissionService.class);
184     }
185 
186     private static PermissionService _service;
187 }