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