001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the role remote service. This utility wraps {@link com.liferay.portal.service.impl.RoleServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
023     *
024     * <p>
025     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see RoleService
030     * @see com.liferay.portal.service.base.RoleServiceBaseImpl
031     * @see com.liferay.portal.service.impl.RoleServiceImpl
032     * @generated
033     */
034    public class RoleServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.RoleServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040            public static com.liferay.portal.model.Role addRole(java.lang.String name,
041                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
042                    java.lang.String description, int type)
043                    throws com.liferay.portal.kernel.exception.PortalException,
044                            com.liferay.portal.kernel.exception.SystemException {
045                    return getService().addRole(name, titleMap, description, type);
046            }
047    
048            public static void addUserRoles(long userId, long[] roleIds)
049                    throws com.liferay.portal.kernel.exception.PortalException,
050                            com.liferay.portal.kernel.exception.SystemException {
051                    getService().addUserRoles(userId, roleIds);
052            }
053    
054            public static void deleteRole(long roleId)
055                    throws com.liferay.portal.kernel.exception.PortalException,
056                            com.liferay.portal.kernel.exception.SystemException {
057                    getService().deleteRole(roleId);
058            }
059    
060            public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
061                    long groupId)
062                    throws com.liferay.portal.kernel.exception.SystemException {
063                    return getService().getGroupRoles(groupId);
064            }
065    
066            public static com.liferay.portal.model.Role getRole(long roleId)
067                    throws com.liferay.portal.kernel.exception.PortalException,
068                            com.liferay.portal.kernel.exception.SystemException {
069                    return getService().getRole(roleId);
070            }
071    
072            public static com.liferay.portal.model.Role getRole(long companyId,
073                    java.lang.String name)
074                    throws com.liferay.portal.kernel.exception.PortalException,
075                            com.liferay.portal.kernel.exception.SystemException {
076                    return getService().getRole(companyId, name);
077            }
078    
079            public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
080                    long userId, long groupId)
081                    throws com.liferay.portal.kernel.exception.SystemException {
082                    return getService().getUserGroupGroupRoles(userId, groupId);
083            }
084    
085            public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
086                    long userId, long groupId)
087                    throws com.liferay.portal.kernel.exception.SystemException {
088                    return getService().getUserGroupRoles(userId, groupId);
089            }
090    
091            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
092                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
093                    throws com.liferay.portal.kernel.exception.SystemException {
094                    return getService().getUserRelatedRoles(userId, groups);
095            }
096    
097            public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
098                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
099                    return getService().getUserRoles(userId);
100            }
101    
102            public static boolean hasUserRole(long userId, long companyId,
103                    java.lang.String name, boolean inherited)
104                    throws com.liferay.portal.kernel.exception.PortalException,
105                            com.liferay.portal.kernel.exception.SystemException {
106                    return getService().hasUserRole(userId, companyId, name, inherited);
107            }
108    
109            public static boolean hasUserRoles(long userId, long companyId,
110                    java.lang.String[] names, boolean inherited)
111                    throws com.liferay.portal.kernel.exception.PortalException,
112                            com.liferay.portal.kernel.exception.SystemException {
113                    return getService().hasUserRoles(userId, companyId, names, inherited);
114            }
115    
116            public static void unsetUserRoles(long userId, long[] roleIds)
117                    throws com.liferay.portal.kernel.exception.PortalException,
118                            com.liferay.portal.kernel.exception.SystemException {
119                    getService().unsetUserRoles(userId, roleIds);
120            }
121    
122            public static com.liferay.portal.model.Role updateRole(long roleId,
123                    java.lang.String name,
124                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
125                    java.lang.String description, java.lang.String subtype)
126                    throws com.liferay.portal.kernel.exception.PortalException,
127                            com.liferay.portal.kernel.exception.SystemException {
128                    return getService()
129                                       .updateRole(roleId, name, titleMap, description, subtype);
130            }
131    
132            public static RoleService getService() {
133                    if (_service == null) {
134                            _service = (RoleService)PortalBeanLocatorUtil.locate(RoleService.class.getName());
135    
136                            ReferenceRegistry.registerReference(RoleServiceUtil.class,
137                                    "_service");
138                            MethodCache.remove(RoleService.class);
139                    }
140    
141                    return _service;
142            }
143    
144            public void setService(RoleService service) {
145                    MethodCache.remove(RoleService.class);
146    
147                    _service = service;
148    
149                    ReferenceRegistry.registerReference(RoleServiceUtil.class, "_service");
150                    MethodCache.remove(RoleService.class);
151            }
152    
153            private static RoleService _service;
154    }