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