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