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