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