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