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