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