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 * RoleConstants#SITE_MEMBER}. If the group is an organization, then the 367 * default role is {@link RoleConstants#ORGANIZATION_USER}. If the group is 368 * a user or user group, then the default role is {@link 369 * RoleConstants#POWER_USER}. For all other group types, the default role is 370 * {@link RoleConstants#USER}. 371 * </p> 372 * 373 * @param groupId the primary key of the group 374 * @return the default role for the group with the primary key 375 * @throws PortalException if a group with the primary key could not be 376 found, or if a default role could not be found for the group 377 */ 378 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 379 public com.liferay.portal.model.Role getDefaultGroupRole(long groupId) 380 throws PortalException; 381 382 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 383 public com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery getExportActionableDynamicQuery( 384 com.liferay.portlet.exportimport.lar.PortletDataContext portletDataContext); 385 386 /** 387 * Returns the groupIds of the groups associated with the role. 388 * 389 * @param roleId the roleId of the role 390 * @return long[] the groupIds of groups associated with the role 391 */ 392 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 393 public long[] getGroupPrimaryKeys(long roleId); 394 395 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 396 public java.util.List<com.liferay.portal.model.Role> getGroupRelatedRoles( 397 long groupId) throws PortalException; 398 399 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 400 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 401 long groupId); 402 403 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 404 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 405 long groupId, int start, int end); 406 407 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 408 public java.util.List<com.liferay.portal.model.Role> getGroupRoles( 409 long groupId, int start, int end, 410 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> orderByComparator); 411 412 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 413 public int getGroupRolesCount(long groupId); 414 415 @Override 416 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 417 public com.liferay.portal.model.PersistedModel getPersistedModel( 418 java.io.Serializable primaryKeyObj) throws PortalException; 419 420 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 421 public java.util.List<com.liferay.portal.model.Role> getResourceBlockRoles( 422 long resourceBlockId, java.lang.String className, 423 java.lang.String actionId); 424 425 /** 426 * Returns a map of role names to associated action IDs for the named 427 * resource in the company within the permission scope. 428 * 429 * @param companyId the primary key of the company 430 * @param name the resource name 431 * @param scope the permission scope 432 * @param primKey the primary key of the resource's class 433 * @return the role names and action IDs 434 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P( 435 long, String, int, String) 436 */ 437 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 438 public java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles( 439 long companyId, java.lang.String name, int scope, 440 java.lang.String primKey); 441 442 /** 443 * Returns all the roles associated with the action ID in the company within 444 * the permission scope. 445 * 446 * @param companyId the primary key of the company 447 * @param name the resource name 448 * @param scope the permission scope 449 * @param primKey the primary key of the resource's class 450 * @param actionId the name of the resource action 451 * @return the roles 452 * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P_A( 453 long, String, int, String, String) 454 */ 455 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 456 public java.util.List<com.liferay.portal.model.Role> getResourceRoles( 457 long companyId, java.lang.String name, int scope, 458 java.lang.String primKey, java.lang.String actionId); 459 460 /** 461 * Returns the role with the name in the company. 462 * 463 * <p> 464 * The method searches the system roles map first for default roles. If a 465 * role with the name is not found, then the method will query the database. 466 * </p> 467 * 468 * @param companyId the primary key of the company 469 * @param name the role's name 470 * @return the role with the name 471 * @throws PortalException if a role with the name could not be found in the 472 company 473 */ 474 @com.liferay.portal.kernel.spring.aop.Skip 475 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 476 public com.liferay.portal.model.Role getRole(long companyId, 477 java.lang.String name) throws PortalException; 478 479 /** 480 * Returns the role with the primary key. 481 * 482 * @param roleId the primary key of the role 483 * @return the role 484 * @throws PortalException if a role with the primary key could not be found 485 */ 486 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 487 public com.liferay.portal.model.Role getRole(long roleId) 488 throws PortalException; 489 490 /** 491 * Returns the role with the matching UUID and company. 492 * 493 * @param uuid the role's UUID 494 * @param companyId the primary key of the company 495 * @return the matching role 496 * @throws PortalException if a matching role could not be found 497 */ 498 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 499 public com.liferay.portal.model.Role getRoleByUuidAndCompanyId( 500 java.lang.String uuid, long companyId) throws PortalException; 501 502 /** 503 * Returns all the roles in the company. 504 * 505 * @param companyId the primary key of the company 506 * @return the roles in the company 507 */ 508 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 509 public java.util.List<com.liferay.portal.model.Role> getRoles( 510 long companyId); 511 512 /** 513 * Returns all the roles with the types. 514 * 515 * @param companyId the primary key of the company 516 * @param types the role types (optionally <code>null</code>) 517 * @return the roles with the types 518 */ 519 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 520 public java.util.List<com.liferay.portal.model.Role> getRoles( 521 long companyId, int[] types); 522 523 /** 524 * Returns all the roles with the primary keys. 525 * 526 * @param roleIds the primary keys of the roles 527 * @return the roles with the primary keys 528 * @throws PortalException if any one of the roles with the primary keys 529 could not be found 530 */ 531 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 532 public java.util.List<com.liferay.portal.model.Role> getRoles( 533 long[] roleIds) throws PortalException; 534 535 /** 536 * Returns a range of all the roles. 537 * 538 * <p> 539 * 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. 540 * </p> 541 * 542 * @param start the lower bound of the range of roles 543 * @param end the upper bound of the range of roles (not inclusive) 544 * @return the range of roles 545 */ 546 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 547 public java.util.List<com.liferay.portal.model.Role> getRoles(int start, 548 int end); 549 550 /** 551 * Returns all the roles of the type and subtype. 552 * 553 * @param type the role's type (optionally <code>0</code>) 554 * @param subtype the role's subtype (optionally <code>null</code>) 555 * @return the roles of the type and subtype 556 */ 557 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 558 public java.util.List<com.liferay.portal.model.Role> getRoles(int type, 559 java.lang.String subtype); 560 561 /** 562 * Returns the number of roles. 563 * 564 * @return the number of roles 565 */ 566 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 567 public int getRolesCount(); 568 569 /** 570 * Returns all the roles of the subtype. 571 * 572 * @param subtype the role's subtype (optionally <code>null</code>) 573 * @return the roles of the subtype 574 */ 575 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 576 public java.util.List<com.liferay.portal.model.Role> getSubtypeRoles( 577 java.lang.String subtype); 578 579 /** 580 * Returns the number of roles of the subtype. 581 * 582 * @param subtype the role's subtype (optionally <code>null</code>) 583 * @return the number of roles of the subtype 584 */ 585 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 586 public int getSubtypeRolesCount(java.lang.String subtype); 587 588 /** 589 * Returns the team role in the company. 590 * 591 * @param companyId the primary key of the company 592 * @param teamId the primary key of the team 593 * @return the team role in the company 594 * @throws PortalException if a role could not be found in the team and 595 company 596 */ 597 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 598 public com.liferay.portal.model.Role getTeamRole(long companyId, long teamId) 599 throws PortalException; 600 601 /** 602 * Returns the team role map for the group. 603 * 604 * @param groupId the primary key of the group 605 * @return the team role map for the group 606 * @throws PortalException if a group with the primary key could not be 607 found, if a role could not be found in one of the group's teams, 608 or if a portal exception occurred 609 */ 610 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 611 public java.util.Map<com.liferay.portal.model.Team, com.liferay.portal.model.Role> getTeamRoleMap( 612 long groupId) throws PortalException; 613 614 /** 615 * Returns the team roles in the group. 616 * 617 * @param groupId the primary key of the group 618 * @return the team roles in the group 619 * @throws PortalException if a group with the primary key could not be 620 found, if a role could not be found in one of the group's teams, 621 or if a portal exception occurred 622 */ 623 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 624 public java.util.List<com.liferay.portal.model.Role> getTeamRoles( 625 long groupId) throws PortalException; 626 627 /** 628 * Returns the team roles in the group, excluding the specified role IDs. 629 * 630 * @param groupId the primary key of the group 631 * @param excludedRoleIds the primary keys of the roles to exclude 632 (optionally <code>null</code>) 633 * @return the team roles in the group, excluding the specified role IDs 634 * @throws PortalException if a group with the primary key could not be 635 found, if a role could not be found in one of the group's teams, 636 or if a portal exception occurred 637 */ 638 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 639 public java.util.List<com.liferay.portal.model.Role> getTeamRoles( 640 long groupId, long[] excludedRoleIds) throws PortalException; 641 642 /** 643 * Returns all the roles of the type. 644 * 645 * @param type the role's type (optionally <code>0</code>) 646 * @return the range of the roles of the type 647 */ 648 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 649 public java.util.List<com.liferay.portal.model.Role> getTypeRoles(int type); 650 651 /** 652 * Returns a range of all the roles of the type. 653 * 654 * @param type the role's type (optionally <code>0</code>) 655 * @param start the lower bound of the range of roles to return 656 * @param end the upper bound of the range of roles to return (not 657 inclusive) 658 * @return the range of the roles of the type 659 */ 660 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 661 public java.util.List<com.liferay.portal.model.Role> getTypeRoles( 662 int type, int start, int end); 663 664 /** 665 * Returns the number of roles of the type. 666 * 667 * @param type the role's type (optionally <code>0</code>) 668 * @return the number of roles of the type 669 */ 670 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 671 public int getTypeRolesCount(int type); 672 673 /** 674 * Returns all the user's roles within the user group. 675 * 676 * @param userId the primary key of the user 677 * @param groupId the primary key of the group 678 * @return the user's roles within the user group 679 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupGroupRole( 680 long, long) 681 */ 682 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 683 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 684 long userId, long groupId); 685 686 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 687 public java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles( 688 long userId, long groupId, int start, int end); 689 690 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 691 public int getUserGroupGroupRolesCount(long userId, long groupId); 692 693 /** 694 * Returns all the user's roles within the user group. 695 * 696 * @param userId the primary key of the user 697 * @param groupId the primary key of the group 698 * @return the user's roles within the user group 699 * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupRole( 700 long, long) 701 */ 702 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 703 public java.util.List<com.liferay.portal.model.Role> getUserGroupRoles( 704 long userId, long groupId); 705 706 /** 707 * Returns the userIds of the users associated with the role. 708 * 709 * @param roleId the roleId of the role 710 * @return long[] the userIds of users associated with the role 711 */ 712 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 713 public long[] getUserPrimaryKeys(long roleId); 714 715 /** 716 * Returns all the user's roles within the group. 717 * 718 * @param userId the primary key of the user 719 * @param groupId the primary key of the group 720 * @return the user's roles within the group 721 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 722 long) 723 */ 724 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 725 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 726 long userId, long groupId); 727 728 /** 729 * Returns the union of all the user's roles within the groups. 730 * 731 * @param userId the primary key of the user 732 * @param groupIds the primary keys of the groups 733 * @return the union of all the user's roles within the groups 734 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 735 long[]) 736 */ 737 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 738 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 739 long userId, long[] groupIds); 740 741 /** 742 * Returns the union of all the user's roles within the groups. 743 * 744 * @param userId the primary key of the user 745 * @param groups the groups (optionally <code>null</code>) 746 * @return the union of all the user's roles within the groups 747 * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(long, 748 List) 749 */ 750 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 751 public java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles( 752 long userId, java.util.List<com.liferay.portal.model.Group> groups); 753 754 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 755 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 756 long userId); 757 758 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 759 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 760 long userId, int start, int end); 761 762 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 763 public java.util.List<com.liferay.portal.model.Role> getUserRoles( 764 long userId, int start, int end, 765 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> orderByComparator); 766 767 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 768 public int getUserRolesCount(long userId); 769 770 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 771 public boolean hasGroupRole(long groupId, long roleId); 772 773 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 774 public boolean hasGroupRoles(long groupId); 775 776 /** 777 * Returns <code>true</code> if the user is associated with the named 778 * regular role. 779 * 780 * @param userId the primary key of the user 781 * @param companyId the primary key of the company 782 * @param name the name of the role 783 * @param inherited whether to include the user's inherited roles in the 784 search 785 * @return <code>true</code> if the user is associated with the regular 786 role; <code>false</code> otherwise 787 * @throws PortalException if a default user for the company could not be 788 found 789 */ 790 @com.liferay.portal.kernel.cache.ThreadLocalCachable 791 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 792 public boolean hasUserRole(long userId, long companyId, 793 java.lang.String name, boolean inherited) throws PortalException; 794 795 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 796 public boolean hasUserRole(long userId, long roleId); 797 798 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 799 public boolean hasUserRoles(long userId); 800 801 /** 802 * Returns <code>true</code> if the user has any one of the named regular 803 * roles. 804 * 805 * @param userId the primary key of the user 806 * @param companyId the primary key of the company 807 * @param names the names of the roles 808 * @param inherited whether to include the user's inherited roles in the 809 search 810 * @return <code>true</code> if the user has any one of the regular roles; 811 <code>false</code> otherwise 812 * @throws PortalException if any one of the roles with the names could not 813 be found in the company or if the default user for the company 814 could not be found 815 */ 816 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 817 public boolean hasUserRoles(long userId, long companyId, 818 java.lang.String[] names, boolean inherited) throws PortalException; 819 820 /** 821 * Returns a role with the name in the company. 822 * 823 * @param companyId the primary key of the company 824 * @param name the role's name (optionally <code>null</code>) 825 * @return the role with the name, or <code>null</code> if a role with the 826 name could not be found in the company 827 */ 828 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 829 public com.liferay.portal.model.Role loadFetchRole(long companyId, 830 java.lang.String name); 831 832 /** 833 * Returns a role with the name in the company. 834 * 835 * @param companyId the primary key of the company 836 * @param name the role's name 837 * @return the role with the name in the company 838 * @throws PortalException if a role with the name could not be found in the 839 company 840 */ 841 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 842 public com.liferay.portal.model.Role loadGetRole(long companyId, 843 java.lang.String name) throws PortalException; 844 845 /** 846 * Returns an ordered range of all the roles that match the keywords, types, 847 * and params. 848 * 849 * <p> 850 * Useful when paginating results. Returns a maximum of <code>end - 851 * start</code> instances. <code>start</code> and <code>end</code> are not 852 * primary keys, they are indexes in the result set. Thus, <code>0</code> 853 * refers to the first result in the set. Setting both <code>start</code> 854 * and <code>end</code> to {@link 855 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 856 * result set. 857 * </p> 858 * 859 * @param companyId the primary key of the company 860 * @param keywords the keywords (space separated), which may occur in the 861 role's name or description (optionally <code>null</code>) 862 * @param types the role types (optionally <code>null</code>) 863 * @param params the finder parameters. Can specify values for the 864 "usersRoles" key. For more information, see {@link 865 com.liferay.portal.service.persistence.RoleFinder} 866 * @param start the lower bound of the range of roles to return 867 * @param end the upper bound of the range of roles to return (not 868 inclusive) 869 * @param obc the comparator to order the roles (optionally 870 <code>null</code>) 871 * @return the ordered range of the matching roles, ordered by 872 <code>obc</code> 873 * @see com.liferay.portal.service.persistence.RoleFinder 874 */ 875 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 876 public java.util.List<com.liferay.portal.model.Role> search( 877 long companyId, java.lang.String keywords, java.lang.Integer[] types, 878 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 879 int start, int end, 880 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 881 882 /** 883 * Returns an ordered range of all the roles that match the keywords and 884 * types. 885 * 886 * <p> 887 * Useful when paginating results. Returns a maximum of <code>end - 888 * start</code> instances. <code>start</code> and <code>end</code> are not 889 * primary keys, they are indexes in the result set. Thus, <code>0</code> 890 * refers to the first result in the set. Setting both <code>start</code> 891 * and <code>end</code> to {@link 892 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 893 * result set. 894 * </p> 895 * 896 * @param companyId the primary key of the company 897 * @param keywords the keywords (space separated), which may occur in the 898 role's name or description (optionally <code>null</code>) 899 * @param types the role types (optionally <code>null</code>) 900 * @param start the lower bound of the range of roles to return 901 * @param end the upper bound of the range of roles to return (not 902 inclusive) 903 * @param obc the comparator to order the roles (optionally 904 <code>null</code>) 905 * @return the ordered range of the matching roles, ordered by 906 <code>obc</code> 907 * @see com.liferay.portal.service.persistence.RoleFinder 908 */ 909 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 910 public java.util.List<com.liferay.portal.model.Role> search( 911 long companyId, java.lang.String keywords, java.lang.Integer[] types, 912 int start, int end, 913 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 914 915 /** 916 * Returns an ordered range of all the roles that match the name, 917 * description, types, and params. 918 * 919 * <p> 920 * Useful when paginating results. Returns a maximum of <code>end - 921 * start</code> instances. <code>start</code> and <code>end</code> are not 922 * primary keys, they are indexes in the result set. Thus, <code>0</code> 923 * refers to the first result in the set. Setting both <code>start</code> 924 * and <code>end</code> to {@link 925 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 926 * result set. 927 * </p> 928 * 929 * @param companyId the primary key of the company 930 * @param name the role's name (optionally <code>null</code>) 931 * @param description the role's description (optionally <code>null</code>) 932 * @param types the role types (optionally <code>null</code>) 933 * @param params the finder's parameters. Can specify values for the 934 "usersRoles" key. For more information, see {@link 935 com.liferay.portal.service.persistence.RoleFinder} 936 * @param start the lower bound of the range of the roles to return 937 * @param end the upper bound of the range of the roles to return (not 938 inclusive) 939 * @param obc the comparator to order the roles (optionally 940 <code>null</code>) 941 * @return the ordered range of the matching roles, ordered by 942 <code>obc</code> 943 * @see com.liferay.portal.service.persistence.RoleFinder 944 */ 945 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 946 public java.util.List<com.liferay.portal.model.Role> search( 947 long companyId, java.lang.String name, java.lang.String description, 948 java.lang.Integer[] types, 949 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 950 int start, int end, 951 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 952 953 /** 954 * Returns an ordered range of all the roles that match the name, 955 * description, and types. 956 * 957 * <p> 958 * Useful when paginating results. Returns a maximum of <code>end - 959 * start</code> instances. <code>start</code> and <code>end</code> are not 960 * primary keys, they are indexes in the result set. Thus, <code>0</code> 961 * refers to the first result in the set. Setting both <code>start</code> 962 * and <code>end</code> to {@link 963 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 964 * result set. 965 * </p> 966 * 967 * @param companyId the primary key of the company 968 * @param name the role's name (optionally <code>null</code>) 969 * @param description the role's description (optionally <code>null</code>) 970 * @param types the role types (optionally <code>null</code>) 971 * @param start the lower bound of the range of the roles to return 972 * @param end the upper bound of the range of the roles to return (not 973 inclusive) 974 * @param obc the comparator to order the roles (optionally 975 <code>null</code>) 976 * @return the ordered range of the matching roles, ordered by 977 <code>obc</code> 978 * @see com.liferay.portal.service.persistence.RoleFinder 979 */ 980 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 981 public java.util.List<com.liferay.portal.model.Role> search( 982 long companyId, java.lang.String name, java.lang.String description, 983 java.lang.Integer[] types, int start, int end, 984 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Role> obc); 985 986 /** 987 * Returns the number of roles that match the keywords and types. 988 * 989 * @param companyId the primary key of the company 990 * @param keywords the keywords (space separated), which may occur in the 991 role's name or description (optionally <code>null</code>) 992 * @param types the role types (optionally <code>null</code>) 993 * @return the number of matching roles 994 */ 995 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 996 public int searchCount(long companyId, java.lang.String keywords, 997 java.lang.Integer[] types); 998 999 /** 1000 * Returns the number of roles that match the keywords, types and params. 1001 * 1002 * @param companyId the primary key of the company 1003 * @param keywords the keywords (space separated), which may occur in the 1004 role's name or description (optionally <code>null</code>) 1005 * @param types the role types (optionally <code>null</code>) 1006 * @param params the finder parameters. For more information, see {@link 1007 com.liferay.portal.service.persistence.RoleFinder} 1008 * @return the number of matching roles 1009 */ 1010 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1011 public int searchCount(long companyId, java.lang.String keywords, 1012 java.lang.Integer[] types, 1013 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params); 1014 1015 /** 1016 * Returns the number of roles that match the name, description, and types. 1017 * 1018 * @param companyId the primary key of the company 1019 * @param name the role's name (optionally <code>null</code>) 1020 * @param description the role's description (optionally <code>null</code>) 1021 * @param types the role types (optionally <code>null</code>) 1022 * @return the number of matching roles 1023 */ 1024 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1025 public int searchCount(long companyId, java.lang.String name, 1026 java.lang.String description, java.lang.Integer[] types); 1027 1028 /** 1029 * Returns the number of roles that match the name, description, types, and 1030 * params. 1031 * 1032 * @param companyId the primary key of the company 1033 * @param name the role's name (optionally <code>null</code>) 1034 * @param description the role's description (optionally <code>null</code>) 1035 * @param types the role types (optionally <code>null</code>) 1036 * @param params the finder parameters. Can specify values for the 1037 "usersRoles" key. For more information, see {@link 1038 com.liferay.portal.service.persistence.RoleFinder} 1039 * @return the number of matching roles 1040 */ 1041 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 1042 public int searchCount(long companyId, java.lang.String name, 1043 java.lang.String description, java.lang.Integer[] types, 1044 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params); 1045 1046 /** 1047 * Sets the Spring bean ID for this bean. 1048 * 1049 * @param beanIdentifier the Spring bean ID for this bean 1050 */ 1051 public void setBeanIdentifier(java.lang.String beanIdentifier); 1052 1053 public void setGroupRoles(long groupId, long[] roleIds); 1054 1055 /** 1056 * @throws PortalException 1057 */ 1058 public void setUserRoles(long userId, long[] roleIds) 1059 throws PortalException; 1060 1061 /** 1062 * Removes the matching roles associated with the user. The user is 1063 * reindexed after the roles are removed. 1064 * 1065 * @param userId the primary key of the user 1066 * @param roleIds the primary keys of the roles 1067 * @throws PortalException if a user with the primary key could not be found 1068 or if a role with any one of the primary keys could not be found 1069 */ 1070 public void unsetUserRoles(long userId, long[] roleIds) 1071 throws PortalException; 1072 1073 /** 1074 * Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 1075 * 1076 * @param role the role 1077 * @return the role that was updated 1078 */ 1079 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 1080 public com.liferay.portal.model.Role updateRole( 1081 com.liferay.portal.model.Role role); 1082 1083 /** 1084 * Updates the role with the primary key. 1085 * 1086 * @param roleId the primary key of the role 1087 * @param name the role's new name 1088 * @param titleMap the new localized titles (optionally <code>null</code>) 1089 to replace those existing for the role 1090 * @param descriptionMap the new localized descriptions (optionally 1091 <code>null</code>) to replace those existing for the role 1092 * @param subtype the role's new subtype (optionally <code>null</code>) 1093 * @param serviceContext the service context to be applied (optionally 1094 <code>null</code>). Can set expando bridge attributes for the 1095 role. 1096 * @return the role with the primary key 1097 * @throws PortalException if a role with the primary could not be found or 1098 if the role's name was invalid 1099 */ 1100 public com.liferay.portal.model.Role updateRole(long roleId, 1101 java.lang.String name, 1102 java.util.Map<java.util.Locale, java.lang.String> titleMap, 1103 java.util.Map<java.util.Locale, java.lang.String> descriptionMap, 1104 java.lang.String subtype, 1105 com.liferay.portal.service.ServiceContext serviceContext) 1106 throws PortalException; 1107 }