001 /** 002 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 013 */ 014 015 package com.liferay.portal.service; 016 017 import 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 247 were invalid, if the role is a duplicate, or if a user with the primary key could not be 248 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 277 were invalid, if the role is a duplicate, or if a user with the primary key could not be 278 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 296 found 297 * @throws SystemException if a system exception occurred 298 * @see com.liferay.portal.service.persistence.UserPersistence#addRoles( 299 long, long[]) 300 */ 301 public void addUserRoles(long userId, long[] roleIds) 302 throws com.liferay.portal.kernel.exception.PortalException, 303 com.liferay.portal.kernel.exception.SystemException; 304 305 /** 306 * Checks to ensure that the system roles map has appropriate default roles 307 * in each company. 308 * 309 * @throws PortalException if the current user did not have permission to 310 set applicable permissions on a role 311 * @throws SystemException if a system exception occurred 312 */ 313 public void checkSystemRoles() 314 throws com.liferay.portal.kernel.exception.PortalException, 315 com.liferay.portal.kernel.exception.SystemException; 316 317 /** 318 * Checks to ensure that the system roles map has appropriate default roles 319 * in the company. 320 * 321 * @param companyId the primary key of the company 322 * @throws PortalException if the current user did not have permission to 323 set applicable permissions on a role 324 * @throws SystemException if a system exception occurred 325 */ 326 public void checkSystemRoles(long companyId) 327 throws com.liferay.portal.kernel.exception.PortalException, 328 com.liferay.portal.kernel.exception.SystemException; 329 330 /** 331 * Returns the role with the name in the company. 332 * 333 * <p> 334 * The method searches the system roles map first for default roles. If a 335 * role with the name is not found, then the method will query the 336 * database. 337 * </p> 338 * 339 * @param companyId the primary key of the company 340 * @param name the role's name 341 * @return Returns the role with the name or <code>null</code> if a role 342 with the name could not be found in the company 343 * @throws SystemException if a system exception occurred 344 */ 345 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 346 public com.liferay.portal.model.Role fetchRole(long companyId, 347 java.lang.String name) 348 throws com.liferay.portal.kernel.exception.SystemException; 349 350 /** 351 * Returns the default role for the group with the primary key. 352 * 353 * <p> 354 * If the group is a site, then the default role is {@link 355 * com.liferay.portal.model.RoleConstants#SITE_MEMBER}. If the group is an 356 * organization, then the default role is {@link 357 * com.liferay.portal.model.RoleConstants#ORGANIZATION_USER}. If the group 358 * is a user or user group, then the default role is {@link 359 * com.liferay.portal.model.RoleConstants#POWER_USER}. For all other group 360 * types, the default role is {@link 361 * com.liferay.portal.model.RoleConstants#USER}. 362 * </p> 363 * 364 * @param groupId the primary key of the group 365 * @return the default role for the group with the primary key 366 * @throws PortalException if a group with the primary key could not be 367 found, or if a default role could not be found for the group 368 * @throws SystemException if a system exception occurred 369 */ 370 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 371 public com.liferay.portal.model.Role getDefaultGroupRole(long groupId) 372 throws com.liferay.portal.kernel.exception.PortalException, 373 com.liferay.portal.kernel.exception.SystemException; 374 375 /** 376 * Returns all the roles associated with the group. 377 * 378 * @param groupId the primary key of the group 379 * @return the roles associated with the group 380 * @throws SystemException if a system exception occurred 381 */ 382 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 383 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 384 long groupId) 385 throws com.liferay.portal.kernel.exception.SystemException; 386 387 /** 388 * Returns a map of role names to associated action IDs for the named 389 * resource in the company within the permission scope. 390 * 391 * @param companyId the primary key of the company 392 * @param name the resource name 393 * @param scope the permission scope 394 * @param primKey the primary key of the resource's class 395 * @return the role names and action IDs 396 * @throws SystemException if a system exception occurred 397 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P( 398 long, String, int, String) 399 */ 400 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 401 public java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles( 402 long companyId, java.lang.String name, int scope, 403 java.lang.String primKey) 404 throws com.liferay.portal.kernel.exception.SystemException; 405 406 /** 407 * Returns all the roles associated with the action ID in the company 408 * within the permission scope. 409 * 410 * @param companyId the primary key of the company 411 * @param name the resource name 412 * @param scope the permission scope 413 * @param primKey the primary key of the resource's class 414 * @param actionId the name of the resource action 415 * @return the roles 416 * @throws SystemException if a system exception occurred 417 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P_A( 418 long, String, int, String, String) 419 */ 420 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 421 public java.util.List<com.liferay.portal.model.Role> getResourceRoles( 422 long companyId, java.lang.String name, int scope, 423 java.lang.String primKey, java.lang.String actionId) 424 throws com.liferay.portal.kernel.exception.SystemException; 425 426 /** 427 * Returns the role with the name in the company. 428 * 429 * <p> 430 * The method searches the system roles map first for default roles. If a 431 * role with the name is not found, then the method will query the 432 * database. 433 * </p> 434 * 435 * @param companyId the primary key of the company 436 * @param name the role's name 437 * @return the role with the name 438 * @throws PortalException if a role with the name could not be found in 439 the company 440 * @throws SystemException if a system exception occurred 441 */ 442 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 443 public com.liferay.portal.model.Role getRole(long companyId, 444 java.lang.String name) 445 throws com.liferay.portal.kernel.exception.PortalException, 446 com.liferay.portal.kernel.exception.SystemException; 447 448 /** 449 * Returns all the roles of the type and subtype. 450 * 451 * @param type the role's type (optionally <code>0</code>) 452 * @param subtype the role's subtype (optionally <code>null</code>) 453 * @return the roles of the type and subtype 454 * @throws SystemException if a system exception occurred 455 */ 456 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 457 public java.util.List<com.liferay.portal.model.Role> getRoles(int type, 458 java.lang.String subtype) 459 throws com.liferay.portal.kernel.exception.SystemException; 460 461 /** 462 * Returns all the roles in the company. 463 * 464 * @param companyId the primary key of the company 465 * @return the roles in the company 466 * @throws SystemException if a system exception occurred 467 */ 468 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 469 public java.util.List<com.liferay.portal.model.Role> getRoles( 470 long companyId) 471 throws com.liferay.portal.kernel.exception.SystemException; 472 473 /** 474 * Returns all the roles with the primary keys. 475 * 476 * @param roleIds the primary keys of the roles 477 * @return the roles with the primary keys 478 * @throws PortalException if any one of the roles with the primary keys 479 could not be found 480 * @throws SystemException if a system exception occurred 481 */ 482 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 483 public java.util.List<com.liferay.portal.model.Role> getRoles( 484 long[] roleIds) 485 throws com.liferay.portal.kernel.exception.PortalException, 486 com.liferay.portal.kernel.exception.SystemException; 487 488 /** 489 * Returns all the roles of the subtype. 490 * 491 * @param subtype the role's subtype (optionally <code>null</code>) 492 * @return the roles of the subtype 493 * @throws SystemException if a system exception occurred 494 */ 495 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 496 public java.util.List<com.liferay.portal.model.Role> getSubtypeRoles( 497 java.lang.String subtype) 498 throws com.liferay.portal.kernel.exception.SystemException; 499 500 /** 501 * Returns the number of roles of the subtype. 502 * 503 * @param subtype the role's subtype (optionally <code>null</code>) 504 * @return the number of roles of the subtype 505 * @throws SystemException if a system exception occurred 506 */ 507 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 508 public int getSubtypeRolesCount(java.lang.String subtype) 509 throws com.liferay.portal.kernel.exception.SystemException; 510 511 /** 512 * Returns the team role in the company. 513 * 514 * @param companyId the primary key of the company 515 * @param teamId the primary key of the team 516 * @return the team role in the company 517 * @throws PortalException if a role could not be found in the team and 518 company 519 * @throws SystemException if a system exception occurred 520 */ 521 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 522 public com.liferay.portal.model.Role getTeamRole(long companyId, long teamId) 523 throws com.liferay.portal.kernel.exception.PortalException, 524 com.liferay.portal.kernel.exception.SystemException; 525 526 /** 527 * Returns all the user's roles within the user group. 528 * 529 * @param userId the primary key of the user 530 * @param groupId the primary key of the group 531 * @return the user's roles within the user group 532 * @throws SystemException if a system exception occurred 533 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupGroupRole( 534 long, long) 535 */ 536 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 537 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 538 long userId, long groupId) 539 throws com.liferay.portal.kernel.exception.SystemException; 540 541 /** 542 * Returns all the user's roles within the user group. 543 * 544 * @param userId the primary key of the user 545 * @param groupId the primary key of the group 546 * @return the user's roles within the user group 547 * @throws SystemException if a system exception occurred 548 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupRole( 549 long, long) 550 */ 551 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 552 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 553 long userId, long groupId) 554 throws com.liferay.portal.kernel.exception.SystemException; 555 556 /** 557 * Returns the union of all the user's roles within the groups. 558 * 559 * @param userId the primary key of the user 560 * @param groups the groups (optionally <code>null</code>) 561 * @return the union of all the user's roles within the groups 562 * @throws SystemException if a system exception occurred 563 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G( 564 long, List) 565 */ 566 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 567 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 568 long userId, java.util.List<com.liferay.portal.model.Group> groups) 569 throws com.liferay.portal.kernel.exception.SystemException; 570 571 /** 572 * Returns all the user's roles within the 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 group 577 * @throws SystemException if a system exception occurred 578 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G( 579 long, long) 580 */ 581 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 582 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 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 groupIds the primary keys of the groups 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, long[]) 595 */ 596 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 597 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 598 long userId, long[] groupIds) 599 throws com.liferay.portal.kernel.exception.SystemException; 600 601 /** 602 * Returns all the roles associated with the user. 603 * 604 * @param userId the primary key of the user 605 * @return the roles associated with the user 606 * @throws SystemException if a system exception occurred 607 */ 608 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 609 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 610 long userId) throws com.liferay.portal.kernel.exception.SystemException; 611 612 /** 613 * Returns <code>true</code> if the user is associated with the role. 614 * 615 * @param userId the primary key of the user 616 * @param roleId the primary key of the role 617 * @return <code>true</code> if the user is associated with the role; 618 <code>false</code> otherwise 619 * @throws SystemException if a system exception occurred 620 */ 621 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 622 public boolean hasUserRole(long userId, long roleId) 623 throws com.liferay.portal.kernel.exception.SystemException; 624 625 /** 626 * Returns <code>true</code> if the user is associated with the named 627 * regular role. 628 * 629 * @param userId the primary key of the user 630 * @param companyId the primary key of the company 631 * @param name the name of the role 632 * @param inherited whether to include the user's inherited roles in the 633 search 634 * @return <code>true</code> if the user is associated with the regular 635 role; <code>false</code> otherwise 636 * @throws PortalException if a role with the name could not be found in 637 the company or if a default user for the company could not be 638 found 639 * @throws SystemException if a system exception occurred 640 */ 641 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 642 public boolean hasUserRole(long userId, long companyId, 643 java.lang.String name, boolean inherited) 644 throws com.liferay.portal.kernel.exception.PortalException, 645 com.liferay.portal.kernel.exception.SystemException; 646 647 /** 648 * Returns <code>true</code> if the user has any one of the named regular 649 * roles. 650 * 651 * @param userId the primary key of the user 652 * @param companyId the primary key of the company 653 * @param names the names of the roles 654 * @param inherited whether to include the user's inherited roles in the 655 search 656 * @return <code>true</code> if the user has any one of the regular roles; 657 <code>false</code> otherwise 658 * @throws PortalException if any one of the roles with the names could not 659 be found in the company or if the default user for the company 660 could not be found 661 * @throws SystemException if a system exception occurred 662 */ 663 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 664 public boolean hasUserRoles(long userId, long companyId, 665 java.lang.String[] names, boolean inherited) 666 throws com.liferay.portal.kernel.exception.PortalException, 667 com.liferay.portal.kernel.exception.SystemException; 668 669 /** 670 * Returns a role with the name in the company. 671 * 672 * @param companyId the primary key of the company 673 * @param name the role's name (optionally <code>null</code>) 674 * @return the role with the name, or <code>null</code> if a role with the 675 name could not be found in the company 676 * @throws SystemException if a system exception occurred 677 */ 678 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 679 public com.liferay.portal.model.Role loadFetchRole(long companyId, 680 java.lang.String name) 681 throws com.liferay.portal.kernel.exception.SystemException; 682 683 /** 684 * Returns a role with the name in the company. 685 * 686 * @param companyId the primary key of the company 687 * @param name the role's name 688 * @return the role with the name in the company 689 * @throws PortalException if a role with the name could not be found in 690 the company 691 * @throws SystemException if a system exception occurred 692 */ 693 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 694 public com.liferay.portal.model.Role loadGetRole(long companyId, 695 java.lang.String name) 696 throws com.liferay.portal.kernel.exception.PortalException, 697 com.liferay.portal.kernel.exception.SystemException; 698 699 /** 700 * Returns an ordered range of all the roles that match the keywords and 701 * types. 702 * 703 * <p> 704 * Useful when paginating results. Returns a maximum of <code>end - 705 * start</code> instances. <code>start</code> and <code>end</code> are not 706 * primary keys, they are indexes in the result set. Thus, <code>0</code> 707 * refers to the first result in the set. Setting both <code>start</code> 708 * and <code>end</code> to {@link 709 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 710 * full result set. 711 * </p> 712 * 713 * @param companyId the primary key of the company 714 * @param keywords the keywords (space separated), which may occur in the 715 role's name or description (optionally <code>null</code>) 716 * @param types the role types (optionally <code>null</code>) 717 * @param start the lower bound of the range of roles to return 718 * @param end the upper bound of the range of roles to return (not 719 inclusive) 720 * @param obc the comparator to order the roles (optionally 721 <code>null</code>) 722 * @return the ordered range of the matching roles, ordered by 723 <code>obc</code> 724 * @throws SystemException if a system exception occurred 725 * @see com.liferay.portal.service.persistence.RoleFinder 726 */ 727 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 728 public java.util.List<com.liferay.portal.model.Role> search( 729 long companyId, java.lang.String keywords, java.lang.Integer[] types, 730 int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) 731 throws com.liferay.portal.kernel.exception.SystemException; 732 733 /** 734 * Returns an ordered range of all the roles that match the keywords, 735 * types, and params. 736 * 737 * <p> 738 * Useful when paginating results. Returns a maximum of <code>end - 739 * start</code> instances. <code>start</code> and <code>end</code> are not 740 * primary keys, they are indexes in the result set. Thus, <code>0</code> 741 * refers to the first result in the set. Setting both <code>start</code> 742 * and <code>end</code> to {@link 743 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 744 * full result set. 745 * </p> 746 * 747 * @param companyId the primary key of the company 748 * @param keywords the keywords (space separated), which may occur in the 749 role's name or description (optionally <code>null</code>) 750 * @param types the role types (optionally <code>null</code>) 751 * @param params the finder parameters. Can specify values for 752 "permissionsResourceId" and "usersRoles" keys. For more 753 information, see {@link 754 com.liferay.portal.service.persistence.RoleFinder} 755 * @param start the lower bound of the range of roles to return 756 * @param end the upper bound of the range of roles to return (not 757 inclusive) 758 * @param obc the comparator to order the roles (optionally 759 <code>null</code>) 760 * @return the ordered range of the matching roles, ordered by 761 <code>obc</code> 762 * @throws SystemException if a system exception occurred 763 * @see com.liferay.portal.service.persistence.RoleFinder 764 */ 765 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 766 public java.util.List<com.liferay.portal.model.Role> search( 767 long companyId, java.lang.String keywords, java.lang.Integer[] types, 768 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 769 int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) 770 throws com.liferay.portal.kernel.exception.SystemException; 771 772 /** 773 * Returns an ordered range of all the roles that match the name, 774 * description, and types. 775 * 776 * <p> 777 * Useful when paginating results. Returns a maximum of <code>end - 778 * start</code> instances. <code>start</code> and <code>end</code> are not 779 * primary keys, they are indexes in the result set. Thus, <code>0</code> 780 * refers to the first result in the set. Setting both <code>start</code> 781 * and <code>end</code> to {@link 782 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 783 * full result set. 784 * </p> 785 * 786 * @param companyId the primary key of the company 787 * @param name the role's name (optionally <code>null</code>) 788 * @param description the role's description (optionally 789 <code>null</code>) 790 * @param types the role types (optionally <code>null</code>) 791 * @param start the lower bound of the range of the roles to return 792 * @param end the upper bound of the range of the roles to return (not 793 inclusive) 794 * @param obc the comparator to order the roles (optionally 795 <code>null</code>) 796 * @return the ordered range of the matching roles, ordered by 797 <code>obc</code> 798 * @throws SystemException if a system exception occurred 799 * @see com.liferay.portal.service.persistence.RoleFinder 800 */ 801 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 802 public java.util.List<com.liferay.portal.model.Role> search( 803 long companyId, java.lang.String name, java.lang.String description, 804 java.lang.Integer[] types, int start, int end, 805 com.liferay.portal.kernel.util.OrderByComparator obc) 806 throws com.liferay.portal.kernel.exception.SystemException; 807 808 /** 809 * Returns an ordered range of all the roles that match the name, 810 * description, types, and params. 811 * 812 * <p> 813 * Useful when paginating results. Returns a maximum of <code>end - 814 * start</code> instances. <code>start</code> and <code>end</code> are not 815 * primary keys, they are indexes in the result set. Thus, <code>0</code> 816 * refers to the first result in the set. Setting both <code>start</code> 817 * and <code>end</code> to {@link 818 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 819 * full result set. 820 * </p> 821 * 822 * @param companyId the primary key of the company 823 * @param name the role's name (optionally <code>null</code>) 824 * @param description the role's description (optionally 825 <code>null</code>) 826 * @param types the role types (optionally <code>null</code>) 827 * @param params the finder's parameters. Can specify values for 828 "permissionsResourceId" and "usersRoles" keys. For more 829 information, see {@link 830 com.liferay.portal.service.persistence.RoleFinder} 831 * @param start the lower bound of the range of the roles to return 832 * @param end the upper bound of the range of the roles to return (not 833 inclusive) 834 * @param obc the comparator to order the roles (optionally 835 <code>null</code>) 836 * @return the ordered range of the matching roles, ordered by 837 <code>obc</code> 838 * @throws SystemException if a system exception occurred 839 * @see com.liferay.portal.service.persistence.RoleFinder 840 */ 841 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 842 public java.util.List<com.liferay.portal.model.Role> search( 843 long companyId, java.lang.String name, java.lang.String description, 844 java.lang.Integer[] types, 845 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 846 int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) 847 throws com.liferay.portal.kernel.exception.SystemException; 848 849 /** 850 * Returns the number of roles that match the keywords and types. 851 * 852 * @param companyId the primary key of the company 853 * @param keywords the keywords (space separated), which may occur in the 854 role's name or description (optionally <code>null</code>) 855 * @param types the role types (optionally <code>null</code>) 856 * @return the number of matching roles 857 * @throws SystemException if a system exception occurred 858 */ 859 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 860 public int searchCount(long companyId, java.lang.String keywords, 861 java.lang.Integer[] types) 862 throws com.liferay.portal.kernel.exception.SystemException; 863 864 /** 865 * Returns the number of roles that match the keywords, types and params. 866 * 867 * @param companyId the primary key of the company 868 * @param keywords the keywords (space separated), which may occur in the 869 role's name or description (optionally <code>null</code>) 870 * @param types the role types (optionally <code>null</code>) 871 * @param params the finder parameters. For more information, see {@link 872 com.liferay.portal.service.persistence.RoleFinder} 873 * @return the number of matching roles 874 * @throws SystemException if a system exception occurred 875 */ 876 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 877 public int searchCount(long companyId, java.lang.String keywords, 878 java.lang.Integer[] types, 879 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 880 throws com.liferay.portal.kernel.exception.SystemException; 881 882 /** 883 * Returns the number of roles that match the name, description, and types. 884 * 885 * @param companyId the primary key of the company 886 * @param name the role's name (optionally <code>null</code>) 887 * @param description the role's description (optionally 888 <code>null</code>) 889 * @param types the role types (optionally <code>null</code>) 890 * @return the number of matching roles 891 * @throws SystemException if a system exception occurred 892 */ 893 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 894 public int searchCount(long companyId, java.lang.String name, 895 java.lang.String description, java.lang.Integer[] types) 896 throws com.liferay.portal.kernel.exception.SystemException; 897 898 /** 899 * Returns the number of roles that match the name, description, types, and 900 * params. 901 * 902 * @param companyId the primary key of the company 903 * @param name the role's name (optionally <code>null</code>) 904 * @param description the role's description (optionally 905 <code>null</code>) 906 * @param types the role types (optionally <code>null</code>) 907 * @param params the finder parameters. Can specify values for 908 "permissionsResourceId" and "usersRoles" keys. For more 909 information, see {@link 910 com.liferay.portal.service.persistence.RoleFinder} 911 * @return the number of matching roles 912 * @throws SystemException if a system exception occurred 913 */ 914 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 915 public int searchCount(long companyId, java.lang.String name, 916 java.lang.String description, java.lang.Integer[] types, 917 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 918 throws com.liferay.portal.kernel.exception.SystemException; 919 920 /** 921 * Sets the roles associated with the user, replacing the user's existing 922 * roles. The user is reindexed after the roles are set. 923 * 924 * @param userId the primary key of the user 925 * @param roleIds the primary keys of the roles 926 * @throws PortalException if a user with the primary could not be found or 927 if any one of the roles with the primary keys could not be found 928 * @throws SystemException if a system exception occurred 929 */ 930 public void setUserRoles(long userId, long[] roleIds) 931 throws com.liferay.portal.kernel.exception.PortalException, 932 com.liferay.portal.kernel.exception.SystemException; 933 934 /** 935 * Removes the matching roles associated with the user. The user is 936 * reindexed after the roles are removed. 937 * 938 * @param userId the primary key of the user 939 * @param roleIds the primary keys of the roles 940 * @throws PortalException if a user with the primary key could not be 941 found or if a role with any one of the primary keys could not be 942 found 943 * @throws SystemException if a system exception occurred 944 */ 945 public void unsetUserRoles(long userId, long[] roleIds) 946 throws com.liferay.portal.kernel.exception.PortalException, 947 com.liferay.portal.kernel.exception.SystemException; 948 949 /** 950 * Updates the role with the primary key. 951 * 952 * @param roleId the primary key of the role 953 * @param name the role's new name 954 * @param titleMap the new localized titles (optionally <code>null</code>) 955 to replace those existing for the role 956 * @param descriptionMap the new localized descriptions (optionally 957 <code>null</code>) to replace those existing for the role 958 * @param subtype the role's new subtype (optionally <code>null</code>) 959 * @return the role with the primary key 960 * @throws PortalException if a role with the primary could not be found or 961 if the role's name was invalid 962 * @throws SystemException if a system exception occurred 963 */ 964 public com.liferay.portal.model.Role updateRole(long roleId, 965 java.lang.String name, 966 java.util.Map<java.util.Locale, java.lang.String> titleMap, 967 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 968 java.lang.String subtype) 969 throws com.liferay.portal.kernel.exception.PortalException, 970 com.liferay.portal.kernel.exception.SystemException; 971 }