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