001 /** 002 * Copyright (c) 2000-2012 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 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 found 064 or if the user did not have permission to assign members to one 065 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 the 079 role, if a role with the primary key could not be found, if the 080 role is a default system role, or if the role's resource could 081 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 found 111 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 database. 126 * </p> 127 * 128 * @param companyId the primary key of the company 129 * @param name the role's name 130 * @return the role with the name 131 * @throws PortalException if a role with the name could not be found in the 132 company or if the user did not have permission to view the role 133 * @throws SystemException if a system exception occurred 134 */ 135 public com.liferay.portal.model.Role getRole(long companyId, 136 java.lang.String name) 137 throws com.liferay.portal.kernel.exception.PortalException, 138 com.liferay.portal.kernel.exception.SystemException { 139 return _roleService.getRole(companyId, name); 140 } 141 142 /** 143 * Returns all the user's roles within the user group. 144 * 145 * @param userId the primary key of the user 146 * @param groupId the primary key of the group 147 * @return the user's roles within the user group 148 * @throws PortalException if a portal exception occurred 149 * @throws SystemException if a system exception occurred 150 */ 151 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 152 long userId, long groupId) 153 throws com.liferay.portal.kernel.exception.PortalException, 154 com.liferay.portal.kernel.exception.SystemException { 155 return _roleService.getUserGroupGroupRoles(userId, groupId); 156 } 157 158 /** 159 * Returns all the user's roles within the user group. 160 * 161 * @param userId the primary key of the user 162 * @param groupId the primary key of the group 163 * @return the user's roles within the user group 164 * @throws PortalException if a portal exception occurred 165 * @throws SystemException if a system exception occurred 166 */ 167 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 168 long userId, long groupId) 169 throws com.liferay.portal.kernel.exception.PortalException, 170 com.liferay.portal.kernel.exception.SystemException { 171 return _roleService.getUserGroupRoles(userId, groupId); 172 } 173 174 /** 175 * Returns the union of all the user's roles within the groups. 176 * 177 * @param userId the primary key of the user 178 * @param groups the groups (optionally <code>null</code>) 179 * @return the union of all the user's roles within the groups 180 * @throws PortalException if a portal exception occurred 181 * @throws SystemException if a system exception occurred 182 */ 183 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 184 long userId, java.util.List<com.liferay.portal.model.Group> groups) 185 throws com.liferay.portal.kernel.exception.PortalException, 186 com.liferay.portal.kernel.exception.SystemException { 187 return _roleService.getUserRelatedRoles(userId, groups); 188 } 189 190 /** 191 * Returns all the roles associated with the user. 192 * 193 * @param userId the primary key of the user 194 * @return the roles associated with the user 195 * @throws PortalException if a portal exception occurred 196 * @throws SystemException if a system exception occurred 197 */ 198 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 199 long userId) 200 throws com.liferay.portal.kernel.exception.PortalException, 201 com.liferay.portal.kernel.exception.SystemException { 202 return _roleService.getUserRoles(userId); 203 } 204 205 /** 206 * Returns <code>true</code> if the user is associated with the named 207 * regular role. 208 * 209 * @param userId the primary key of the user 210 * @param companyId the primary key of the company 211 * @param name the name of the role 212 * @param inherited whether to include the user's inherited roles in the 213 search 214 * @return <code>true</code> if the user is associated with the regular 215 role; <code>false</code> otherwise 216 * @throws PortalException if a role with the name could not be found in the 217 company or if a default user for the company could not be found 218 * @throws SystemException if a system exception occurred 219 */ 220 public boolean hasUserRole(long userId, long companyId, 221 java.lang.String name, boolean inherited) 222 throws com.liferay.portal.kernel.exception.PortalException, 223 com.liferay.portal.kernel.exception.SystemException { 224 return _roleService.hasUserRole(userId, companyId, name, inherited); 225 } 226 227 /** 228 * Returns <code>true</code> if the user has any one of the named regular 229 * roles. 230 * 231 * @param userId the primary key of the user 232 * @param companyId the primary key of the company 233 * @param names the names of the roles 234 * @param inherited whether to include the user's inherited roles in the 235 search 236 * @return <code>true</code> if the user has any one of the regular roles; 237 <code>false</code> otherwise 238 * @throws PortalException if any one of the roles with the names could not 239 be found in the company or if the default user for the company 240 could not be found 241 * @throws SystemException if a system exception occurred 242 */ 243 public boolean hasUserRoles(long userId, long companyId, 244 java.lang.String[] names, boolean inherited) 245 throws com.liferay.portal.kernel.exception.PortalException, 246 com.liferay.portal.kernel.exception.SystemException { 247 return _roleService.hasUserRoles(userId, companyId, names, inherited); 248 } 249 250 /** 251 * Removes the matching roles associated with the user. The user is 252 * reindexed after the roles are removed. 253 * 254 * @param userId the primary key of the user 255 * @param roleIds the primary keys of the roles 256 * @throws PortalException if a user with the primary key could not be 257 found, if the user did not have permission to remove members from 258 a role, or if a role with any one of the primary keys could not 259 be found 260 * @throws SystemException if a system exception occurred 261 */ 262 public void unsetUserRoles(long userId, long[] roleIds) 263 throws com.liferay.portal.kernel.exception.PortalException, 264 com.liferay.portal.kernel.exception.SystemException { 265 _roleService.unsetUserRoles(userId, roleIds); 266 } 267 268 /** 269 * Updates the role with the primary key. 270 * 271 * @param roleId the primary key of the role 272 * @param name the role's new name 273 * @param titleMap the new localized titles (optionally <code>null</code>) 274 to replace those existing for the role 275 * @param descriptionMap the new localized descriptions (optionally 276 <code>null</code>) to replace those existing for the role 277 * @param subtype the role's new subtype (optionally <code>null</code>) 278 * @return the role with the primary key 279 * @throws PortalException if the user did not have permission to update the 280 role, if a role with the primary could not be found, or if the 281 role's name was invalid 282 * @throws SystemException if a system exception occurred 283 */ 284 public com.liferay.portal.model.Role updateRole(long roleId, 285 java.lang.String name, 286 java.util.Map<java.util.Locale, java.lang.String> titleMap, 287 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 288 java.lang.String subtype) 289 throws com.liferay.portal.kernel.exception.PortalException, 290 com.liferay.portal.kernel.exception.SystemException { 291 return _roleService.updateRole(roleId, name, titleMap, descriptionMap, 292 subtype); 293 } 294 295 /** 296 * @deprecated Renamed to {@link #getWrappedService} 297 */ 298 public RoleService getWrappedRoleService() { 299 return _roleService; 300 } 301 302 /** 303 * @deprecated Renamed to {@link #setWrappedService} 304 */ 305 public void setWrappedRoleService(RoleService roleService) { 306 _roleService = roleService; 307 } 308 309 public RoleService getWrappedService() { 310 return _roleService; 311 } 312 313 public void setWrappedService(RoleService roleService) { 314 _roleService = roleService; 315 } 316 317 private RoleService _roleService; 318 }