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