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