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 RoleService} 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       RoleService
030     * @generated
031     */
032    public class RoleServiceUtil {
033            public static com.liferay.portal.model.Role addRole(java.lang.String name,
034                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
035                    java.lang.String description, int type)
036                    throws com.liferay.portal.kernel.exception.PortalException,
037                            com.liferay.portal.kernel.exception.SystemException {
038                    return getService().addRole(name, titleMap, description, type);
039            }
040    
041            public static void addUserRoles(long userId, long[] roleIds)
042                    throws com.liferay.portal.kernel.exception.PortalException,
043                            com.liferay.portal.kernel.exception.SystemException {
044                    getService().addUserRoles(userId, roleIds);
045            }
046    
047            public static void deleteRole(long roleId)
048                    throws com.liferay.portal.kernel.exception.PortalException,
049                            com.liferay.portal.kernel.exception.SystemException {
050                    getService().deleteRole(roleId);
051            }
052    
053            public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
054                    long groupId)
055                    throws com.liferay.portal.kernel.exception.SystemException {
056                    return getService().getGroupRoles(groupId);
057            }
058    
059            public static com.liferay.portal.model.Role getRole(long roleId)
060                    throws com.liferay.portal.kernel.exception.PortalException,
061                            com.liferay.portal.kernel.exception.SystemException {
062                    return getService().getRole(roleId);
063            }
064    
065            public static com.liferay.portal.model.Role getRole(long companyId,
066                    java.lang.String name)
067                    throws com.liferay.portal.kernel.exception.PortalException,
068                            com.liferay.portal.kernel.exception.SystemException {
069                    return getService().getRole(companyId, name);
070            }
071    
072            public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
073                    long userId, long groupId)
074                    throws com.liferay.portal.kernel.exception.SystemException {
075                    return getService().getUserGroupGroupRoles(userId, groupId);
076            }
077    
078            public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
079                    long userId, long groupId)
080                    throws com.liferay.portal.kernel.exception.SystemException {
081                    return getService().getUserGroupRoles(userId, groupId);
082            }
083    
084            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
085                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    return getService().getUserRelatedRoles(userId, groups);
088            }
089    
090            public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
091                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
092                    return getService().getUserRoles(userId);
093            }
094    
095            public static boolean hasUserRole(long userId, long companyId,
096                    java.lang.String name, boolean inherited)
097                    throws com.liferay.portal.kernel.exception.PortalException,
098                            com.liferay.portal.kernel.exception.SystemException {
099                    return getService().hasUserRole(userId, companyId, name, inherited);
100            }
101    
102            public static boolean hasUserRoles(long userId, long companyId,
103                    java.lang.String[] names, boolean inherited)
104                    throws com.liferay.portal.kernel.exception.PortalException,
105                            com.liferay.portal.kernel.exception.SystemException {
106                    return getService().hasUserRoles(userId, companyId, names, inherited);
107            }
108    
109            public static void unsetUserRoles(long userId, long[] roleIds)
110                    throws com.liferay.portal.kernel.exception.PortalException,
111                            com.liferay.portal.kernel.exception.SystemException {
112                    getService().unsetUserRoles(userId, roleIds);
113            }
114    
115            public static com.liferay.portal.model.Role updateRole(long roleId,
116                    java.lang.String name,
117                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
118                    java.lang.String description, java.lang.String subtype)
119                    throws com.liferay.portal.kernel.exception.PortalException,
120                            com.liferay.portal.kernel.exception.SystemException {
121                    return getService()
122                                       .updateRole(roleId, name, titleMap, description, subtype);
123            }
124    
125            public static RoleService getService() {
126                    if (_service == null) {
127                            _service = (RoleService)PortalBeanLocatorUtil.locate(RoleService.class.getName());
128                    }
129    
130                    return _service;
131            }
132    
133            public void setService(RoleService service) {
134                    _service = service;
135            }
136    
137            private static RoleService _service;
138    }