001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    
019    /**
020     * <p>
021     * This class provides static methods for the
022     * {@link PermissionService} bean. The static methods of
023     * this class calls the same methods of the bean instance. It's convenient to be
024     * able to just write one line to call a method on a bean instead of writing a
025     * lookup call and a method call.
026     * </p>
027     *
028     * @author    Brian Wing Shun Chan
029     * @see       PermissionService
030     * @generated
031     */
032    public class PermissionServiceUtil {
033            public static void checkPermission(long groupId, long resourceId)
034                    throws com.liferay.portal.kernel.exception.PortalException,
035                            com.liferay.portal.kernel.exception.SystemException {
036                    getService().checkPermission(groupId, resourceId);
037            }
038    
039            public static void checkPermission(long groupId, java.lang.String name,
040                    long primKey)
041                    throws com.liferay.portal.kernel.exception.PortalException,
042                            com.liferay.portal.kernel.exception.SystemException {
043                    getService().checkPermission(groupId, name, primKey);
044            }
045    
046            public static void checkPermission(long groupId, java.lang.String name,
047                    java.lang.String primKey)
048                    throws com.liferay.portal.kernel.exception.PortalException,
049                            com.liferay.portal.kernel.exception.SystemException {
050                    getService().checkPermission(groupId, name, primKey);
051            }
052    
053            public static boolean hasGroupPermission(long groupId,
054                    java.lang.String actionId, long resourceId)
055                    throws com.liferay.portal.kernel.exception.SystemException {
056                    return getService().hasGroupPermission(groupId, actionId, resourceId);
057            }
058    
059            public static boolean hasUserPermission(long userId,
060                    java.lang.String actionId, long resourceId)
061                    throws com.liferay.portal.kernel.exception.SystemException {
062                    return getService().hasUserPermission(userId, actionId, resourceId);
063            }
064    
065            public static boolean hasUserPermissions(long userId, long groupId,
066                    java.util.List<com.liferay.portal.model.Resource> resources,
067                    java.lang.String actionId,
068                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
069                    throws com.liferay.portal.kernel.exception.PortalException,
070                            com.liferay.portal.kernel.exception.SystemException {
071                    return getService()
072                                       .hasUserPermissions(userId, groupId, resources, actionId,
073                            permissionCheckerBag);
074            }
075    
076            public static void setGroupPermissions(long groupId,
077                    java.lang.String[] actionIds, long resourceId)
078                    throws com.liferay.portal.kernel.exception.PortalException,
079                            com.liferay.portal.kernel.exception.SystemException {
080                    getService().setGroupPermissions(groupId, actionIds, resourceId);
081            }
082    
083            public static void setGroupPermissions(java.lang.String className,
084                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
085                    long resourceId)
086                    throws com.liferay.portal.kernel.exception.PortalException,
087                            com.liferay.portal.kernel.exception.SystemException {
088                    getService()
089                            .setGroupPermissions(className, classPK, groupId, actionIds,
090                            resourceId);
091            }
092    
093            public static void setOrgGroupPermissions(long organizationId,
094                    long groupId, java.lang.String[] actionIds, long resourceId)
095                    throws com.liferay.portal.kernel.exception.PortalException,
096                            com.liferay.portal.kernel.exception.SystemException {
097                    getService()
098                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
099                            resourceId);
100            }
101    
102            public static void setRolePermission(long roleId, long groupId,
103                    java.lang.String name, int scope, java.lang.String primKey,
104                    java.lang.String actionId)
105                    throws com.liferay.portal.kernel.exception.PortalException,
106                            com.liferay.portal.kernel.exception.SystemException {
107                    getService()
108                            .setRolePermission(roleId, groupId, name, scope, primKey, actionId);
109            }
110    
111            public static void setRolePermissions(long roleId, long groupId,
112                    java.lang.String[] actionIds, long resourceId)
113                    throws com.liferay.portal.kernel.exception.PortalException,
114                            com.liferay.portal.kernel.exception.SystemException {
115                    getService().setRolePermissions(roleId, groupId, actionIds, resourceId);
116            }
117    
118            public static void setUserPermissions(long userId, long groupId,
119                    java.lang.String[] actionIds, long resourceId)
120                    throws com.liferay.portal.kernel.exception.PortalException,
121                            com.liferay.portal.kernel.exception.SystemException {
122                    getService().setUserPermissions(userId, groupId, actionIds, resourceId);
123            }
124    
125            public static void unsetRolePermission(long roleId, long groupId,
126                    long permissionId)
127                    throws com.liferay.portal.kernel.exception.PortalException,
128                            com.liferay.portal.kernel.exception.SystemException {
129                    getService().unsetRolePermission(roleId, groupId, permissionId);
130            }
131    
132            public static void unsetRolePermission(long roleId, long groupId,
133                    java.lang.String name, int scope, java.lang.String primKey,
134                    java.lang.String actionId)
135                    throws com.liferay.portal.kernel.exception.PortalException,
136                            com.liferay.portal.kernel.exception.SystemException {
137                    getService()
138                            .unsetRolePermission(roleId, groupId, name, scope, primKey, actionId);
139            }
140    
141            public static void unsetRolePermissions(long roleId, long groupId,
142                    java.lang.String name, int scope, java.lang.String actionId)
143                    throws com.liferay.portal.kernel.exception.PortalException,
144                            com.liferay.portal.kernel.exception.SystemException {
145                    getService().unsetRolePermissions(roleId, groupId, name, scope, actionId);
146            }
147    
148            public static void unsetUserPermissions(long userId, long groupId,
149                    java.lang.String[] actionIds, long resourceId)
150                    throws com.liferay.portal.kernel.exception.PortalException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    getService().unsetUserPermissions(userId, groupId, actionIds, resourceId);
153            }
154    
155            public static PermissionService getService() {
156                    if (_service == null) {
157                            _service = (PermissionService)PortalBeanLocatorUtil.locate(PermissionService.class.getName());
158                    }
159    
160                    return _service;
161            }
162    
163            public void setService(PermissionService service) {
164                    _service = service;
165            }
166    
167            private static PermissionService _service;
168    }