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