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