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