001 /** 002 * Copyright (c) 2000-2011 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 /** 018 * <p> 019 * This class is a wrapper for {@link RoleService}. 020 * </p> 021 * 022 * @author Brian Wing Shun Chan 023 * @see RoleService 024 * @generated 025 */ 026 public class RoleServiceWrapper implements RoleService { 027 public RoleServiceWrapper(RoleService roleService) { 028 _roleService = roleService; 029 } 030 031 /** 032 * Adds a role. The user is reindexed after role is added. 033 * 034 * @param name the role's name 035 * @param titleMap the role's localized titles (optionally 036 <code>null</code>) 037 * @param descriptionMap the role's localized descriptions (optionally 038 <code>null</code>) 039 * @param type the role's type (optionally <code>0</code>) 040 * @return the role 041 * @throws PortalException if a user with the primary key could not be 042 found, if the user did not have permission to add roles, if the 043 class name or the role name were invalid, or if the role is a 044 duplicate 045 * @throws SystemException if a system exception occurred 046 */ 047 public com.liferay.portal.model.Role addRole(java.lang.String name, 048 java.util.Map<java.util.Locale, java.lang.String> titleMap, 049 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 050 int type) 051 throws com.liferay.portal.kernel.exception.PortalException, 052 com.liferay.portal.kernel.exception.SystemException { 053 return _roleService.addRole(name, titleMap, descriptionMap, type); 054 } 055 056 /** 057 * Adds the roles to the user. The user is reindexed after the roles are 058 * added. 059 * 060 * @param userId the primary key of the user 061 * @param roleIds the primary keys of the roles 062 * @throws PortalException if a user with the primary key could not be 063 found or if the user did not have permission to assign members 064 to one of the roles 065 * @throws SystemException if a system exception occurred 066 */ 067 public void addUserRoles(long userId, long[] roleIds) 068 throws com.liferay.portal.kernel.exception.PortalException, 069 com.liferay.portal.kernel.exception.SystemException { 070 _roleService.addUserRoles(userId, roleIds); 071 } 072 073 /** 074 * Deletes the role with the primary key and its associated permissions. 075 * 076 * @param roleId the primary key of the role 077 * @throws PortalException if the user did not have permission to delete 078 the role, if a role with the primary key could not be found, if 079 the role is a default system role, or if the role's resource 080 could not be found 081 * @throws SystemException if a system exception occurred 082 */ 083 public void deleteRole(long roleId) 084 throws com.liferay.portal.kernel.exception.PortalException, 085 com.liferay.portal.kernel.exception.SystemException { 086 _roleService.deleteRole(roleId); 087 } 088 089 /** 090 * Returns all the roles associated with the group. 091 * 092 * @param groupId the primary key of the group 093 * @return the roles associated with the group 094 * @throws SystemException if a system exception occurred 095 */ 096 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 097 long groupId) 098 throws com.liferay.portal.kernel.exception.SystemException { 099 return _roleService.getGroupRoles(groupId); 100 } 101 102 /** 103 * Returns the role with the primary key. 104 * 105 * @param roleId the primary key of the role 106 * @return the role with the primary key 107 * @throws PortalException if a role with the primary key could not be 108 found or if the user did not have permission to view the role 109 * @throws SystemException if a system exception occurred 110 */ 111 public com.liferay.portal.model.Role getRole(long roleId) 112 throws com.liferay.portal.kernel.exception.PortalException, 113 com.liferay.portal.kernel.exception.SystemException { 114 return _roleService.getRole(roleId); 115 } 116 117 /** 118 * Returns the role with the name in the company. 119 * 120 * <p> 121 * The method searches the system roles map first for default roles. If a 122 * role with the name is not found, then the method will query the 123 * database. 124 * </p> 125 * 126 * @param companyId the primary key of the company 127 * @param name the role's name 128 * @return the role with the name 129 * @throws PortalException if a role with the name could not be found in 130 the company or if the user did not have permission to view the 131 role 132 * @throws SystemException if a system exception occurred 133 */ 134 public com.liferay.portal.model.Role getRole(long companyId, 135 java.lang.String name) 136 throws com.liferay.portal.kernel.exception.PortalException, 137 com.liferay.portal.kernel.exception.SystemException { 138 return _roleService.getRole(companyId, name); 139 } 140 141 /** 142 * Returns all the user's roles within the user group. 143 * 144 * @param userId the primary key of the user 145 * @param groupId the primary key of the group 146 * @return the user's roles within the user group 147 * @throws SystemException if a system exception occurred 148 */ 149 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 150 long userId, long groupId) 151 throws com.liferay.portal.kernel.exception.SystemException { 152 return _roleService.getUserGroupGroupRoles(userId, groupId); 153 } 154 155 /** 156 * Returns all the user's roles within the user group. 157 * 158 * @param userId the primary key of the user 159 * @param groupId the primary key of the group 160 * @return the user's roles within the user group 161 * @throws SystemException if a system exception occurred 162 */ 163 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 164 long userId, long groupId) 165 throws com.liferay.portal.kernel.exception.SystemException { 166 return _roleService.getUserGroupRoles(userId, groupId); 167 } 168 169 /** 170 * Returns the union of all the user's roles within the groups. 171 * 172 * @param userId the primary key of the user 173 * @param groups the groups (optionally <code>null</code>) 174 * @return the union of all the user's roles within the groups 175 * @throws SystemException if a system exception occurred 176 */ 177 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 178 long userId, java.util.List<com.liferay.portal.model.Group> groups) 179 throws com.liferay.portal.kernel.exception.SystemException { 180 return _roleService.getUserRelatedRoles(userId, groups); 181 } 182 183 /** 184 * Returns all the roles associated with the user. 185 * 186 * @param userId the primary key of the user 187 * @return the roles associated with the user 188 * @throws SystemException if a system exception occurred 189 */ 190 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 191 long userId) throws com.liferay.portal.kernel.exception.SystemException { 192 return _roleService.getUserRoles(userId); 193 } 194 195 /** 196 * Returns <code>true</code> if the user is associated with the named 197 * regular role. 198 * 199 * @param userId the primary key of the user 200 * @param companyId the primary key of the company 201 * @param name the name of the role 202 * @param inherited whether to include the user's inherited roles in the 203 search 204 * @return <code>true</code> if the user is associated with the regular 205 role; <code>false</code> otherwise 206 * @throws PortalException if a role with the name could not be found in 207 the company or if a default user for the company could not be 208 found 209 * @throws SystemException if a system exception occurred 210 */ 211 public boolean hasUserRole(long userId, long companyId, 212 java.lang.String name, boolean inherited) 213 throws com.liferay.portal.kernel.exception.PortalException, 214 com.liferay.portal.kernel.exception.SystemException { 215 return _roleService.hasUserRole(userId, companyId, name, inherited); 216 } 217 218 /** 219 * Returns <code>true</code> if the user has any one of the named regular 220 * roles. 221 * 222 * @param userId the primary key of the user 223 * @param companyId the primary key of the company 224 * @param names the names of the roles 225 * @param inherited whether to include the user's inherited roles in the 226 search 227 * @return <code>true</code> if the user has any one of the regular roles; 228 <code>false</code> otherwise 229 * @throws PortalException if any one of the roles with the names could not 230 be found in the company or if the default user for the company 231 could not be found 232 * @throws SystemException if a system exception occurred 233 */ 234 public boolean hasUserRoles(long userId, long companyId, 235 java.lang.String[] names, boolean inherited) 236 throws com.liferay.portal.kernel.exception.PortalException, 237 com.liferay.portal.kernel.exception.SystemException { 238 return _roleService.hasUserRoles(userId, companyId, names, inherited); 239 } 240 241 /** 242 * Removes the matching roles associated with the user. The user is 243 * reindexed after the roles are removed. 244 * 245 * @param userId the primary key of the user 246 * @param roleIds the primary keys of the roles 247 * @throws PortalException if a user with the primary key could not be 248 found, if the user did not have permission to remove members 249 from a role, or if a role with any one of the primary keys could 250 not be found 251 * @throws SystemException if a system exception occurred 252 */ 253 public void unsetUserRoles(long userId, long[] roleIds) 254 throws com.liferay.portal.kernel.exception.PortalException, 255 com.liferay.portal.kernel.exception.SystemException { 256 _roleService.unsetUserRoles(userId, roleIds); 257 } 258 259 /** 260 * Updates the role with the primary key. 261 * 262 * @param roleId the primary key of the role 263 * @param name the role's new name 264 * @param titleMap the new localized titles (optionally <code>null</code>) 265 to replace those existing for the role 266 * @param descriptionMap the new localized descriptions (optionally 267 <code>null</code>) to replace those existing for the role 268 * @param subtype the role's new subtype (optionally <code>null</code>) 269 * @return the role with the primary key 270 * @throws PortalException if the user did not have permission to update 271 the role, if a role with the primary could not be found, or if 272 the role's name was invalid 273 * @throws SystemException if a system exception occurred 274 */ 275 public com.liferay.portal.model.Role updateRole(long roleId, 276 java.lang.String name, 277 java.util.Map<java.util.Locale, java.lang.String> titleMap, 278 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 279 java.lang.String subtype) 280 throws com.liferay.portal.kernel.exception.PortalException, 281 com.liferay.portal.kernel.exception.SystemException { 282 return _roleService.updateRole(roleId, name, titleMap, descriptionMap, 283 subtype); 284 } 285 286 public RoleService getWrappedRoleService() { 287 return _roleService; 288 } 289 290 public void setWrappedRoleService(RoleService roleService) { 291 _roleService = roleService; 292 } 293 294 private RoleService _roleService; 295 }