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 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 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 149 public com.liferay.portal.model.Role fetchRole(long roleId) 150 throws com.liferay.portal.kernel.exception.SystemException; 151 152 /** 153 * Returns the role with the primary key. 154 * 155 * @param roleId the primary key of the role 156 * @return the role 157 * @throws PortalException if a role with the primary key could not be found 158 * @throws SystemException if a system exception occurred 159 */ 160 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 161 public com.liferay.portal.model.Role getRole(long roleId) 162 throws com.liferay.portal.kernel.exception.PortalException, 163 com.liferay.portal.kernel.exception.SystemException; 164 165 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 166 public com.liferay.portal.model.PersistedModel getPersistedModel( 167 java.io.Serializable primaryKeyObj) 168 throws com.liferay.portal.kernel.exception.PortalException, 169 com.liferay.portal.kernel.exception.SystemException; 170 171 /** 172 * Returns a range of all the roles. 173 * 174 * <p> 175 * 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. 176 * </p> 177 * 178 * @param start the lower bound of the range of roles 179 * @param end the upper bound of the range of roles (not inclusive) 180 * @return the range of roles 181 * @throws SystemException if a system exception occurred 182 */ 183 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 184 public java.util.List<com.liferay.portal.model.Role> getRoles(int start, 185 int end) throws com.liferay.portal.kernel.exception.SystemException; 186 187 /** 188 * Returns the number of roles. 189 * 190 * @return the number of roles 191 * @throws SystemException if a system exception occurred 192 */ 193 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 194 public int getRolesCount() 195 throws com.liferay.portal.kernel.exception.SystemException; 196 197 /** 198 * Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 199 * 200 * @param role the role 201 * @return the role that was updated 202 * @throws SystemException if a system exception occurred 203 */ 204 public com.liferay.portal.model.Role updateRole( 205 com.liferay.portal.model.Role role) 206 throws com.liferay.portal.kernel.exception.SystemException; 207 208 /** 209 * Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 210 * 211 * @param role the role 212 * @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. 213 * @return the role that was updated 214 * @throws SystemException if a system exception occurred 215 */ 216 public com.liferay.portal.model.Role updateRole( 217 com.liferay.portal.model.Role role, boolean merge) 218 throws com.liferay.portal.kernel.exception.SystemException; 219 220 /** 221 * Returns the Spring bean ID for this bean. 222 * 223 * @return the Spring bean ID for this bean 224 */ 225 public java.lang.String getBeanIdentifier(); 226 227 /** 228 * Sets the Spring bean ID for this bean. 229 * 230 * @param beanIdentifier the Spring bean ID for this bean 231 */ 232 public void setBeanIdentifier(java.lang.String beanIdentifier); 233 234 /** 235 * Adds a role. The user is reindexed after role is added. 236 * 237 * @param userId the primary key of the user 238 * @param companyId the primary key of the company 239 * @param name the role's name 240 * @param titleMap the role's localized titles (optionally 241 <code>null</code>) 242 * @param descriptionMap the role's localized descriptions (optionally 243 <code>null</code>) 244 * @param type the role's type (optionally <code>0</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, long companyId, 252 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) 256 throws com.liferay.portal.kernel.exception.PortalException, 257 com.liferay.portal.kernel.exception.SystemException; 258 259 /** 260 * Adds a role with additional parameters. The user is reindexed after role 261 * is added. 262 * 263 * @param userId the primary key of the user 264 * @param companyId the primary key of the company 265 * @param name the role's name 266 * @param titleMap the role's localized titles (optionally 267 <code>null</code>) 268 * @param descriptionMap the role's localized descriptions (optionally 269 <code>null</code>) 270 * @param type the role's type (optionally <code>0</code>) 271 * @param className the name of the class for which the role is created 272 (optionally <code>null</code>) 273 * @param classPK the primary key of the class for which the role is 274 created (optionally <code>0</code>) 275 * @return the role 276 * @throws PortalException if the class name or the role name were invalid, 277 if the role is a duplicate, or if a user with the primary key 278 could not be found 279 * @throws SystemException if a system exception occurred 280 */ 281 public com.liferay.portal.model.Role addRole(long userId, long companyId, 282 java.lang.String name, 283 java.util.Map<java.util.Locale, java.lang.String> titleMap, 284 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 285 int type, java.lang.String className, long classPK) 286 throws com.liferay.portal.kernel.exception.PortalException, 287 com.liferay.portal.kernel.exception.SystemException; 288 289 /** 290 * Adds the roles to the user. The user is reindexed after the roles are 291 * added. 292 * 293 * @param userId the primary key of the user 294 * @param roleIds the primary keys of the roles 295 * @throws PortalException if a user with the primary key could not be found 296 * @throws SystemException if a system exception occurred 297 * @see com.liferay.portal.service.persistence.UserPersistence#addRoles( 298 long, long[]) 299 */ 300 public void addUserRoles(long userId, long[] roleIds) 301 throws com.liferay.portal.kernel.exception.PortalException, 302 com.liferay.portal.kernel.exception.SystemException; 303 304 /** 305 * Checks to ensure that the system roles map has appropriate default roles 306 * in each company. 307 * 308 * @throws PortalException if the current user did not have permission to 309 set applicable permissions on a role 310 * @throws SystemException if a system exception occurred 311 */ 312 public void checkSystemRoles() 313 throws com.liferay.portal.kernel.exception.PortalException, 314 com.liferay.portal.kernel.exception.SystemException; 315 316 /** 317 * Checks to ensure that the system roles map has appropriate default roles 318 * in the company. 319 * 320 * @param companyId the primary key of the company 321 * @throws PortalException if the current user did not have permission to 322 set applicable permissions on a role 323 * @throws SystemException if a system exception occurred 324 */ 325 public void checkSystemRoles(long companyId) 326 throws com.liferay.portal.kernel.exception.PortalException, 327 com.liferay.portal.kernel.exception.SystemException; 328 329 /** 330 * Returns the role with the name in the company. 331 * 332 * <p> 333 * The method searches the system roles map first for default roles. If a 334 * role with the name is not found, then the method will query the database. 335 * </p> 336 * 337 * @param companyId the primary key of the company 338 * @param name the role's name 339 * @return Returns the role with the name or <code>null</code> if a role 340 with the name could not be found in the company 341 * @throws SystemException if a system exception occurred 342 */ 343 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 344 public com.liferay.portal.model.Role fetchRole(long companyId, 345 java.lang.String name) 346 throws com.liferay.portal.kernel.exception.SystemException; 347 348 /** 349 * Returns the default role for the group with the primary key. 350 * 351 * <p> 352 * If the group is a site, then the default role is {@link 353 * com.liferay.portal.model.RoleConstants#SITE_MEMBER}. If the group is an 354 * organization, then the default role is {@link 355 * com.liferay.portal.model.RoleConstants#ORGANIZATION_USER}. If the group 356 * is a user or user group, then the default role is {@link 357 * com.liferay.portal.model.RoleConstants#POWER_USER}. For all other group 358 * types, the default role is {@link 359 * com.liferay.portal.model.RoleConstants#USER}. 360 * </p> 361 * 362 * @param groupId the primary key of the group 363 * @return the default role for the group with the primary key 364 * @throws PortalException if a group with the primary key could not be 365 found, or if a default role could not be found for the group 366 * @throws SystemException if a system exception occurred 367 */ 368 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 369 public com.liferay.portal.model.Role getDefaultGroupRole(long groupId) 370 throws com.liferay.portal.kernel.exception.PortalException, 371 com.liferay.portal.kernel.exception.SystemException; 372 373 /** 374 * Returns all the roles associated with the group. 375 * 376 * @param groupId the primary key of the group 377 * @return the roles associated with the group 378 * @throws SystemException if a system exception occurred 379 */ 380 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 381 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 382 long groupId) 383 throws com.liferay.portal.kernel.exception.SystemException; 384 385 /** 386 * Returns a map of role names to associated action IDs for the named 387 * resource in the company within the permission scope. 388 * 389 * @param companyId the primary key of the company 390 * @param name the resource name 391 * @param scope the permission scope 392 * @param primKey the primary key of the resource's class 393 * @return the role names and action IDs 394 * @throws SystemException if a system exception occurred 395 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P( 396 long, String, int, String) 397 */ 398 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 399 public java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles( 400 long companyId, java.lang.String name, int scope, 401 java.lang.String primKey) 402 throws com.liferay.portal.kernel.exception.SystemException; 403 404 /** 405 * Returns all the roles associated with the action ID in the company within 406 * the permission scope. 407 * 408 * @param companyId the primary key of the company 409 * @param name the resource name 410 * @param scope the permission scope 411 * @param primKey the primary key of the resource's class 412 * @param actionId the name of the resource action 413 * @return the roles 414 * @throws SystemException if a system exception occurred 415 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P_A( 416 long, String, int, String, String) 417 */ 418 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 419 public java.util.List<com.liferay.portal.model.Role> getResourceRoles( 420 long companyId, java.lang.String name, int scope, 421 java.lang.String primKey, java.lang.String actionId) 422 throws com.liferay.portal.kernel.exception.SystemException; 423 424 /** 425 * Returns the role with the name in the company. 426 * 427 * <p> 428 * The method searches the system roles map first for default roles. If a 429 * role with the name is not found, then the method will query the database. 430 * </p> 431 * 432 * @param companyId the primary key of the company 433 * @param name the role's name 434 * @return the role with the name 435 * @throws PortalException if a role with the name could not be found in the 436 company 437 * @throws SystemException if a system exception occurred 438 */ 439 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 440 public com.liferay.portal.model.Role getRole(long companyId, 441 java.lang.String name) 442 throws com.liferay.portal.kernel.exception.PortalException, 443 com.liferay.portal.kernel.exception.SystemException; 444 445 /** 446 * Returns all the roles of the type and subtype. 447 * 448 * @param type the role's type (optionally <code>0</code>) 449 * @param subtype the role's subtype (optionally <code>null</code>) 450 * @return the roles of the type and subtype 451 * @throws SystemException if a system exception occurred 452 */ 453 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 454 public java.util.List<com.liferay.portal.model.Role> getRoles(int type, 455 java.lang.String subtype) 456 throws com.liferay.portal.kernel.exception.SystemException; 457 458 /** 459 * Returns all the roles in the company. 460 * 461 * @param companyId the primary key of the company 462 * @return the roles in the company 463 * @throws SystemException if a system exception occurred 464 */ 465 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 466 public java.util.List<com.liferay.portal.model.Role> getRoles( 467 long companyId) 468 throws com.liferay.portal.kernel.exception.SystemException; 469 470 /** 471 * Returns all the roles with the primary keys. 472 * 473 * @param roleIds the primary keys of the roles 474 * @return the roles with the primary keys 475 * @throws PortalException if any one of the roles with the primary keys 476 could not be found 477 * @throws SystemException if a system exception occurred 478 */ 479 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 480 public java.util.List<com.liferay.portal.model.Role> getRoles( 481 long[] roleIds) 482 throws com.liferay.portal.kernel.exception.PortalException, 483 com.liferay.portal.kernel.exception.SystemException; 484 485 /** 486 * Returns all the roles of the subtype. 487 * 488 * @param subtype the role's subtype (optionally <code>null</code>) 489 * @return the roles of the subtype 490 * @throws SystemException if a system exception occurred 491 */ 492 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 493 public java.util.List<com.liferay.portal.model.Role> getSubtypeRoles( 494 java.lang.String subtype) 495 throws com.liferay.portal.kernel.exception.SystemException; 496 497 /** 498 * Returns the number of roles of the subtype. 499 * 500 * @param subtype the role's subtype (optionally <code>null</code>) 501 * @return the number of roles of the subtype 502 * @throws SystemException if a system exception occurred 503 */ 504 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 505 public int getSubtypeRolesCount(java.lang.String subtype) 506 throws com.liferay.portal.kernel.exception.SystemException; 507 508 /** 509 * Returns the team role in the company. 510 * 511 * @param companyId the primary key of the company 512 * @param teamId the primary key of the team 513 * @return the team role in the company 514 * @throws PortalException if a role could not be found in the team and 515 company 516 * @throws SystemException if a system exception occurred 517 */ 518 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 519 public com.liferay.portal.model.Role getTeamRole(long companyId, long teamId) 520 throws com.liferay.portal.kernel.exception.PortalException, 521 com.liferay.portal.kernel.exception.SystemException; 522 523 /** 524 * Returns all the user's roles within the user group. 525 * 526 * @param userId the primary key of the user 527 * @param groupId the primary key of the group 528 * @return the user's roles within the user group 529 * @throws SystemException if a system exception occurred 530 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupGroupRole( 531 long, long) 532 */ 533 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 534 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 535 long userId, long groupId) 536 throws com.liferay.portal.kernel.exception.SystemException; 537 538 /** 539 * Returns all the user's roles within the user group. 540 * 541 * @param userId the primary key of the user 542 * @param groupId the primary key of the group 543 * @return the user's roles within the user group 544 * @throws SystemException if a system exception occurred 545 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupRole( 546 long, long) 547 */ 548 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 549 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 550 long userId, long groupId) 551 throws com.liferay.portal.kernel.exception.SystemException; 552 553 /** 554 * Returns the union of all the user's roles within the groups. 555 * 556 * @param userId the primary key of the user 557 * @param groups the groups (optionally <code>null</code>) 558 * @return the union of all the user's roles within the groups 559 * @throws SystemException if a system exception occurred 560 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G( 561 long, List) 562 */ 563 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 564 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 565 long userId, java.util.List<com.liferay.portal.model.Group> groups) 566 throws com.liferay.portal.kernel.exception.SystemException; 567 568 /** 569 * Returns all the user's roles within the group. 570 * 571 * @param userId the primary key of the user 572 * @param groupId the primary key of the group 573 * @return the user's roles within the group 574 * @throws SystemException if a system exception occurred 575 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G( 576 long, long) 577 */ 578 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 579 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 580 long userId, long groupId) 581 throws com.liferay.portal.kernel.exception.SystemException; 582 583 /** 584 * Returns the union of all the user's roles within the groups. 585 * 586 * @param userId the primary key of the user 587 * @param groupIds the primary keys of the groups 588 * @return the union of all the user's roles within the groups 589 * @throws SystemException if a system exception occurred 590 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G( 591 long, long[]) 592 */ 593 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 594 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 595 long userId, long[] groupIds) 596 throws com.liferay.portal.kernel.exception.SystemException; 597 598 /** 599 * Returns all the roles associated with the user. 600 * 601 * @param userId the primary key of the user 602 * @return the roles associated with the user 603 * @throws SystemException if a system exception occurred 604 */ 605 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 606 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 607 long userId) throws com.liferay.portal.kernel.exception.SystemException; 608 609 /** 610 * Returns <code>true</code> if the user is associated with the role. 611 * 612 * @param userId the primary key of the user 613 * @param roleId the primary key of the role 614 * @return <code>true</code> if the user is associated with the role; 615 <code>false</code> otherwise 616 * @throws SystemException if a system exception occurred 617 */ 618 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 619 public boolean hasUserRole(long userId, long roleId) 620 throws com.liferay.portal.kernel.exception.SystemException; 621 622 /** 623 * Returns <code>true</code> if the user is associated with the named 624 * regular role. 625 * 626 * @param userId the primary key of the user 627 * @param companyId the primary key of the company 628 * @param name the name of the role 629 * @param inherited whether to include the user's inherited roles in the 630 search 631 * @return <code>true</code> if the user is associated with the regular 632 role; <code>false</code> otherwise 633 * @throws PortalException if a role with the name could not be found in the 634 company or if a default user for the company could not be 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 the 686 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 full 706 * 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, types, 731 * 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 full 740 * 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 full 779 * 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 <code>null</code>) 785 * @param types the role types (optionally <code>null</code>) 786 * @param start the lower bound of the range of the roles to return 787 * @param end the upper bound of the range of the roles to return (not 788 inclusive) 789 * @param obc the comparator to order the roles (optionally 790 <code>null</code>) 791 * @return the ordered range of the matching roles, ordered by 792 <code>obc</code> 793 * @throws SystemException if a system exception occurred 794 * @see com.liferay.portal.service.persistence.RoleFinder 795 */ 796 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 797 public java.util.List<com.liferay.portal.model.Role> search( 798 long companyId, java.lang.String name, java.lang.String description, 799 java.lang.Integer[] types, int start, int end, 800 com.liferay.portal.kernel.util.OrderByComparator obc) 801 throws com.liferay.portal.kernel.exception.SystemException; 802 803 /** 804 * Returns an ordered range of all the roles that match the name, 805 * description, types, and params. 806 * 807 * <p> 808 * Useful when paginating results. Returns a maximum of <code>end - 809 * start</code> instances. <code>start</code> and <code>end</code> are not 810 * primary keys, they are indexes in the result set. Thus, <code>0</code> 811 * refers to the first result in the set. Setting both <code>start</code> 812 * and <code>end</code> to {@link 813 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 814 * result set. 815 * </p> 816 * 817 * @param companyId the primary key of the company 818 * @param name the role's name (optionally <code>null</code>) 819 * @param description the role's description (optionally <code>null</code>) 820 * @param types the role types (optionally <code>null</code>) 821 * @param params the finder's parameters. Can specify values for 822 "permissionsResourceId" and "usersRoles" keys. For more 823 information, see {@link 824 com.liferay.portal.service.persistence.RoleFinder} 825 * @param start the lower bound of the range of the roles to return 826 * @param end the upper bound of the range of the roles to return (not 827 inclusive) 828 * @param obc the comparator to order the roles (optionally 829 <code>null</code>) 830 * @return the ordered range of the matching roles, ordered by 831 <code>obc</code> 832 * @throws SystemException if a system exception occurred 833 * @see com.liferay.portal.service.persistence.RoleFinder 834 */ 835 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 836 public java.util.List<com.liferay.portal.model.Role> search( 837 long companyId, java.lang.String name, java.lang.String description, 838 java.lang.Integer[] types, 839 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 840 int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) 841 throws com.liferay.portal.kernel.exception.SystemException; 842 843 /** 844 * Returns the number of roles that match the keywords and types. 845 * 846 * @param companyId the primary key of the company 847 * @param keywords the keywords (space separated), which may occur in the 848 role's name or description (optionally <code>null</code>) 849 * @param types the role types (optionally <code>null</code>) 850 * @return the number of matching roles 851 * @throws SystemException if a system exception occurred 852 */ 853 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 854 public int searchCount(long companyId, java.lang.String keywords, 855 java.lang.Integer[] types) 856 throws com.liferay.portal.kernel.exception.SystemException; 857 858 /** 859 * Returns the number of roles that match the keywords, types and params. 860 * 861 * @param companyId the primary key of the company 862 * @param keywords the keywords (space separated), which may occur in the 863 role's name or description (optionally <code>null</code>) 864 * @param types the role types (optionally <code>null</code>) 865 * @param params the finder parameters. For more information, see {@link 866 com.liferay.portal.service.persistence.RoleFinder} 867 * @return the number of matching roles 868 * @throws SystemException if a system exception occurred 869 */ 870 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 871 public int searchCount(long companyId, java.lang.String keywords, 872 java.lang.Integer[] types, 873 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 874 throws com.liferay.portal.kernel.exception.SystemException; 875 876 /** 877 * Returns the number of roles that match the name, description, and types. 878 * 879 * @param companyId the primary key of the company 880 * @param name the role's name (optionally <code>null</code>) 881 * @param description the role's description (optionally <code>null</code>) 882 * @param types the role types (optionally <code>null</code>) 883 * @return the number of matching roles 884 * @throws SystemException if a system exception occurred 885 */ 886 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 887 public int searchCount(long companyId, java.lang.String name, 888 java.lang.String description, java.lang.Integer[] types) 889 throws com.liferay.portal.kernel.exception.SystemException; 890 891 /** 892 * Returns the number of roles that match the name, description, types, and 893 * params. 894 * 895 * @param companyId the primary key of the company 896 * @param name the role's name (optionally <code>null</code>) 897 * @param description the role's description (optionally <code>null</code>) 898 * @param types the role types (optionally <code>null</code>) 899 * @param params the finder parameters. Can specify values for 900 "permissionsResourceId" and "usersRoles" keys. For more 901 information, see {@link 902 com.liferay.portal.service.persistence.RoleFinder} 903 * @return the number of matching roles 904 * @throws SystemException if a system exception occurred 905 */ 906 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 907 public int searchCount(long companyId, java.lang.String name, 908 java.lang.String description, java.lang.Integer[] types, 909 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 910 throws com.liferay.portal.kernel.exception.SystemException; 911 912 /** 913 * Sets the roles associated with the user, replacing the user's existing 914 * roles. The user is reindexed after the roles are set. 915 * 916 * @param userId the primary key of the user 917 * @param roleIds the primary keys of the roles 918 * @throws PortalException if a user with the primary could not be found or 919 if any one of the roles with the primary keys could not be found 920 * @throws SystemException if a system exception occurred 921 */ 922 public void setUserRoles(long userId, long[] roleIds) 923 throws com.liferay.portal.kernel.exception.PortalException, 924 com.liferay.portal.kernel.exception.SystemException; 925 926 /** 927 * Removes the matching roles associated with the user. The user is 928 * reindexed after the roles are removed. 929 * 930 * @param userId the primary key of the user 931 * @param roleIds the primary keys of the roles 932 * @throws PortalException if a user with the primary key could not be found 933 or if a role with any one of the primary keys could not be found 934 * @throws SystemException if a system exception occurred 935 */ 936 public void unsetUserRoles(long userId, long[] roleIds) 937 throws com.liferay.portal.kernel.exception.PortalException, 938 com.liferay.portal.kernel.exception.SystemException; 939 940 /** 941 * Updates the role with the primary key. 942 * 943 * @param roleId the primary key of the role 944 * @param name the role's new name 945 * @param titleMap the new localized titles (optionally <code>null</code>) 946 to replace those existing for the role 947 * @param descriptionMap the new localized descriptions (optionally 948 <code>null</code>) to replace those existing for the role 949 * @param subtype the role's new subtype (optionally <code>null</code>) 950 * @return the role with the primary key 951 * @throws PortalException if a role with the primary could not be found or 952 if the role's name was invalid 953 * @throws SystemException if a system exception occurred 954 */ 955 public com.liferay.portal.model.Role updateRole(long roleId, 956 java.lang.String name, 957 java.util.Map<java.util.Locale, java.lang.String> titleMap, 958 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 959 java.lang.String subtype) 960 throws com.liferay.portal.kernel.exception.PortalException, 961 com.liferay.portal.kernel.exception.SystemException; 962 }