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