001 /** 002 * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.util.ReferenceRegistry; 021 022 /** 023 * Provides the local service utility for Role. This utility wraps 024 * {@link com.liferay.portal.service.impl.RoleLocalServiceImpl} and is the 025 * primary access point for service operations in application layer code running 026 * on the local server. Methods of this service will not have security checks 027 * based on the propagated JAAS credentials because this service can only be 028 * accessed from within the same VM. 029 * 030 * @author Brian Wing Shun Chan 031 * @see RoleLocalService 032 * @see com.liferay.portal.service.base.RoleLocalServiceBaseImpl 033 * @see com.liferay.portal.service.impl.RoleLocalServiceImpl 034 * @generated 035 */ 036 @ProviderType 037 public class RoleLocalServiceUtil { 038 /* 039 * NOTE FOR DEVELOPERS: 040 * 041 * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.RoleLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 042 */ 043 public static void addGroupRole(long groupId, 044 com.liferay.portal.model.Role role) { 045 getService().addGroupRole(groupId, role); 046 } 047 048 public static void addGroupRole(long groupId, long roleId) { 049 getService().addGroupRole(groupId, roleId); 050 } 051 052 public static void addGroupRoles(long groupId, 053 java.util.List<com.liferay.portal.model.Role> Roles) { 054 getService().addGroupRoles(groupId, Roles); 055 } 056 057 public static void addGroupRoles(long groupId, long[] roleIds) { 058 getService().addGroupRoles(groupId, roleIds); 059 } 060 061 /** 062 * Adds the role to the database. Also notifies the appropriate model listeners. 063 * 064 * @param role the role 065 * @return the role that was added 066 */ 067 public static com.liferay.portal.model.Role addRole( 068 com.liferay.portal.model.Role role) { 069 return getService().addRole(role); 070 } 071 072 /** 073 * Adds a role with additional parameters. The user is reindexed after role 074 * is added. 075 * 076 * @param userId the primary key of the user 077 * @param className the name of the class for which the role is created 078 (optionally <code>null</code>) 079 * @param classPK the primary key of the class for which the role is 080 created (optionally <code>0</code>) 081 * @param name the role's name 082 * @param titleMap the role's localized titles (optionally 083 <code>null</code>) 084 * @param descriptionMap the role's localized descriptions (optionally 085 <code>null</code>) 086 * @param type the role's type (optionally <code>0</code>) 087 * @param subtype the role's subtype (optionally <code>null</code>) 088 * @param serviceContext the service context to be applied (optionally 089 <code>null</code>). Can set expando bridge attributes for the 090 role. 091 * @return the role 092 * @throws PortalException if the class name or the role name were invalid, 093 if the role is a duplicate, or if a user with the primary key 094 could not be found 095 */ 096 public static com.liferay.portal.model.Role addRole(long userId, 097 java.lang.String className, long classPK, java.lang.String name, 098 java.util.Map<java.util.Locale, java.lang.String> titleMap, 099 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 100 int type, java.lang.String subtype, 101 com.liferay.portal.service.ServiceContext serviceContext) 102 throws com.liferay.portal.kernel.exception.PortalException { 103 return getService() 104 .addRole(userId, className, classPK, name, titleMap, 105 descriptionMap, type, subtype, serviceContext); 106 } 107 108 /** 109 * Adds a role. The user is reindexed after role is added. 110 * 111 * @param userId the primary key of the user 112 * @param companyId the primary key of the company 113 * @param name the role's name 114 * @param titleMap the role's localized titles (optionally 115 <code>null</code>) 116 * @param descriptionMap the role's localized descriptions (optionally 117 <code>null</code>) 118 * @param type the role's type (optionally <code>0</code>) 119 * @return the role 120 * @throws PortalException if the class name or the role name were 121 invalid, if the role is a duplicate, or if a user with the 122 primary key could not be found 123 * @deprecated As of 6.2.0, replaced by {@link #addRole(long, String, long, 124 String, Map, Map, int, String, ServiceContext)} 125 */ 126 @Deprecated 127 public static com.liferay.portal.model.Role addRole(long userId, 128 long companyId, java.lang.String name, 129 java.util.Map<java.util.Locale, java.lang.String> titleMap, 130 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 131 int type) throws com.liferay.portal.kernel.exception.PortalException { 132 return getService() 133 .addRole(userId, companyId, name, titleMap, descriptionMap, 134 type); 135 } 136 137 /** 138 * Adds a role with additional parameters. The user is reindexed after role 139 * is added. 140 * 141 * @param userId the primary key of the user 142 * @param companyId the primary key of the company 143 * @param name the role's name 144 * @param titleMap the role's localized titles (optionally 145 <code>null</code>) 146 * @param descriptionMap the role's localized descriptions (optionally 147 <code>null</code>) 148 * @param type the role's type (optionally <code>0</code>) 149 * @param className the name of the class for which the role is created 150 (optionally <code>null</code>) 151 * @param classPK the primary key of the class for which the role is 152 created (optionally <code>0</code>) 153 * @return the role 154 * @throws PortalException if the class name or the role name were 155 invalid, if the role is a duplicate, or if a user with the 156 primary key could not be found 157 * @deprecated As of 6.2.0, replaced by {@link #addRole(long, String, long, 158 String, Map, Map, int, String, ServiceContext)} 159 */ 160 @Deprecated 161 public static com.liferay.portal.model.Role addRole(long userId, 162 long companyId, java.lang.String name, 163 java.util.Map<java.util.Locale, java.lang.String> titleMap, 164 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 165 int type, java.lang.String className, long classPK) 166 throws com.liferay.portal.kernel.exception.PortalException { 167 return getService() 168 .addRole(userId, companyId, name, titleMap, descriptionMap, 169 type, className, classPK); 170 } 171 172 public static void addUserRole(long userId, 173 com.liferay.portal.model.Role role) { 174 getService().addUserRole(userId, role); 175 } 176 177 public static void addUserRole(long userId, long roleId) { 178 getService().addUserRole(userId, roleId); 179 } 180 181 /** 182 * @throws PortalException 183 */ 184 public static void addUserRoles(long userId, 185 java.util.List<com.liferay.portal.model.Role> Roles) 186 throws com.liferay.portal.kernel.exception.PortalException { 187 getService().addUserRoles(userId, Roles); 188 } 189 190 /** 191 * @throws PortalException 192 */ 193 public static void addUserRoles(long userId, long[] roleIds) 194 throws com.liferay.portal.kernel.exception.PortalException { 195 getService().addUserRoles(userId, roleIds); 196 } 197 198 /** 199 * Checks to ensure that the system roles map has appropriate default roles 200 * in each company. 201 * 202 * @throws PortalException if the current user did not have permission to 203 set applicable permissions on a role 204 */ 205 public static void checkSystemRoles() 206 throws com.liferay.portal.kernel.exception.PortalException { 207 getService().checkSystemRoles(); 208 } 209 210 /** 211 * Checks to ensure that the system roles map has appropriate default roles 212 * in the company. 213 * 214 * @param companyId the primary key of the company 215 * @throws PortalException if the current user did not have permission to 216 set applicable permissions on a role 217 */ 218 public static void checkSystemRoles(long companyId) 219 throws com.liferay.portal.kernel.exception.PortalException { 220 getService().checkSystemRoles(companyId); 221 } 222 223 public static void clearGroupRoles(long groupId) { 224 getService().clearGroupRoles(groupId); 225 } 226 227 public static void clearUserRoles(long userId) { 228 getService().clearUserRoles(userId); 229 } 230 231 /** 232 * Creates a new role with the primary key. Does not add the role to the database. 233 * 234 * @param roleId the primary key for the new role 235 * @return the new role 236 */ 237 public static com.liferay.portal.model.Role createRole(long roleId) { 238 return getService().createRole(roleId); 239 } 240 241 public static void deleteGroupRole(long groupId, 242 com.liferay.portal.model.Role role) { 243 getService().deleteGroupRole(groupId, role); 244 } 245 246 public static void deleteGroupRole(long groupId, long roleId) { 247 getService().deleteGroupRole(groupId, roleId); 248 } 249 250 public static void deleteGroupRoles(long groupId, 251 java.util.List<com.liferay.portal.model.Role> Roles) { 252 getService().deleteGroupRoles(groupId, Roles); 253 } 254 255 public static void deleteGroupRoles(long groupId, long[] roleIds) { 256 getService().deleteGroupRoles(groupId, roleIds); 257 } 258 259 /** 260 * @throws PortalException 261 */ 262 public static com.liferay.portal.model.PersistedModel deletePersistedModel( 263 com.liferay.portal.model.PersistedModel persistedModel) 264 throws com.liferay.portal.kernel.exception.PortalException { 265 return getService().deletePersistedModel(persistedModel); 266 } 267 268 /** 269 * Deletes the role from the database. Also notifies the appropriate model listeners. 270 * 271 * @param role the role 272 * @return the role that was removed 273 * @throws PortalException 274 */ 275 public static com.liferay.portal.model.Role deleteRole( 276 com.liferay.portal.model.Role role) 277 throws com.liferay.portal.kernel.exception.PortalException { 278 return getService().deleteRole(role); 279 } 280 281 /** 282 * Deletes the role with the primary key from the database. Also notifies the appropriate model listeners. 283 * 284 * @param roleId the primary key of the role 285 * @return the role that was removed 286 * @throws PortalException if a role with the primary key could not be found 287 */ 288 public static com.liferay.portal.model.Role deleteRole(long roleId) 289 throws com.liferay.portal.kernel.exception.PortalException { 290 return getService().deleteRole(roleId); 291 } 292 293 public static void deleteUserRole(long userId, 294 com.liferay.portal.model.Role role) { 295 getService().deleteUserRole(userId, role); 296 } 297 298 public static void deleteUserRole(long userId, long roleId) { 299 getService().deleteUserRole(userId, roleId); 300 } 301 302 public static void deleteUserRoles(long userId, 303 java.util.List<com.liferay.portal.model.Role> Roles) { 304 getService().deleteUserRoles(userId, Roles); 305 } 306 307 public static void deleteUserRoles(long userId, long[] roleIds) { 308 getService().deleteUserRoles(userId, roleIds); 309 } 310 311 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 312 return getService().dynamicQuery(); 313 } 314 315 /** 316 * Performs a dynamic query on the database and returns the matching rows. 317 * 318 * @param dynamicQuery the dynamic query 319 * @return the matching rows 320 */ 321 public static <T> java.util.List<T> dynamicQuery( 322 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 323 return getService().dynamicQuery(dynamicQuery); 324 } 325 326 /** 327 * Performs a dynamic query on the database and returns a range of the matching rows. 328 * 329 * <p> 330 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.RoleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 331 * </p> 332 * 333 * @param dynamicQuery the dynamic query 334 * @param start the lower bound of the range of model instances 335 * @param end the upper bound of the range of model instances (not inclusive) 336 * @return the range of matching rows 337 */ 338 public static <T> java.util.List<T> dynamicQuery( 339 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 340 int end) { 341 return getService().dynamicQuery(dynamicQuery, start, end); 342 } 343 344 /** 345 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 346 * 347 * <p> 348 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.RoleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 349 * </p> 350 * 351 * @param dynamicQuery the dynamic query 352 * @param start the lower bound of the range of model instances 353 * @param end the upper bound of the range of model instances (not inclusive) 354 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 355 * @return the ordered range of matching rows 356 */ 357 public static <T> java.util.List<T> dynamicQuery( 358 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 359 int end, 360 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) { 361 return getService() 362 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 363 } 364 365 /** 366 * Returns the number of rows that match the dynamic query. 367 * 368 * @param dynamicQuery the dynamic query 369 * @return the number of rows that match the dynamic query 370 */ 371 public static long dynamicQueryCount( 372 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 373 return getService().dynamicQueryCount(dynamicQuery); 374 } 375 376 /** 377 * Returns the number of rows that match the dynamic query. 378 * 379 * @param dynamicQuery the dynamic query 380 * @param projection the projection to apply to the query 381 * @return the number of rows that match the dynamic query 382 */ 383 public static long dynamicQueryCount( 384 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 385 com.liferay.portal.kernel.dao.orm.Projection projection) { 386 return getService().dynamicQueryCount(dynamicQuery, projection); 387 } 388 389 /** 390 * Returns the role with the name in the company. 391 * 392 * <p> 393 * The method searches the system roles map first for default roles. If a 394 * role with the name is not found, then the method will query the database. 395 * </p> 396 * 397 * @param companyId the primary key of the company 398 * @param name the role's name 399 * @return Returns the role with the name or <code>null</code> if a role 400 with the name could not be found in the company 401 */ 402 public static com.liferay.portal.model.Role fetchRole(long companyId, 403 java.lang.String name) { 404 return getService().fetchRole(companyId, name); 405 } 406 407 public static com.liferay.portal.model.Role fetchRole(long roleId) { 408 return getService().fetchRole(roleId); 409 } 410 411 /** 412 * Returns the role with the matching UUID and company. 413 * 414 * @param uuid the role's UUID 415 * @param companyId the primary key of the company 416 * @return the matching role, or <code>null</code> if a matching role could not be found 417 */ 418 public static com.liferay.portal.model.Role fetchRoleByUuidAndCompanyId( 419 java.lang.String uuid, long companyId) { 420 return getService().fetchRoleByUuidAndCompanyId(uuid, companyId); 421 } 422 423 public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() { 424 return getService().getActionableDynamicQuery(); 425 } 426 427 /** 428 * Returns the Spring bean ID for this bean. 429 * 430 * @return the Spring bean ID for this bean 431 */ 432 public static java.lang.String getBeanIdentifier() { 433 return getService().getBeanIdentifier(); 434 } 435 436 /** 437 * Returns the default role for the group with the primary key. 438 * 439 * <p> 440 * If the group is a site, then the default role is {@link 441 * com.liferay.portal.model.RoleConstants#SITE_MEMBER}. If the group is an 442 * organization, then the default role is {@link 443 * com.liferay.portal.model.RoleConstants#ORGANIZATION_USER}. If the group 444 * is a user or user group, then the default role is {@link 445 * com.liferay.portal.model.RoleConstants#POWER_USER}. For all other group 446 * types, the default role is {@link 447 * com.liferay.portal.model.RoleConstants#USER}. 448 * </p> 449 * 450 * @param groupId the primary key of the group 451 * @return the default role for the group with the primary key 452 * @throws PortalException if a group with the primary key could not be 453 found, or if a default role could not be found for the group 454 */ 455 public static com.liferay.portal.model.Role getDefaultGroupRole( 456 long groupId) 457 throws com.liferay.portal.kernel.exception.PortalException { 458 return getService().getDefaultGroupRole(groupId); 459 } 460 461 public static com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery getExportActionableDynamicQuery( 462 com.liferay.portal.kernel.lar.PortletDataContext portletDataContext) { 463 return getService().getExportActionableDynamicQuery(portletDataContext); 464 } 465 466 /** 467 * Returns the groupIds of the groups associated with the role. 468 * 469 * @param roleId the roleId of the role 470 * @return long[] the groupIds of groups associated with the role 471 */ 472 public static long[] getGroupPrimaryKeys(long roleId) { 473 return getService().getGroupPrimaryKeys(roleId); 474 } 475 476 public static java.util.List<com.liferay.portal.model.Role> getGroupRelatedRoles( 477 long groupId) 478 throws com.liferay.portal.kernel.exception.PortalException { 479 return getService().getGroupRelatedRoles(groupId); 480 } 481 482 public static java.util.List<com.liferay.portal.model.Role> getGroupRoles( 483 long groupId) { 484 return getService().getGroupRoles(groupId); 485 } 486 487 public static java.util.List<com.liferay.portal.model.Role> getGroupRoles( 488 long groupId, int start, int end) { 489 return getService().getGroupRoles(groupId, start, end); 490 } 491 492 public static java.util.List<com.liferay.portal.model.Role> getGroupRoles( 493 long groupId, int start, int end, 494 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> orderByComparator) { 495 return getService().getGroupRoles(groupId, start, end, orderByComparator); 496 } 497 498 public static int getGroupRolesCount(long groupId) { 499 return getService().getGroupRolesCount(groupId); 500 } 501 502 public static com.liferay.portal.model.PersistedModel getPersistedModel( 503 java.io.Serializable primaryKeyObj) 504 throws com.liferay.portal.kernel.exception.PortalException { 505 return getService().getPersistedModel(primaryKeyObj); 506 } 507 508 public static java.util.List<com.liferay.portal.model.Role> getResourceBlockRoles( 509 long resourceBlockId, java.lang.String className, 510 java.lang.String actionId) { 511 return getService() 512 .getResourceBlockRoles(resourceBlockId, className, actionId); 513 } 514 515 /** 516 * Returns a map of role names to associated action IDs for the named 517 * resource in the company within the permission scope. 518 * 519 * @param companyId the primary key of the company 520 * @param name the resource name 521 * @param scope the permission scope 522 * @param primKey the primary key of the resource's class 523 * @return the role names and action IDs 524 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P( 525 long, String, int, String) 526 */ 527 public static java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles( 528 long companyId, java.lang.String name, int scope, 529 java.lang.String primKey) { 530 return getService().getResourceRoles(companyId, name, scope, primKey); 531 } 532 533 /** 534 * Returns all the roles associated with the action ID in the company within 535 * the permission scope. 536 * 537 * @param companyId the primary key of the company 538 * @param name the resource name 539 * @param scope the permission scope 540 * @param primKey the primary key of the resource's class 541 * @param actionId the name of the resource action 542 * @return the roles 543 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P_A( 544 long, String, int, String, String) 545 */ 546 public static java.util.List<com.liferay.portal.model.Role> getResourceRoles( 547 long companyId, java.lang.String name, int scope, 548 java.lang.String primKey, java.lang.String actionId) { 549 return getService() 550 .getResourceRoles(companyId, name, scope, primKey, actionId); 551 } 552 553 /** 554 * Returns the role with the name in the company. 555 * 556 * <p> 557 * The method searches the system roles map first for default roles. If a 558 * role with the name is not found, then the method will query the database. 559 * </p> 560 * 561 * @param companyId the primary key of the company 562 * @param name the role's name 563 * @return the role with the name 564 * @throws PortalException if a role with the name could not be found in the 565 company 566 */ 567 public static com.liferay.portal.model.Role getRole(long companyId, 568 java.lang.String name) 569 throws com.liferay.portal.kernel.exception.PortalException { 570 return getService().getRole(companyId, name); 571 } 572 573 /** 574 * Returns the role with the primary key. 575 * 576 * @param roleId the primary key of the role 577 * @return the role 578 * @throws PortalException if a role with the primary key could not be found 579 */ 580 public static com.liferay.portal.model.Role getRole(long roleId) 581 throws com.liferay.portal.kernel.exception.PortalException { 582 return getService().getRole(roleId); 583 } 584 585 /** 586 * Returns the role with the matching UUID and company. 587 * 588 * @param uuid the role's UUID 589 * @param companyId the primary key of the company 590 * @return the matching role 591 * @throws PortalException if a matching role could not be found 592 */ 593 public static com.liferay.portal.model.Role getRoleByUuidAndCompanyId( 594 java.lang.String uuid, long companyId) 595 throws com.liferay.portal.kernel.exception.PortalException { 596 return getService().getRoleByUuidAndCompanyId(uuid, companyId); 597 } 598 599 /** 600 * Returns all the roles in the company. 601 * 602 * @param companyId the primary key of the company 603 * @return the roles in the company 604 */ 605 public static java.util.List<com.liferay.portal.model.Role> getRoles( 606 long companyId) { 607 return getService().getRoles(companyId); 608 } 609 610 /** 611 * Returns all the roles with the types. 612 * 613 * @param companyId the primary key of the company 614 * @param types the role types (optionally <code>null</code>) 615 * @return the roles with the types 616 */ 617 public static java.util.List<com.liferay.portal.model.Role> getRoles( 618 long companyId, int[] types) { 619 return getService().getRoles(companyId, types); 620 } 621 622 /** 623 * Returns all the roles with the primary keys. 624 * 625 * @param roleIds the primary keys of the roles 626 * @return the roles with the primary keys 627 * @throws PortalException if any one of the roles with the primary keys 628 could not be found 629 */ 630 public static java.util.List<com.liferay.portal.model.Role> getRoles( 631 long[] roleIds) 632 throws com.liferay.portal.kernel.exception.PortalException { 633 return getService().getRoles(roleIds); 634 } 635 636 /** 637 * Returns a range of all the roles. 638 * 639 * <p> 640 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.RoleModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 641 * </p> 642 * 643 * @param start the lower bound of the range of roles 644 * @param end the upper bound of the range of roles (not inclusive) 645 * @return the range of roles 646 */ 647 public static java.util.List<com.liferay.portal.model.Role> getRoles( 648 int start, int end) { 649 return getService().getRoles(start, end); 650 } 651 652 /** 653 * Returns all the roles of the type and subtype. 654 * 655 * @param type the role's type (optionally <code>0</code>) 656 * @param subtype the role's subtype (optionally <code>null</code>) 657 * @return the roles of the type and subtype 658 */ 659 public static java.util.List<com.liferay.portal.model.Role> getRoles( 660 int type, java.lang.String subtype) { 661 return getService().getRoles(type, subtype); 662 } 663 664 /** 665 * Returns the number of roles. 666 * 667 * @return the number of roles 668 */ 669 public static int getRolesCount() { 670 return getService().getRolesCount(); 671 } 672 673 /** 674 * Returns all the roles of the subtype. 675 * 676 * @param subtype the role's subtype (optionally <code>null</code>) 677 * @return the roles of the subtype 678 */ 679 public static java.util.List<com.liferay.portal.model.Role> getSubtypeRoles( 680 java.lang.String subtype) { 681 return getService().getSubtypeRoles(subtype); 682 } 683 684 /** 685 * Returns the number of roles of the subtype. 686 * 687 * @param subtype the role's subtype (optionally <code>null</code>) 688 * @return the number of roles of the subtype 689 */ 690 public static int getSubtypeRolesCount(java.lang.String subtype) { 691 return getService().getSubtypeRolesCount(subtype); 692 } 693 694 /** 695 * Returns the team role in the company. 696 * 697 * @param companyId the primary key of the company 698 * @param teamId the primary key of the team 699 * @return the team role in the company 700 * @throws PortalException if a role could not be found in the team and 701 company 702 */ 703 public static com.liferay.portal.model.Role getTeamRole(long companyId, 704 long teamId) throws com.liferay.portal.kernel.exception.PortalException { 705 return getService().getTeamRole(companyId, teamId); 706 } 707 708 /** 709 * Returns the team role map for the group. 710 * 711 * @param groupId the primary key of the group 712 * @return the team role map for the group 713 * @throws PortalException if a group with the primary key could not be 714 found, if a role could not be found in one of the group's teams, 715 or if a portal exception occurred 716 */ 717 public static java.util.Map<com.liferay.portal.model.Team, com.liferay.portal.model.Role> getTeamRoleMap( 718 long groupId) 719 throws com.liferay.portal.kernel.exception.PortalException { 720 return getService().getTeamRoleMap(groupId); 721 } 722 723 /** 724 * Returns the team roles in the group. 725 * 726 * @param groupId the primary key of the group 727 * @return the team roles in the group 728 * @throws PortalException if a group with the primary key could not be 729 found, if a role could not be found in one of the group's teams, 730 or if a portal exception occurred 731 */ 732 public static java.util.List<com.liferay.portal.model.Role> getTeamRoles( 733 long groupId) 734 throws com.liferay.portal.kernel.exception.PortalException { 735 return getService().getTeamRoles(groupId); 736 } 737 738 /** 739 * Returns the team roles in the group, excluding the specified role IDs. 740 * 741 * @param groupId the primary key of the group 742 * @param excludedRoleIds the primary keys of the roles to exclude 743 (optionally <code>null</code>) 744 * @return the team roles in the group, excluding the specified role IDs 745 * @throws PortalException if a group with the primary key could not be 746 found, if a role could not be found in one of the group's teams, 747 or if a portal exception occurred 748 */ 749 public static java.util.List<com.liferay.portal.model.Role> getTeamRoles( 750 long groupId, long[] excludedRoleIds) 751 throws com.liferay.portal.kernel.exception.PortalException { 752 return getService().getTeamRoles(groupId, excludedRoleIds); 753 } 754 755 /** 756 * Returns all the roles of the type. 757 * 758 * @param type the role's type (optionally <code>0</code>) 759 * @return the range of the roles of the type 760 */ 761 public static java.util.List<com.liferay.portal.model.Role> getTypeRoles( 762 int type) { 763 return getService().getTypeRoles(type); 764 } 765 766 /** 767 * Returns a range of all the roles of the type. 768 * 769 * @param type the role's type (optionally <code>0</code>) 770 * @param start the lower bound of the range of roles to return 771 * @param end the upper bound of the range of roles to return (not 772 inclusive) 773 * @return the range of the roles of the type 774 */ 775 public static java.util.List<com.liferay.portal.model.Role> getTypeRoles( 776 int type, int start, int end) { 777 return getService().getTypeRoles(type, start, end); 778 } 779 780 /** 781 * Returns the number of roles of the type. 782 * 783 * @param type the role's type (optionally <code>0</code>) 784 * @return the number of roles of the type 785 */ 786 public static int getTypeRolesCount(int type) { 787 return getService().getTypeRolesCount(type); 788 } 789 790 /** 791 * Returns all the user's roles within the user group. 792 * 793 * @param userId the primary key of the user 794 * @param groupId the primary key of the group 795 * @return the user's roles within the user group 796 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupGroupRole( 797 long, long) 798 */ 799 public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 800 long userId, long groupId) { 801 return getService().getUserGroupGroupRoles(userId, groupId); 802 } 803 804 /** 805 * Returns all the user's roles within the user group. 806 * 807 * @param userId the primary key of the user 808 * @param groupId the primary key of the group 809 * @return the user's roles within the user group 810 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupRole( 811 long, long) 812 */ 813 public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 814 long userId, long groupId) { 815 return getService().getUserGroupRoles(userId, groupId); 816 } 817 818 /** 819 * Returns the userIds of the users associated with the role. 820 * 821 * @param roleId the roleId of the role 822 * @return long[] the userIds of users associated with the role 823 */ 824 public static long[] getUserPrimaryKeys(long roleId) { 825 return getService().getUserPrimaryKeys(roleId); 826 } 827 828 /** 829 * Returns all the user's roles within the group. 830 * 831 * @param userId the primary key of the user 832 * @param groupId the primary key of the group 833 * @return the user's roles within the group 834 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 835 long) 836 */ 837 public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 838 long userId, long groupId) { 839 return getService().getUserRelatedRoles(userId, groupId); 840 } 841 842 /** 843 * Returns the union of all the user's roles within the groups. 844 * 845 * @param userId the primary key of the user 846 * @param groupIds the primary keys of the groups 847 * @return the union of all the user's roles within the groups 848 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 849 long[]) 850 */ 851 public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 852 long userId, long[] groupIds) { 853 return getService().getUserRelatedRoles(userId, groupIds); 854 } 855 856 /** 857 * Returns the union of all the user's roles within the groups. 858 * 859 * @param userId the primary key of the user 860 * @param groups the groups (optionally <code>null</code>) 861 * @return the union of all the user's roles within the groups 862 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 863 List) 864 */ 865 public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 866 long userId, java.util.List<com.liferay.portal.model.Group> groups) { 867 return getService().getUserRelatedRoles(userId, groups); 868 } 869 870 public static java.util.List<com.liferay.portal.model.Role> getUserRoles( 871 long userId) { 872 return getService().getUserRoles(userId); 873 } 874 875 public static java.util.List<com.liferay.portal.model.Role> getUserRoles( 876 long userId, int start, int end) { 877 return getService().getUserRoles(userId, start, end); 878 } 879 880 public static java.util.List<com.liferay.portal.model.Role> getUserRoles( 881 long userId, int start, int end, 882 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> orderByComparator) { 883 return getService().getUserRoles(userId, start, end, orderByComparator); 884 } 885 886 public static int getUserRolesCount(long userId) { 887 return getService().getUserRolesCount(userId); 888 } 889 890 public static boolean hasGroupRole(long groupId, long roleId) { 891 return getService().hasGroupRole(groupId, roleId); 892 } 893 894 public static boolean hasGroupRoles(long groupId) { 895 return getService().hasGroupRoles(groupId); 896 } 897 898 /** 899 * Returns <code>true</code> if the user is associated with the named 900 * regular role. 901 * 902 * @param userId the primary key of the user 903 * @param companyId the primary key of the company 904 * @param name the name of the role 905 * @param inherited whether to include the user's inherited roles in the 906 search 907 * @return <code>true</code> if the user is associated with the regular 908 role; <code>false</code> otherwise 909 * @throws PortalException if a default user for the company could not be 910 found 911 */ 912 public static boolean hasUserRole(long userId, long companyId, 913 java.lang.String name, boolean inherited) 914 throws com.liferay.portal.kernel.exception.PortalException { 915 return getService().hasUserRole(userId, companyId, name, inherited); 916 } 917 918 public static boolean hasUserRole(long userId, long roleId) { 919 return getService().hasUserRole(userId, roleId); 920 } 921 922 public static boolean hasUserRoles(long userId) { 923 return getService().hasUserRoles(userId); 924 } 925 926 /** 927 * Returns <code>true</code> if the user has any one of the named regular 928 * roles. 929 * 930 * @param userId the primary key of the user 931 * @param companyId the primary key of the company 932 * @param names the names of the roles 933 * @param inherited whether to include the user's inherited roles in the 934 search 935 * @return <code>true</code> if the user has any one of the regular roles; 936 <code>false</code> otherwise 937 * @throws PortalException if any one of the roles with the names could not 938 be found in the company or if the default user for the company 939 could not be found 940 */ 941 public static boolean hasUserRoles(long userId, long companyId, 942 java.lang.String[] names, boolean inherited) 943 throws com.liferay.portal.kernel.exception.PortalException { 944 return getService().hasUserRoles(userId, companyId, names, inherited); 945 } 946 947 /** 948 * Returns a role with the name in the company. 949 * 950 * @param companyId the primary key of the company 951 * @param name the role's name (optionally <code>null</code>) 952 * @return the role with the name, or <code>null</code> if a role with the 953 name could not be found in the company 954 */ 955 public static com.liferay.portal.model.Role loadFetchRole(long companyId, 956 java.lang.String name) { 957 return getService().loadFetchRole(companyId, name); 958 } 959 960 /** 961 * Returns a role with the name in the company. 962 * 963 * @param companyId the primary key of the company 964 * @param name the role's name 965 * @return the role with the name in the company 966 * @throws PortalException if a role with the name could not be found in the 967 company 968 */ 969 public static com.liferay.portal.model.Role loadGetRole(long companyId, 970 java.lang.String name) 971 throws com.liferay.portal.kernel.exception.PortalException { 972 return getService().loadGetRole(companyId, name); 973 } 974 975 /** 976 * Returns an ordered range of all the roles that match the keywords, types, 977 * and params. 978 * 979 * <p> 980 * Useful when paginating results. Returns a maximum of <code>end - 981 * start</code> instances. <code>start</code> and <code>end</code> are not 982 * primary keys, they are indexes in the result set. Thus, <code>0</code> 983 * refers to the first result in the set. Setting both <code>start</code> 984 * and <code>end</code> to {@link 985 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 986 * result set. 987 * </p> 988 * 989 * @param companyId the primary key of the company 990 * @param keywords the keywords (space separated), which may occur in the 991 role's name or description (optionally <code>null</code>) 992 * @param types the role types (optionally <code>null</code>) 993 * @param params the finder parameters. Can specify values for the 994 "usersRoles" key. For more information, see {@link 995 com.liferay.portal.service.persistence.RoleFinder} 996 * @param start the lower bound of the range of roles to return 997 * @param end the upper bound of the range of roles to return (not 998 inclusive) 999 * @param obc the comparator to order the roles (optionally 1000 <code>null</code>) 1001 * @return the ordered range of the matching roles, ordered by 1002 <code>obc</code> 1003 * @see com.liferay.portal.service.persistence.RoleFinder 1004 */ 1005 public static java.util.List<com.liferay.portal.model.Role> search( 1006 long companyId, java.lang.String keywords, java.lang.Integer[] types, 1007 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 1008 int start, int end, 1009 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc) { 1010 return getService() 1011 .search(companyId, keywords, types, params, start, end, obc); 1012 } 1013 1014 /** 1015 * Returns an ordered range of all the roles that match the keywords and 1016 * types. 1017 * 1018 * <p> 1019 * Useful when paginating results. Returns a maximum of <code>end - 1020 * start</code> instances. <code>start</code> and <code>end</code> are not 1021 * primary keys, they are indexes in the result set. Thus, <code>0</code> 1022 * refers to the first result in the set. Setting both <code>start</code> 1023 * and <code>end</code> to {@link 1024 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 1025 * result set. 1026 * </p> 1027 * 1028 * @param companyId the primary key of the company 1029 * @param keywords the keywords (space separated), which may occur in the 1030 role's name or description (optionally <code>null</code>) 1031 * @param types the role types (optionally <code>null</code>) 1032 * @param start the lower bound of the range of roles to return 1033 * @param end the upper bound of the range of roles to return (not 1034 inclusive) 1035 * @param obc the comparator to order the roles (optionally 1036 <code>null</code>) 1037 * @return the ordered range of the matching roles, ordered by 1038 <code>obc</code> 1039 * @see com.liferay.portal.service.persistence.RoleFinder 1040 */ 1041 public static java.util.List<com.liferay.portal.model.Role> search( 1042 long companyId, java.lang.String keywords, java.lang.Integer[] types, 1043 int start, int end, 1044 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc) { 1045 return getService().search(companyId, keywords, types, start, end, obc); 1046 } 1047 1048 /** 1049 * Returns an ordered range of all the roles that match the name, 1050 * description, types, and params. 1051 * 1052 * <p> 1053 * Useful when paginating results. Returns a maximum of <code>end - 1054 * start</code> instances. <code>start</code> and <code>end</code> are not 1055 * primary keys, they are indexes in the result set. Thus, <code>0</code> 1056 * refers to the first result in the set. Setting both <code>start</code> 1057 * and <code>end</code> to {@link 1058 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 1059 * result set. 1060 * </p> 1061 * 1062 * @param companyId the primary key of the company 1063 * @param name the role's name (optionally <code>null</code>) 1064 * @param description the role's description (optionally <code>null</code>) 1065 * @param types the role types (optionally <code>null</code>) 1066 * @param params the finder's parameters. Can specify values for the 1067 "usersRoles" key. For more information, see {@link 1068 com.liferay.portal.service.persistence.RoleFinder} 1069 * @param start the lower bound of the range of the roles to return 1070 * @param end the upper bound of the range of the roles to return (not 1071 inclusive) 1072 * @param obc the comparator to order the roles (optionally 1073 <code>null</code>) 1074 * @return the ordered range of the matching roles, ordered by 1075 <code>obc</code> 1076 * @see com.liferay.portal.service.persistence.RoleFinder 1077 */ 1078 public static java.util.List<com.liferay.portal.model.Role> search( 1079 long companyId, java.lang.String name, java.lang.String description, 1080 java.lang.Integer[] types, 1081 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 1082 int start, int end, 1083 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc) { 1084 return getService() 1085 .search(companyId, name, description, types, params, start, 1086 end, obc); 1087 } 1088 1089 /** 1090 * Returns an ordered range of all the roles that match the name, 1091 * description, and types. 1092 * 1093 * <p> 1094 * Useful when paginating results. Returns a maximum of <code>end - 1095 * start</code> instances. <code>start</code> and <code>end</code> are not 1096 * primary keys, they are indexes in the result set. Thus, <code>0</code> 1097 * refers to the first result in the set. Setting both <code>start</code> 1098 * and <code>end</code> to {@link 1099 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 1100 * result set. 1101 * </p> 1102 * 1103 * @param companyId the primary key of the company 1104 * @param name the role's name (optionally <code>null</code>) 1105 * @param description the role's description (optionally <code>null</code>) 1106 * @param types the role types (optionally <code>null</code>) 1107 * @param start the lower bound of the range of the roles to return 1108 * @param end the upper bound of the range of the roles to return (not 1109 inclusive) 1110 * @param obc the comparator to order the roles (optionally 1111 <code>null</code>) 1112 * @return the ordered range of the matching roles, ordered by 1113 <code>obc</code> 1114 * @see com.liferay.portal.service.persistence.RoleFinder 1115 */ 1116 public static java.util.List<com.liferay.portal.model.Role> search( 1117 long companyId, java.lang.String name, java.lang.String description, 1118 java.lang.Integer[] types, int start, int end, 1119 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc) { 1120 return getService() 1121 .search(companyId, name, description, types, start, end, obc); 1122 } 1123 1124 /** 1125 * Returns the number of roles that match the keywords and types. 1126 * 1127 * @param companyId the primary key of the company 1128 * @param keywords the keywords (space separated), which may occur in the 1129 role's name or description (optionally <code>null</code>) 1130 * @param types the role types (optionally <code>null</code>) 1131 * @return the number of matching roles 1132 */ 1133 public static int searchCount(long companyId, java.lang.String keywords, 1134 java.lang.Integer[] types) { 1135 return getService().searchCount(companyId, keywords, types); 1136 } 1137 1138 /** 1139 * Returns the number of roles that match the keywords, types and params. 1140 * 1141 * @param companyId the primary key of the company 1142 * @param keywords the keywords (space separated), which may occur in the 1143 role's name or description (optionally <code>null</code>) 1144 * @param types the role types (optionally <code>null</code>) 1145 * @param params the finder parameters. For more information, see {@link 1146 com.liferay.portal.service.persistence.RoleFinder} 1147 * @return the number of matching roles 1148 */ 1149 public static int searchCount(long companyId, java.lang.String keywords, 1150 java.lang.Integer[] types, 1151 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) { 1152 return getService().searchCount(companyId, keywords, types, params); 1153 } 1154 1155 /** 1156 * Returns the number of roles that match the name, description, and types. 1157 * 1158 * @param companyId the primary key of the company 1159 * @param name the role's name (optionally <code>null</code>) 1160 * @param description the role's description (optionally <code>null</code>) 1161 * @param types the role types (optionally <code>null</code>) 1162 * @return the number of matching roles 1163 */ 1164 public static int searchCount(long companyId, java.lang.String name, 1165 java.lang.String description, java.lang.Integer[] types) { 1166 return getService().searchCount(companyId, name, description, types); 1167 } 1168 1169 /** 1170 * Returns the number of roles that match the name, description, types, and 1171 * params. 1172 * 1173 * @param companyId the primary key of the company 1174 * @param name the role's name (optionally <code>null</code>) 1175 * @param description the role's description (optionally <code>null</code>) 1176 * @param types the role types (optionally <code>null</code>) 1177 * @param params the finder parameters. Can specify values for the 1178 "usersRoles" key. For more information, see {@link 1179 com.liferay.portal.service.persistence.RoleFinder} 1180 * @return the number of matching roles 1181 */ 1182 public static int searchCount(long companyId, java.lang.String name, 1183 java.lang.String description, java.lang.Integer[] types, 1184 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) { 1185 return getService() 1186 .searchCount(companyId, name, description, types, params); 1187 } 1188 1189 /** 1190 * Sets the Spring bean ID for this bean. 1191 * 1192 * @param beanIdentifier the Spring bean ID for this bean 1193 */ 1194 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 1195 getService().setBeanIdentifier(beanIdentifier); 1196 } 1197 1198 public static void setGroupRoles(long groupId, long[] roleIds) { 1199 getService().setGroupRoles(groupId, roleIds); 1200 } 1201 1202 /** 1203 * @throws PortalException 1204 */ 1205 public static void setUserRoles(long userId, long[] roleIds) 1206 throws com.liferay.portal.kernel.exception.PortalException { 1207 getService().setUserRoles(userId, roleIds); 1208 } 1209 1210 /** 1211 * Removes the matching roles associated with the user. The user is 1212 * reindexed after the roles are removed. 1213 * 1214 * @param userId the primary key of the user 1215 * @param roleIds the primary keys of the roles 1216 * @throws PortalException if a user with the primary key could not be found 1217 or if a role with any one of the primary keys could not be found 1218 */ 1219 public static void unsetUserRoles(long userId, long[] roleIds) 1220 throws com.liferay.portal.kernel.exception.PortalException { 1221 getService().unsetUserRoles(userId, roleIds); 1222 } 1223 1224 /** 1225 * Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 1226 * 1227 * @param role the role 1228 * @return the role that was updated 1229 */ 1230 public static com.liferay.portal.model.Role updateRole( 1231 com.liferay.portal.model.Role role) { 1232 return getService().updateRole(role); 1233 } 1234 1235 /** 1236 * Updates the role with the primary key. 1237 * 1238 * @param roleId the primary key of the role 1239 * @param name the role's new name 1240 * @param titleMap the new localized titles (optionally <code>null</code>) 1241 to replace those existing for the role 1242 * @param descriptionMap the new localized descriptions (optionally 1243 <code>null</code>) to replace those existing for the role 1244 * @param subtype the role's new subtype (optionally <code>null</code>) 1245 * @param serviceContext the service context to be applied (optionally 1246 <code>null</code>). Can set expando bridge attributes for the 1247 role. 1248 * @return the role with the primary key 1249 * @throws PortalException if a role with the primary could not be found or 1250 if the role's name was invalid 1251 */ 1252 public static com.liferay.portal.model.Role updateRole(long roleId, 1253 java.lang.String name, 1254 java.util.Map<java.util.Locale, java.lang.String> titleMap, 1255 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 1256 java.lang.String subtype, 1257 com.liferay.portal.service.ServiceContext serviceContext) 1258 throws com.liferay.portal.kernel.exception.PortalException { 1259 return getService() 1260 .updateRole(roleId, name, titleMap, descriptionMap, subtype, 1261 serviceContext); 1262 } 1263 1264 public static RoleLocalService getService() { 1265 if (_service == null) { 1266 _service = (RoleLocalService)PortalBeanLocatorUtil.locate(RoleLocalService.class.getName()); 1267 1268 ReferenceRegistry.registerReference(RoleLocalServiceUtil.class, 1269 "_service"); 1270 } 1271 1272 return _service; 1273 } 1274 1275 /** 1276 * @deprecated As of 6.2.0 1277 */ 1278 @Deprecated 1279 public void setService(RoleLocalService service) { 1280 } 1281 1282 private static RoleLocalService _service; 1283 }