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