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