001 /** 002 * Copyright (c) 2000-present 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 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.search.IndexableType; 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.model.SystemEventConstants; 026 027 /** 028 * Provides the local service interface for Role. Methods of this 029 * service will not have security checks based on the propagated JAAS 030 * credentials because this service can only be accessed from within the same 031 * VM. 032 * 033 * @author Brian Wing Shun Chan 034 * @see RoleLocalServiceUtil 035 * @see com.liferay.portal.service.base.RoleLocalServiceBaseImpl 036 * @see com.liferay.portal.service.impl.RoleLocalServiceImpl 037 * @generated 038 */ 039 @ProviderType 040 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 041 PortalException.class, SystemException.class}) 042 public interface RoleLocalService extends BaseLocalService, 043 PersistedModelLocalService { 044 /* 045 * NOTE FOR DEVELOPERS: 046 * 047 * Never modify or reference this interface directly. Always use {@link RoleLocalServiceUtil} to access the role local service. Add custom service methods to {@link com.liferay.portal.service.impl.RoleLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 048 */ 049 public void addGroupRole(long groupId, com.liferay.portal.model.Role role); 050 051 public void addGroupRole(long groupId, long roleId); 052 053 public void addGroupRoles(long groupId, 054 java.util.List<com.liferay.portal.model.Role> Roles); 055 056 public void addGroupRoles(long groupId, long[] roleIds); 057 058 /** 059 * Adds the role to the database. Also notifies the appropriate model listeners. 060 * 061 * @param role the role 062 * @return the role that was added 063 */ 064 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 065 public com.liferay.portal.model.Role addRole( 066 com.liferay.portal.model.Role role); 067 068 /** 069 * Adds a role with additional parameters. The user is reindexed after role 070 * is added. 071 * 072 * @param userId the primary key of the user 073 * @param className the name of the class for which the role is created 074 (optionally <code>null</code>) 075 * @param classPK the primary key of the class for which the role is 076 created (optionally <code>0</code>) 077 * @param name the role's name 078 * @param titleMap the role's localized titles (optionally 079 <code>null</code>) 080 * @param descriptionMap the role's localized descriptions (optionally 081 <code>null</code>) 082 * @param type the role's type (optionally <code>0</code>) 083 * @param subtype the role's subtype (optionally <code>null</code>) 084 * @param serviceContext the service context to be applied (optionally 085 <code>null</code>). Can set expando bridge attributes for the 086 role. 087 * @return the role 088 * @throws PortalException if the class name or the role name were invalid, 089 if the role is a duplicate, or if a user with the primary key 090 could not be found 091 */ 092 public com.liferay.portal.model.Role addRole(long userId, 093 java.lang.String className, long classPK, java.lang.String name, 094 java.util.Map<java.util.Locale, java.lang.String> titleMap, 095 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 096 int type, java.lang.String subtype, 097 com.liferay.portal.service.ServiceContext serviceContext) 098 throws com.liferay.portal.kernel.exception.PortalException; 099 100 /** 101 * Adds a role. The user is reindexed after role is added. 102 * 103 * @param userId the primary key of the user 104 * @param companyId the primary key of the company 105 * @param name the role's name 106 * @param titleMap the role's localized titles (optionally 107 <code>null</code>) 108 * @param descriptionMap the role's localized descriptions (optionally 109 <code>null</code>) 110 * @param type the role's type (optionally <code>0</code>) 111 * @return the role 112 * @throws PortalException if the class name or the role name were 113 invalid, if the role is a duplicate, or if a user with the 114 primary key could not be found 115 * @deprecated As of 6.2.0, replaced by {@link #addRole(long, String, long, 116 String, Map, Map, int, String, ServiceContext)} 117 */ 118 @java.lang.Deprecated 119 public com.liferay.portal.model.Role addRole(long userId, long companyId, 120 java.lang.String name, 121 java.util.Map<java.util.Locale, java.lang.String> titleMap, 122 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 123 int type) throws com.liferay.portal.kernel.exception.PortalException; 124 125 /** 126 * Adds a role with additional parameters. The user is reindexed after role 127 * is added. 128 * 129 * @param userId the primary key of the user 130 * @param companyId the primary key of the company 131 * @param name the role's name 132 * @param titleMap the role's localized titles (optionally 133 <code>null</code>) 134 * @param descriptionMap the role's localized descriptions (optionally 135 <code>null</code>) 136 * @param type the role's type (optionally <code>0</code>) 137 * @param className the name of the class for which the role is created 138 (optionally <code>null</code>) 139 * @param classPK the primary key of the class for which the role is 140 created (optionally <code>0</code>) 141 * @return the role 142 * @throws PortalException if the class name or the role name were 143 invalid, if the role is a duplicate, or if a user with the 144 primary key could not be found 145 * @deprecated As of 6.2.0, replaced by {@link #addRole(long, String, long, 146 String, Map, Map, int, String, ServiceContext)} 147 */ 148 @java.lang.Deprecated 149 public com.liferay.portal.model.Role addRole(long userId, long companyId, 150 java.lang.String name, 151 java.util.Map<java.util.Locale, java.lang.String> titleMap, 152 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 153 int type, java.lang.String className, long classPK) 154 throws com.liferay.portal.kernel.exception.PortalException; 155 156 public void addUserRole(long userId, com.liferay.portal.model.Role role); 157 158 public void addUserRole(long userId, long roleId); 159 160 /** 161 * @throws PortalException 162 */ 163 public void addUserRoles(long userId, 164 java.util.List<com.liferay.portal.model.Role> Roles) 165 throws com.liferay.portal.kernel.exception.PortalException; 166 167 /** 168 * @throws PortalException 169 */ 170 public void addUserRoles(long userId, long[] roleIds) 171 throws com.liferay.portal.kernel.exception.PortalException; 172 173 /** 174 * Checks to ensure that the system roles map has appropriate default roles 175 * in each company. 176 * 177 * @throws PortalException if the current user did not have permission to 178 set applicable permissions on a role 179 */ 180 public void checkSystemRoles() 181 throws com.liferay.portal.kernel.exception.PortalException; 182 183 /** 184 * Checks to ensure that the system roles map has appropriate default roles 185 * in the company. 186 * 187 * @param companyId the primary key of the company 188 * @throws PortalException if the current user did not have permission to 189 set applicable permissions on a role 190 */ 191 @com.liferay.portal.kernel.transaction.Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 192 public void checkSystemRoles(long companyId) 193 throws com.liferay.portal.kernel.exception.PortalException; 194 195 public void clearGroupRoles(long groupId); 196 197 public void clearUserRoles(long userId); 198 199 /** 200 * Creates a new role with the primary key. Does not add the role to the database. 201 * 202 * @param roleId the primary key for the new role 203 * @return the new role 204 */ 205 public com.liferay.portal.model.Role createRole(long roleId); 206 207 public void deleteGroupRole(long groupId, com.liferay.portal.model.Role role); 208 209 public void deleteGroupRole(long groupId, long roleId); 210 211 public void deleteGroupRoles(long groupId, 212 java.util.List<com.liferay.portal.model.Role> Roles); 213 214 public void deleteGroupRoles(long groupId, long[] roleIds); 215 216 /** 217 * @throws PortalException 218 */ 219 @Override 220 public com.liferay.portal.model.PersistedModel deletePersistedModel( 221 com.liferay.portal.model.PersistedModel persistedModel) 222 throws com.liferay.portal.kernel.exception.PortalException; 223 224 /** 225 * Deletes the role from the database. Also notifies the appropriate model listeners. 226 * 227 * @param role the role 228 * @return the role that was removed 229 * @throws PortalException 230 */ 231 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 232 @com.liferay.portal.kernel.systemevent.SystemEvent(action = SystemEventConstants.ACTION_SKIP, type = SystemEventConstants.TYPE_DELETE) 233 public com.liferay.portal.model.Role deleteRole( 234 com.liferay.portal.model.Role role) 235 throws com.liferay.portal.kernel.exception.PortalException; 236 237 /** 238 * Deletes the role with the primary key from the database. Also notifies the appropriate model listeners. 239 * 240 * @param roleId the primary key of the role 241 * @return the role that was removed 242 * @throws PortalException if a role with the primary key could not be found 243 */ 244 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 245 public com.liferay.portal.model.Role deleteRole(long roleId) 246 throws com.liferay.portal.kernel.exception.PortalException; 247 248 public void deleteUserRole(long userId, com.liferay.portal.model.Role role); 249 250 public void deleteUserRole(long userId, long roleId); 251 252 public void deleteUserRoles(long userId, 253 java.util.List<com.liferay.portal.model.Role> Roles); 254 255 public void deleteUserRoles(long userId, long[] roleIds); 256 257 public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); 258 259 /** 260 * Performs a dynamic query on the database and returns the matching rows. 261 * 262 * @param dynamicQuery the dynamic query 263 * @return the matching rows 264 */ 265 public <T> java.util.List<T> dynamicQuery( 266 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 267 268 /** 269 * Performs a dynamic query on the database and returns a range of the matching rows. 270 * 271 * <p> 272 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.RoleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 273 * </p> 274 * 275 * @param dynamicQuery the dynamic query 276 * @param start the lower bound of the range of model instances 277 * @param end the upper bound of the range of model instances (not inclusive) 278 * @return the range of matching rows 279 */ 280 public <T> java.util.List<T> dynamicQuery( 281 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 282 int end); 283 284 /** 285 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 286 * 287 * <p> 288 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.RoleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 289 * </p> 290 * 291 * @param dynamicQuery the dynamic query 292 * @param start the lower bound of the range of model instances 293 * @param end the upper bound of the range of model instances (not inclusive) 294 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 295 * @return the ordered range of matching rows 296 */ 297 public <T> java.util.List<T> dynamicQuery( 298 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 299 int end, 300 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator); 301 302 /** 303 * Returns the number of rows matching the dynamic query. 304 * 305 * @param dynamicQuery the dynamic query 306 * @return the number of rows matching the dynamic query 307 */ 308 public long dynamicQueryCount( 309 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 310 311 /** 312 * Returns the number of rows matching the dynamic query. 313 * 314 * @param dynamicQuery the dynamic query 315 * @param projection the projection to apply to the query 316 * @return the number of rows matching the dynamic query 317 */ 318 public long dynamicQueryCount( 319 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 320 com.liferay.portal.kernel.dao.orm.Projection projection); 321 322 /** 323 * Returns the role with the name in the company. 324 * 325 * <p> 326 * The method searches the system roles map first for default roles. If a 327 * role with the name is not found, then the method will query the database. 328 * </p> 329 * 330 * @param companyId the primary key of the company 331 * @param name the role's name 332 * @return Returns the role with the name or <code>null</code> if a role 333 with the name could not be found in the company 334 */ 335 @com.liferay.portal.kernel.spring.aop.Skip 336 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 337 public com.liferay.portal.model.Role fetchRole(long companyId, 338 java.lang.String name); 339 340 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 341 public com.liferay.portal.model.Role fetchRole(long roleId); 342 343 /** 344 * Returns the role with the matching UUID and company. 345 * 346 * @param uuid the role's UUID 347 * @param companyId the primary key of the company 348 * @return the matching role, or <code>null</code> if a matching role could not be found 349 */ 350 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 351 public com.liferay.portal.model.Role fetchRoleByUuidAndCompanyId( 352 java.lang.String uuid, long companyId); 353 354 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 355 public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(); 356 357 /** 358 * Returns the Spring bean ID for this bean. 359 * 360 * @return the Spring bean ID for this bean 361 */ 362 public java.lang.String getBeanIdentifier(); 363 364 /** 365 * Returns the default role for the group with the primary key. 366 * 367 * <p> 368 * If the group is a site, then the default role is {@link 369 * com.liferay.portal.model.RoleConstants#SITE_MEMBER}. If the group is an 370 * organization, then the default role is {@link 371 * com.liferay.portal.model.RoleConstants#ORGANIZATION_USER}. If the group 372 * is a user or user group, then the default role is {@link 373 * com.liferay.portal.model.RoleConstants#POWER_USER}. For all other group 374 * types, the default role is {@link 375 * com.liferay.portal.model.RoleConstants#USER}. 376 * </p> 377 * 378 * @param groupId the primary key of the group 379 * @return the default role for the group with the primary key 380 * @throws PortalException if a group with the primary key could not be 381 found, or if a default role could not be found for the group 382 */ 383 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 384 public com.liferay.portal.model.Role getDefaultGroupRole(long groupId) 385 throws com.liferay.portal.kernel.exception.PortalException; 386 387 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 388 public com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery getExportActionableDynamicQuery( 389 com.liferay.portal.kernel.lar.PortletDataContext portletDataContext); 390 391 /** 392 * Returns the groupIds of the groups associated with the role. 393 * 394 * @param roleId the roleId of the role 395 * @return long[] the groupIds of groups associated with the role 396 */ 397 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 398 public long[] getGroupPrimaryKeys(long roleId); 399 400 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 401 public java.util.List<com.liferay.portal.model.Role> getGroupRelatedRoles( 402 long groupId) 403 throws com.liferay.portal.kernel.exception.PortalException; 404 405 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 406 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 407 long groupId); 408 409 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 410 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 411 long groupId, int start, int end); 412 413 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 414 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 415 long groupId, int start, int end, 416 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> orderByComparator); 417 418 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 419 public int getGroupRolesCount(long groupId); 420 421 @Override 422 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 423 public com.liferay.portal.model.PersistedModel getPersistedModel( 424 java.io.Serializable primaryKeyObj) 425 throws com.liferay.portal.kernel.exception.PortalException; 426 427 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 428 public java.util.List<com.liferay.portal.model.Role> getResourceBlockRoles( 429 long resourceBlockId, java.lang.String className, 430 java.lang.String actionId); 431 432 /** 433 * Returns a map of role names to associated action IDs for the named 434 * resource in the company within the permission scope. 435 * 436 * @param companyId the primary key of the company 437 * @param name the resource name 438 * @param scope the permission scope 439 * @param primKey the primary key of the resource's class 440 * @return the role names and action IDs 441 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P( 442 long, String, int, String) 443 */ 444 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 445 public java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles( 446 long companyId, java.lang.String name, int scope, 447 java.lang.String primKey); 448 449 /** 450 * Returns all the roles associated with the action ID in the company within 451 * the permission scope. 452 * 453 * @param companyId the primary key of the company 454 * @param name the resource name 455 * @param scope the permission scope 456 * @param primKey the primary key of the resource's class 457 * @param actionId the name of the resource action 458 * @return the roles 459 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P_A( 460 long, String, int, String, String) 461 */ 462 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 463 public java.util.List<com.liferay.portal.model.Role> getResourceRoles( 464 long companyId, java.lang.String name, int scope, 465 java.lang.String primKey, java.lang.String actionId); 466 467 /** 468 * Returns the role with the name in the company. 469 * 470 * <p> 471 * The method searches the system roles map first for default roles. If a 472 * role with the name is not found, then the method will query the database. 473 * </p> 474 * 475 * @param companyId the primary key of the company 476 * @param name the role's name 477 * @return the role with the name 478 * @throws PortalException if a role with the name could not be found in the 479 company 480 */ 481 @com.liferay.portal.kernel.spring.aop.Skip 482 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 483 public com.liferay.portal.model.Role getRole(long companyId, 484 java.lang.String name) 485 throws com.liferay.portal.kernel.exception.PortalException; 486 487 /** 488 * Returns the role with the primary key. 489 * 490 * @param roleId the primary key of the role 491 * @return the role 492 * @throws PortalException if a role with the primary key could not be found 493 */ 494 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 495 public com.liferay.portal.model.Role getRole(long roleId) 496 throws com.liferay.portal.kernel.exception.PortalException; 497 498 /** 499 * Returns the role with the matching UUID and company. 500 * 501 * @param uuid the role's UUID 502 * @param companyId the primary key of the company 503 * @return the matching role 504 * @throws PortalException if a matching role could not be found 505 */ 506 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 507 public com.liferay.portal.model.Role getRoleByUuidAndCompanyId( 508 java.lang.String uuid, long companyId) 509 throws com.liferay.portal.kernel.exception.PortalException; 510 511 /** 512 * Returns all the roles in the company. 513 * 514 * @param companyId the primary key of the company 515 * @return the roles in the company 516 */ 517 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 518 public java.util.List<com.liferay.portal.model.Role> getRoles( 519 long companyId); 520 521 /** 522 * Returns all the roles with the types. 523 * 524 * @param companyId the primary key of the company 525 * @param types the role types (optionally <code>null</code>) 526 * @return the roles with the types 527 */ 528 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 529 public java.util.List<com.liferay.portal.model.Role> getRoles( 530 long companyId, int[] types); 531 532 /** 533 * Returns all the roles with the primary keys. 534 * 535 * @param roleIds the primary keys of the roles 536 * @return the roles with the primary keys 537 * @throws PortalException if any one of the roles with the primary keys 538 could not be found 539 */ 540 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 541 public java.util.List<com.liferay.portal.model.Role> getRoles( 542 long[] roleIds) 543 throws com.liferay.portal.kernel.exception.PortalException; 544 545 /** 546 * Returns a range of all the roles. 547 * 548 * <p> 549 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.RoleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 550 * </p> 551 * 552 * @param start the lower bound of the range of roles 553 * @param end the upper bound of the range of roles (not inclusive) 554 * @return the range of roles 555 */ 556 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 557 public java.util.List<com.liferay.portal.model.Role> getRoles(int start, 558 int end); 559 560 /** 561 * Returns all the roles of the type and subtype. 562 * 563 * @param type the role's type (optionally <code>0</code>) 564 * @param subtype the role's subtype (optionally <code>null</code>) 565 * @return the roles of the type and subtype 566 */ 567 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 568 public java.util.List<com.liferay.portal.model.Role> getRoles(int type, 569 java.lang.String subtype); 570 571 /** 572 * Returns the number of roles. 573 * 574 * @return the number of roles 575 */ 576 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 577 public int getRolesCount(); 578 579 /** 580 * Returns all the roles of the subtype. 581 * 582 * @param subtype the role's subtype (optionally <code>null</code>) 583 * @return the roles of the subtype 584 */ 585 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 586 public java.util.List<com.liferay.portal.model.Role> getSubtypeRoles( 587 java.lang.String subtype); 588 589 /** 590 * Returns the number of roles of the subtype. 591 * 592 * @param subtype the role's subtype (optionally <code>null</code>) 593 * @return the number of roles of the subtype 594 */ 595 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 596 public int getSubtypeRolesCount(java.lang.String subtype); 597 598 /** 599 * Returns the team role in the company. 600 * 601 * @param companyId the primary key of the company 602 * @param teamId the primary key of the team 603 * @return the team role in the company 604 * @throws PortalException if a role could not be found in the team and 605 company 606 */ 607 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 608 public com.liferay.portal.model.Role getTeamRole(long companyId, long teamId) 609 throws com.liferay.portal.kernel.exception.PortalException; 610 611 /** 612 * Returns the team role map for the group. 613 * 614 * @param groupId the primary key of the group 615 * @return the team role map for the group 616 * @throws PortalException if a group with the primary key could not be 617 found, if a role could not be found in one of the group's teams, 618 or if a portal exception occurred 619 */ 620 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 621 public java.util.Map<com.liferay.portal.model.Team, com.liferay.portal.model.Role> getTeamRoleMap( 622 long groupId) 623 throws com.liferay.portal.kernel.exception.PortalException; 624 625 /** 626 * Returns the team roles in the group. 627 * 628 * @param groupId the primary key of the group 629 * @return the team roles in the group 630 * @throws PortalException if a group with the primary key could not be 631 found, if a role could not be found in one of the group's teams, 632 or if a portal exception occurred 633 */ 634 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 635 public java.util.List<com.liferay.portal.model.Role> getTeamRoles( 636 long groupId) 637 throws com.liferay.portal.kernel.exception.PortalException; 638 639 /** 640 * Returns the team roles in the group, excluding the specified role IDs. 641 * 642 * @param groupId the primary key of the group 643 * @param excludedRoleIds the primary keys of the roles to exclude 644 (optionally <code>null</code>) 645 * @return the team roles in the group, excluding the specified role IDs 646 * @throws PortalException if a group with the primary key could not be 647 found, if a role could not be found in one of the group's teams, 648 or if a portal exception occurred 649 */ 650 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 651 public java.util.List<com.liferay.portal.model.Role> getTeamRoles( 652 long groupId, long[] excludedRoleIds) 653 throws com.liferay.portal.kernel.exception.PortalException; 654 655 /** 656 * Returns all the roles of the type. 657 * 658 * @param type the role's type (optionally <code>0</code>) 659 * @return the range of the roles of the type 660 */ 661 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 662 public java.util.List<com.liferay.portal.model.Role> getTypeRoles(int type); 663 664 /** 665 * Returns a range of all the roles of the type. 666 * 667 * @param type the role's type (optionally <code>0</code>) 668 * @param start the lower bound of the range of roles to return 669 * @param end the upper bound of the range of roles to return (not 670 inclusive) 671 * @return the range of the roles of the type 672 */ 673 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 674 public java.util.List<com.liferay.portal.model.Role> getTypeRoles( 675 int type, int start, int end); 676 677 /** 678 * Returns the number of roles of the type. 679 * 680 * @param type the role's type (optionally <code>0</code>) 681 * @return the number of roles of the type 682 */ 683 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 684 public int getTypeRolesCount(int type); 685 686 /** 687 * Returns all the user's roles within the user group. 688 * 689 * @param userId the primary key of the user 690 * @param groupId the primary key of the group 691 * @return the user's roles within the user group 692 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupGroupRole( 693 long, long) 694 */ 695 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 696 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 697 long userId, long groupId); 698 699 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 700 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 701 long userId, long groupId, int start, int end); 702 703 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 704 public int getUserGroupGroupRolesCount(long userId, long groupId); 705 706 /** 707 * Returns all the user's roles within the user group. 708 * 709 * @param userId the primary key of the user 710 * @param groupId the primary key of the group 711 * @return the user's roles within the user group 712 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupRole( 713 long, long) 714 */ 715 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 716 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 717 long userId, long groupId); 718 719 /** 720 * Returns the userIds of the users associated with the role. 721 * 722 * @param roleId the roleId of the role 723 * @return long[] the userIds of users associated with the role 724 */ 725 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 726 public long[] getUserPrimaryKeys(long roleId); 727 728 /** 729 * Returns all the user's roles within the group. 730 * 731 * @param userId the primary key of the user 732 * @param groupId the primary key of the group 733 * @return the user's roles within the group 734 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 735 long) 736 */ 737 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 738 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 739 long userId, long groupId); 740 741 /** 742 * Returns the union of all the user's roles within the groups. 743 * 744 * @param userId the primary key of the user 745 * @param groupIds the primary keys of the groups 746 * @return the union of all the user's roles within the groups 747 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 748 long[]) 749 */ 750 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 751 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 752 long userId, long[] groupIds); 753 754 /** 755 * Returns the union of all the user's roles within the groups. 756 * 757 * @param userId the primary key of the user 758 * @param groups the groups (optionally <code>null</code>) 759 * @return the union of all the user's roles within the groups 760 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 761 List) 762 */ 763 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 764 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 765 long userId, java.util.List<com.liferay.portal.model.Group> groups); 766 767 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 768 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 769 long userId); 770 771 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 772 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 773 long userId, int start, int end); 774 775 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 776 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 777 long userId, int start, int end, 778 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> orderByComparator); 779 780 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 781 public int getUserRolesCount(long userId); 782 783 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 784 public boolean hasGroupRole(long groupId, long roleId); 785 786 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 787 public boolean hasGroupRoles(long groupId); 788 789 /** 790 * Returns <code>true</code> if the user is associated with the named 791 * regular role. 792 * 793 * @param userId the primary key of the user 794 * @param companyId the primary key of the company 795 * @param name the name of the role 796 * @param inherited whether to include the user's inherited roles in the 797 search 798 * @return <code>true</code> if the user is associated with the regular 799 role; <code>false</code> otherwise 800 * @throws PortalException if a default user for the company could not be 801 found 802 */ 803 @com.liferay.portal.kernel.cache.ThreadLocalCachable 804 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 805 public boolean hasUserRole(long userId, long companyId, 806 java.lang.String name, boolean inherited) 807 throws com.liferay.portal.kernel.exception.PortalException; 808 809 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 810 public boolean hasUserRole(long userId, long roleId); 811 812 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 813 public boolean hasUserRoles(long userId); 814 815 /** 816 * Returns <code>true</code> if the user has any one of the named regular 817 * roles. 818 * 819 * @param userId the primary key of the user 820 * @param companyId the primary key of the company 821 * @param names the names of the roles 822 * @param inherited whether to include the user's inherited roles in the 823 search 824 * @return <code>true</code> if the user has any one of the regular roles; 825 <code>false</code> otherwise 826 * @throws PortalException if any one of the roles with the names could not 827 be found in the company or if the default user for the company 828 could not be found 829 */ 830 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 831 public boolean hasUserRoles(long userId, long companyId, 832 java.lang.String[] names, boolean inherited) 833 throws com.liferay.portal.kernel.exception.PortalException; 834 835 /** 836 * Returns a role with the name in the company. 837 * 838 * @param companyId the primary key of the company 839 * @param name the role's name (optionally <code>null</code>) 840 * @return the role with the name, or <code>null</code> if a role with the 841 name could not be found in the company 842 */ 843 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 844 public com.liferay.portal.model.Role loadFetchRole(long companyId, 845 java.lang.String name); 846 847 /** 848 * Returns a role with the name in the company. 849 * 850 * @param companyId the primary key of the company 851 * @param name the role's name 852 * @return the role with the name in the company 853 * @throws PortalException if a role with the name could not be found in the 854 company 855 */ 856 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 857 public com.liferay.portal.model.Role loadGetRole(long companyId, 858 java.lang.String name) 859 throws com.liferay.portal.kernel.exception.PortalException; 860 861 /** 862 * Returns an ordered range of all the roles that match the keywords, types, 863 * and params. 864 * 865 * <p> 866 * Useful when paginating results. Returns a maximum of <code>end - 867 * start</code> instances. <code>start</code> and <code>end</code> are not 868 * primary keys, they are indexes in the result set. Thus, <code>0</code> 869 * refers to the first result in the set. Setting both <code>start</code> 870 * and <code>end</code> to {@link 871 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 872 * result set. 873 * </p> 874 * 875 * @param companyId the primary key of the company 876 * @param keywords the keywords (space separated), which may occur in the 877 role's name or description (optionally <code>null</code>) 878 * @param types the role types (optionally <code>null</code>) 879 * @param params the finder parameters. Can specify values for the 880 "usersRoles" key. For more information, see {@link 881 com.liferay.portal.service.persistence.RoleFinder} 882 * @param start the lower bound of the range of roles to return 883 * @param end the upper bound of the range of roles to return (not 884 inclusive) 885 * @param obc the comparator to order the roles (optionally 886 <code>null</code>) 887 * @return the ordered range of the matching roles, ordered by 888 <code>obc</code> 889 * @see com.liferay.portal.service.persistence.RoleFinder 890 */ 891 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 892 public java.util.List<com.liferay.portal.model.Role> search( 893 long companyId, java.lang.String keywords, java.lang.Integer[] types, 894 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 895 int start, int end, 896 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 897 898 /** 899 * Returns an ordered range of all the roles that match the keywords and 900 * types. 901 * 902 * <p> 903 * Useful when paginating results. Returns a maximum of <code>end - 904 * start</code> instances. <code>start</code> and <code>end</code> are not 905 * primary keys, they are indexes in the result set. Thus, <code>0</code> 906 * refers to the first result in the set. Setting both <code>start</code> 907 * and <code>end</code> to {@link 908 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 909 * result set. 910 * </p> 911 * 912 * @param companyId the primary key of the company 913 * @param keywords the keywords (space separated), which may occur in the 914 role's name or description (optionally <code>null</code>) 915 * @param types the role types (optionally <code>null</code>) 916 * @param start the lower bound of the range of roles to return 917 * @param end the upper bound of the range of roles to return (not 918 inclusive) 919 * @param obc the comparator to order the roles (optionally 920 <code>null</code>) 921 * @return the ordered range of the matching roles, ordered by 922 <code>obc</code> 923 * @see com.liferay.portal.service.persistence.RoleFinder 924 */ 925 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 926 public java.util.List<com.liferay.portal.model.Role> search( 927 long companyId, java.lang.String keywords, java.lang.Integer[] types, 928 int start, int end, 929 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 930 931 /** 932 * Returns an ordered range of all the roles that match the name, 933 * description, types, and params. 934 * 935 * <p> 936 * Useful when paginating results. Returns a maximum of <code>end - 937 * start</code> instances. <code>start</code> and <code>end</code> are not 938 * primary keys, they are indexes in the result set. Thus, <code>0</code> 939 * refers to the first result in the set. Setting both <code>start</code> 940 * and <code>end</code> to {@link 941 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 942 * result set. 943 * </p> 944 * 945 * @param companyId the primary key of the company 946 * @param name the role's name (optionally <code>null</code>) 947 * @param description the role's description (optionally <code>null</code>) 948 * @param types the role types (optionally <code>null</code>) 949 * @param params the finder's parameters. Can specify values for the 950 "usersRoles" key. For more information, see {@link 951 com.liferay.portal.service.persistence.RoleFinder} 952 * @param start the lower bound of the range of the roles to return 953 * @param end the upper bound of the range of the roles to return (not 954 inclusive) 955 * @param obc the comparator to order the roles (optionally 956 <code>null</code>) 957 * @return the ordered range of the matching roles, ordered by 958 <code>obc</code> 959 * @see com.liferay.portal.service.persistence.RoleFinder 960 */ 961 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 962 public java.util.List<com.liferay.portal.model.Role> search( 963 long companyId, java.lang.String name, java.lang.String description, 964 java.lang.Integer[] types, 965 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 966 int start, int end, 967 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 968 969 /** 970 * Returns an ordered range of all the roles that match the name, 971 * description, and types. 972 * 973 * <p> 974 * Useful when paginating results. Returns a maximum of <code>end - 975 * start</code> instances. <code>start</code> and <code>end</code> are not 976 * primary keys, they are indexes in the result set. Thus, <code>0</code> 977 * refers to the first result in the set. Setting both <code>start</code> 978 * and <code>end</code> to {@link 979 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 980 * result set. 981 * </p> 982 * 983 * @param companyId the primary key of the company 984 * @param name the role's name (optionally <code>null</code>) 985 * @param description the role's description (optionally <code>null</code>) 986 * @param types the role types (optionally <code>null</code>) 987 * @param start the lower bound of the range of the roles to return 988 * @param end the upper bound of the range of the roles to return (not 989 inclusive) 990 * @param obc the comparator to order the roles (optionally 991 <code>null</code>) 992 * @return the ordered range of the matching roles, ordered by 993 <code>obc</code> 994 * @see com.liferay.portal.service.persistence.RoleFinder 995 */ 996 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 997 public java.util.List<com.liferay.portal.model.Role> search( 998 long companyId, java.lang.String name, java.lang.String description, 999 java.lang.Integer[] types, int start, int end, 1000 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 1001 1002 /** 1003 * Returns the number of roles that match the keywords and types. 1004 * 1005 * @param companyId the primary key of the company 1006 * @param keywords the keywords (space separated), which may occur in the 1007 role's name or description (optionally <code>null</code>) 1008 * @param types the role types (optionally <code>null</code>) 1009 * @return the number of matching roles 1010 */ 1011 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1012 public int searchCount(long companyId, java.lang.String keywords, 1013 java.lang.Integer[] types); 1014 1015 /** 1016 * Returns the number of roles that match the keywords, types and params. 1017 * 1018 * @param companyId the primary key of the company 1019 * @param keywords the keywords (space separated), which may occur in the 1020 role's name or description (optionally <code>null</code>) 1021 * @param types the role types (optionally <code>null</code>) 1022 * @param params the finder parameters. For more information, see {@link 1023 com.liferay.portal.service.persistence.RoleFinder} 1024 * @return the number of matching roles 1025 */ 1026 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1027 public int searchCount(long companyId, java.lang.String keywords, 1028 java.lang.Integer[] types, 1029 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params); 1030 1031 /** 1032 * Returns the number of roles that match the name, description, and types. 1033 * 1034 * @param companyId the primary key of the company 1035 * @param name the role's name (optionally <code>null</code>) 1036 * @param description the role's description (optionally <code>null</code>) 1037 * @param types the role types (optionally <code>null</code>) 1038 * @return the number of matching roles 1039 */ 1040 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1041 public int searchCount(long companyId, java.lang.String name, 1042 java.lang.String description, java.lang.Integer[] types); 1043 1044 /** 1045 * Returns the number of roles that match the name, description, types, and 1046 * params. 1047 * 1048 * @param companyId the primary key of the company 1049 * @param name the role's name (optionally <code>null</code>) 1050 * @param description the role's description (optionally <code>null</code>) 1051 * @param types the role types (optionally <code>null</code>) 1052 * @param params the finder parameters. Can specify values for the 1053 "usersRoles" key. For more information, see {@link 1054 com.liferay.portal.service.persistence.RoleFinder} 1055 * @return the number of matching roles 1056 */ 1057 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1058 public int searchCount(long companyId, java.lang.String name, 1059 java.lang.String description, java.lang.Integer[] types, 1060 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params); 1061 1062 /** 1063 * Sets the Spring bean ID for this bean. 1064 * 1065 * @param beanIdentifier the Spring bean ID for this bean 1066 */ 1067 public void setBeanIdentifier(java.lang.String beanIdentifier); 1068 1069 public void setGroupRoles(long groupId, long[] roleIds); 1070 1071 /** 1072 * @throws PortalException 1073 */ 1074 public void setUserRoles(long userId, long[] roleIds) 1075 throws com.liferay.portal.kernel.exception.PortalException; 1076 1077 /** 1078 * Removes the matching roles associated with the user. The user is 1079 * reindexed after the roles are removed. 1080 * 1081 * @param userId the primary key of the user 1082 * @param roleIds the primary keys of the roles 1083 * @throws PortalException if a user with the primary key could not be found 1084 or if a role with any one of the primary keys could not be found 1085 */ 1086 public void unsetUserRoles(long userId, long[] roleIds) 1087 throws com.liferay.portal.kernel.exception.PortalException; 1088 1089 /** 1090 * Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 1091 * 1092 * @param role the role 1093 * @return the role that was updated 1094 */ 1095 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 1096 public com.liferay.portal.model.Role updateRole( 1097 com.liferay.portal.model.Role role); 1098 1099 /** 1100 * Updates the role with the primary key. 1101 * 1102 * @param roleId the primary key of the role 1103 * @param name the role's new name 1104 * @param titleMap the new localized titles (optionally <code>null</code>) 1105 to replace those existing for the role 1106 * @param descriptionMap the new localized descriptions (optionally 1107 <code>null</code>) to replace those existing for the role 1108 * @param subtype the role's new subtype (optionally <code>null</code>) 1109 * @param serviceContext the service context to be applied (optionally 1110 <code>null</code>). Can set expando bridge attributes for the 1111 role. 1112 * @return the role with the primary key 1113 * @throws PortalException if a role with the primary could not be found or 1114 if the role's name was invalid 1115 */ 1116 public com.liferay.portal.model.Role updateRole(long roleId, 1117 java.lang.String name, 1118 java.util.Map<java.util.Locale, java.lang.String> titleMap, 1119 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 1120 java.lang.String subtype, 1121 com.liferay.portal.service.ServiceContext serviceContext) 1122 throws com.liferay.portal.kernel.exception.PortalException; 1123 }