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