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