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