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