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