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