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