001 /** 002 * Copyright (c) 2000-2013 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 aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.jsonwebservice.JSONWebService; 022 import com.liferay.portal.kernel.transaction.Isolation; 023 import com.liferay.portal.kernel.transaction.Propagation; 024 import com.liferay.portal.kernel.transaction.Transactional; 025 import com.liferay.portal.security.ac.AccessControlled; 026 027 /** 028 * Provides the remote service interface for Role. Methods of this 029 * service are expected to have security checks based on the propagated JAAS 030 * credentials because this service can be accessed remotely. 031 * 032 * @author Brian Wing Shun Chan 033 * @see RoleServiceUtil 034 * @see com.liferay.portal.service.base.RoleServiceBaseImpl 035 * @see com.liferay.portal.service.impl.RoleServiceImpl 036 * @generated 037 */ 038 @ProviderType 039 @AccessControlled 040 @JSONWebService 041 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 042 PortalException.class, SystemException.class}) 043 public interface RoleService extends BaseService { 044 /* 045 * NOTE FOR DEVELOPERS: 046 * 047 * Never modify or reference this interface directly. Always use {@link RoleServiceUtil} to access the role remote service. Add custom service methods to {@link com.liferay.portal.service.impl.RoleServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 048 */ 049 050 /** 051 * Returns the Spring bean ID for this bean. 052 * 053 * @return the Spring bean ID for this bean 054 */ 055 public java.lang.String getBeanIdentifier(); 056 057 /** 058 * Sets the Spring bean ID for this bean. 059 * 060 * @param beanIdentifier the Spring bean ID for this bean 061 */ 062 public void setBeanIdentifier(java.lang.String beanIdentifier); 063 064 /** 065 * Adds a role. The user is reindexed after role is added. 066 * 067 * @param className the name of the class for which the role is created 068 * @param classPK the primary key of the class for which the role is 069 created (optionally <code>0</code>) 070 * @param name the role's name 071 * @param titleMap the role's localized titles (optionally 072 <code>null</code>) 073 * @param descriptionMap the role's localized descriptions (optionally 074 <code>null</code>) 075 * @param type the role's type (optionally <code>0</code>) 076 * @param subtype the role's subtype (optionally <code>null</code>) 077 * @param serviceContext the service context to be applied (optionally 078 <code>null</code>). Can set the expando bridge attributes for the 079 role. 080 * @return the role 081 * @throws PortalException if a user with the primary key could not be 082 found, if the user did not have permission to add roles, if the 083 class name or the role name were invalid, or if the role is a 084 duplicate 085 * @throws SystemException if a system exception occurred 086 */ 087 public com.liferay.portal.model.Role addRole(java.lang.String className, 088 long classPK, java.lang.String name, 089 java.util.Map<java.util.Locale, java.lang.String> titleMap, 090 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 091 int type, java.lang.String subtype, 092 com.liferay.portal.service.ServiceContext serviceContext) 093 throws com.liferay.portal.kernel.exception.PortalException, 094 com.liferay.portal.kernel.exception.SystemException; 095 096 /** 097 * Adds a role. The user is reindexed after role is added. 098 * 099 * @param name the role's name 100 * @param titleMap the role's localized titles (optionally 101 <code>null</code>) 102 * @param descriptionMap the role's localized descriptions (optionally 103 <code>null</code>) 104 * @param type the role's type (optionally <code>0</code>) 105 * @return the role 106 * @throws PortalException if a user with the primary key could not be 107 found, if the user did not have permission to add roles, if 108 the class name or the role name were invalid, or if the role 109 is a duplicate 110 * @throws SystemException if a system exception occurred 111 * @deprecated As of 6.2.0, replaced by {@link #addRole(String, long, 112 String, Map, Map, int, String, ServiceContext)} 113 */ 114 public com.liferay.portal.model.Role addRole(java.lang.String name, 115 java.util.Map<java.util.Locale, java.lang.String> titleMap, 116 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 117 int type) 118 throws com.liferay.portal.kernel.exception.PortalException, 119 com.liferay.portal.kernel.exception.SystemException; 120 121 /** 122 * Adds the roles to the user. The user is reindexed after the roles are 123 * added. 124 * 125 * @param userId the primary key of the user 126 * @param roleIds the primary keys of the roles 127 * @throws PortalException if a user with the primary key could not be found 128 or if the user did not have permission to assign members to one 129 of the roles 130 * @throws SystemException if a system exception occurred 131 */ 132 public void addUserRoles(long userId, long[] roleIds) 133 throws com.liferay.portal.kernel.exception.PortalException, 134 com.liferay.portal.kernel.exception.SystemException; 135 136 /** 137 * Deletes the role with the primary key and its associated permissions. 138 * 139 * @param roleId the primary key of the role 140 * @throws PortalException if the user did not have permission to delete the 141 role, if a role with the primary key could not be found, if the 142 role is a default system role, or if the role's resource could 143 not be found 144 * @throws SystemException if a system exception occurred 145 */ 146 public void deleteRole(long roleId) 147 throws com.liferay.portal.kernel.exception.PortalException, 148 com.liferay.portal.kernel.exception.SystemException; 149 150 /** 151 * Returns all the roles associated with the group. 152 * 153 * @param groupId the primary key of the group 154 * @return the roles associated with the group 155 * @throws PortalException if a portal exception occurred 156 * @throws SystemException if a system exception occurred 157 */ 158 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 159 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 160 long groupId) 161 throws com.liferay.portal.kernel.exception.PortalException, 162 com.liferay.portal.kernel.exception.SystemException; 163 164 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 165 public java.util.List<com.liferay.portal.model.Role> getGroupRolesAndTeamRoles( 166 long companyId, java.lang.String keywords, 167 java.util.List<java.lang.String> excludedNames, int[] types, 168 long excludedTeamRoleId, long teamGroupId, int start, int end) 169 throws com.liferay.portal.kernel.exception.SystemException; 170 171 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 172 public int getGroupRolesAndTeamRolesCount(long companyId, 173 java.lang.String keywords, 174 java.util.List<java.lang.String> excludedNames, int[] types, 175 long excludedTeamRoleId, long teamGroupId) 176 throws com.liferay.portal.kernel.exception.SystemException; 177 178 /** 179 * Returns the role with the primary key. 180 * 181 * @param roleId the primary key of the role 182 * @return the role with the primary key 183 * @throws PortalException if a role with the primary key could not be found 184 or if the user did not have permission to view the role 185 * @throws SystemException if a system exception occurred 186 */ 187 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 188 public com.liferay.portal.model.Role getRole(long roleId) 189 throws com.liferay.portal.kernel.exception.PortalException, 190 com.liferay.portal.kernel.exception.SystemException; 191 192 /** 193 * Returns the role with the name in the company. 194 * 195 * <p> 196 * The method searches the system roles map first for default roles. If a 197 * role with the name is not found, then the method will query the database. 198 * </p> 199 * 200 * @param companyId the primary key of the company 201 * @param name the role's name 202 * @return the role with the name 203 * @throws PortalException if a role with the name could not be found in the 204 company or if the user did not have permission to view the role 205 * @throws SystemException if a system exception occurred 206 */ 207 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 208 public com.liferay.portal.model.Role getRole(long companyId, 209 java.lang.String name) 210 throws com.liferay.portal.kernel.exception.PortalException, 211 com.liferay.portal.kernel.exception.SystemException; 212 213 /** 214 * Returns all the user's roles within the user group. 215 * 216 * @param userId the primary key of the user 217 * @param groupId the primary key of the group 218 * @return the user's roles within the user group 219 * @throws PortalException if a portal exception occurred 220 * @throws SystemException if a system exception occurred 221 */ 222 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 223 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 224 long userId, long groupId) 225 throws com.liferay.portal.kernel.exception.PortalException, 226 com.liferay.portal.kernel.exception.SystemException; 227 228 /** 229 * Returns all the user's roles within the user group. 230 * 231 * @param userId the primary key of the user 232 * @param groupId the primary key of the group 233 * @return the user's roles within the user group 234 * @throws PortalException if a portal exception occurred 235 * @throws SystemException if a system exception occurred 236 */ 237 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 238 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 239 long userId, long groupId) 240 throws com.liferay.portal.kernel.exception.PortalException, 241 com.liferay.portal.kernel.exception.SystemException; 242 243 /** 244 * Returns the union of all the user's roles within the groups. 245 * 246 * @param userId the primary key of the user 247 * @param groups the groups (optionally <code>null</code>) 248 * @return the union of all the user's roles within the groups 249 * @throws PortalException if a portal exception occurred 250 * @throws SystemException if a system exception occurred 251 */ 252 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 253 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 254 long userId, java.util.List<com.liferay.portal.model.Group> groups) 255 throws com.liferay.portal.kernel.exception.PortalException, 256 com.liferay.portal.kernel.exception.SystemException; 257 258 /** 259 * Returns all the roles associated with the user. 260 * 261 * @param userId the primary key of the user 262 * @return the roles associated with the user 263 * @throws PortalException if a portal exception occurred 264 * @throws SystemException if a system exception occurred 265 */ 266 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 267 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 268 long userId) 269 throws com.liferay.portal.kernel.exception.PortalException, 270 com.liferay.portal.kernel.exception.SystemException; 271 272 /** 273 * Returns <code>true</code> if the user is associated with the named 274 * regular role. 275 * 276 * @param userId the primary key of the user 277 * @param companyId the primary key of the company 278 * @param name the name of the role 279 * @param inherited whether to include the user's inherited roles in the 280 search 281 * @return <code>true</code> if the user is associated with the regular 282 role; <code>false</code> otherwise 283 * @throws PortalException if a role with the name could not be found in the 284 company or if a default user for the company could not be found 285 * @throws SystemException if a system exception occurred 286 */ 287 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 288 public boolean hasUserRole(long userId, long companyId, 289 java.lang.String name, boolean inherited) 290 throws com.liferay.portal.kernel.exception.PortalException, 291 com.liferay.portal.kernel.exception.SystemException; 292 293 /** 294 * Returns <code>true</code> if the user has any one of the named regular 295 * roles. 296 * 297 * @param userId the primary key of the user 298 * @param companyId the primary key of the company 299 * @param names the names of the roles 300 * @param inherited whether to include the user's inherited roles in the 301 search 302 * @return <code>true</code> if the user has any one of the regular roles; 303 <code>false</code> otherwise 304 * @throws PortalException if any one of the roles with the names could not 305 be found in the company or if the default user for the company 306 could not be found 307 * @throws SystemException if a system exception occurred 308 */ 309 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 310 public boolean hasUserRoles(long userId, long companyId, 311 java.lang.String[] names, boolean inherited) 312 throws com.liferay.portal.kernel.exception.PortalException, 313 com.liferay.portal.kernel.exception.SystemException; 314 315 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 316 public java.util.List<com.liferay.portal.model.Role> search( 317 long companyId, java.lang.String keywords, java.lang.Integer[] types, 318 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 319 int start, int end, 320 com.liferay.portal.kernel.util.OrderByComparator obc) 321 throws com.liferay.portal.kernel.exception.SystemException; 322 323 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 324 public int searchCount(long companyId, java.lang.String keywords, 325 java.lang.Integer[] types, 326 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 327 throws com.liferay.portal.kernel.exception.SystemException; 328 329 /** 330 * Removes the matching roles associated with the user. The user is 331 * reindexed after the roles are removed. 332 * 333 * @param userId the primary key of the user 334 * @param roleIds the primary keys of the roles 335 * @throws PortalException if a user with the primary key could not be 336 found, if the user did not have permission to remove members from 337 a role, or if a role with any one of the primary keys could not 338 be found 339 * @throws SystemException if a system exception occurred 340 */ 341 public void unsetUserRoles(long userId, long[] roleIds) 342 throws com.liferay.portal.kernel.exception.PortalException, 343 com.liferay.portal.kernel.exception.SystemException; 344 345 /** 346 * Updates the role with the primary key. 347 * 348 * @param roleId the primary key of the role 349 * @param name the role's new name 350 * @param titleMap the new localized titles (optionally <code>null</code>) 351 to replace those existing for the role 352 * @param descriptionMap the new localized descriptions (optionally 353 <code>null</code>) to replace those existing for the role 354 * @param subtype the role's new subtype (optionally <code>null</code>) 355 * @param serviceContext the service context to be applied (optionally 356 <code>null</code>). Can set the expando bridge attributes for the 357 role. 358 * @return the role with the primary key 359 * @throws PortalException if the user did not have permission to update the 360 role, if a role with the primary could not be found, or if the 361 role's name was invalid 362 * @throws SystemException if a system exception occurred 363 */ 364 public com.liferay.portal.model.Role updateRole(long roleId, 365 java.lang.String name, 366 java.util.Map<java.util.Locale, java.lang.String> titleMap, 367 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 368 java.lang.String subtype, 369 com.liferay.portal.service.ServiceContext serviceContext) 370 throws com.liferay.portal.kernel.exception.PortalException, 371 com.liferay.portal.kernel.exception.SystemException; 372 }