001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import 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            * Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
237            *
238            * @param role the role
239            * @param merge whether to merge the role with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
240            * @return the role that was updated
241            * @throws SystemException if a system exception occurred
242            */
243            public static com.liferay.portal.model.Role updateRole(
244                    com.liferay.portal.model.Role role, boolean merge)
245                    throws com.liferay.portal.kernel.exception.SystemException {
246                    return getService().updateRole(role, merge);
247            }
248    
249            /**
250            * Returns the Spring bean ID for this bean.
251            *
252            * @return the Spring bean ID for this bean
253            */
254            public static java.lang.String getBeanIdentifier() {
255                    return getService().getBeanIdentifier();
256            }
257    
258            /**
259            * Sets the Spring bean ID for this bean.
260            *
261            * @param beanIdentifier the Spring bean ID for this bean
262            */
263            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
264                    getService().setBeanIdentifier(beanIdentifier);
265            }
266    
267            /**
268            * Adds a role. The user is reindexed after role is added.
269            *
270            * @param userId the primary key of the user
271            * @param companyId the primary key of the company
272            * @param name the role's name
273            * @param titleMap the role's localized titles (optionally
274            <code>null</code>)
275            * @param descriptionMap the role's localized descriptions (optionally
276            <code>null</code>)
277            * @param type the role's type (optionally <code>0</code>)
278            * @return the role
279            * @throws PortalException if the class name or the role name were invalid,
280            if the role is a duplicate, or if a user with the primary key
281            could not be found
282            * @throws SystemException if a system exception occurred
283            */
284            public static com.liferay.portal.model.Role addRole(long userId,
285                    long companyId, java.lang.String name,
286                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
287                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
288                    int type)
289                    throws com.liferay.portal.kernel.exception.PortalException,
290                            com.liferay.portal.kernel.exception.SystemException {
291                    return getService()
292                                       .addRole(userId, companyId, name, titleMap, descriptionMap,
293                            type);
294            }
295    
296            /**
297            * Adds a role with additional parameters. The user is reindexed after role
298            * is added.
299            *
300            * @param userId the primary key of the user
301            * @param companyId the primary key of the company
302            * @param name the role's name
303            * @param titleMap the role's localized titles (optionally
304            <code>null</code>)
305            * @param descriptionMap the role's localized descriptions (optionally
306            <code>null</code>)
307            * @param type the role's type (optionally <code>0</code>)
308            * @param className the name of the class for which the role is created
309            (optionally <code>null</code>)
310            * @param classPK the primary key of the class for which the role is
311            created (optionally <code>0</code>)
312            * @return the role
313            * @throws PortalException if the class name or the role name were invalid,
314            if the role is a duplicate, or if a user with the primary key
315            could not be found
316            * @throws SystemException if a system exception occurred
317            */
318            public static com.liferay.portal.model.Role addRole(long userId,
319                    long companyId, java.lang.String name,
320                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
321                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
322                    int type, java.lang.String className, long classPK)
323                    throws com.liferay.portal.kernel.exception.PortalException,
324                            com.liferay.portal.kernel.exception.SystemException {
325                    return getService()
326                                       .addRole(userId, companyId, name, titleMap, descriptionMap,
327                            type, className, classPK);
328            }
329    
330            /**
331            * Adds the roles to the user. The user is reindexed after the roles are
332            * added.
333            *
334            * @param userId the primary key of the user
335            * @param roleIds the primary keys of the roles
336            * @throws PortalException if a user with the primary key could not be found
337            * @throws SystemException if a system exception occurred
338            * @see com.liferay.portal.service.persistence.UserPersistence#addRoles(
339            long, long[])
340            */
341            public static void addUserRoles(long userId, long[] roleIds)
342                    throws com.liferay.portal.kernel.exception.PortalException,
343                            com.liferay.portal.kernel.exception.SystemException {
344                    getService().addUserRoles(userId, roleIds);
345            }
346    
347            /**
348            * Checks to ensure that the system roles map has appropriate default roles
349            * in each company.
350            *
351            * @throws PortalException if the current user did not have permission to
352            set applicable permissions on a role
353            * @throws SystemException if a system exception occurred
354            */
355            public static void checkSystemRoles()
356                    throws com.liferay.portal.kernel.exception.PortalException,
357                            com.liferay.portal.kernel.exception.SystemException {
358                    getService().checkSystemRoles();
359            }
360    
361            /**
362            * Checks to ensure that the system roles map has appropriate default roles
363            * in the company.
364            *
365            * @param companyId the primary key of the company
366            * @throws PortalException if the current user did not have permission to
367            set applicable permissions on a role
368            * @throws SystemException if a system exception occurred
369            */
370            public static void checkSystemRoles(long companyId)
371                    throws com.liferay.portal.kernel.exception.PortalException,
372                            com.liferay.portal.kernel.exception.SystemException {
373                    getService().checkSystemRoles(companyId);
374            }
375    
376            /**
377            * Returns the role with the name in the company.
378            *
379            * <p>
380            * The method searches the system roles map first for default roles. If a
381            * role with the name is not found, then the method will query the database.
382            * </p>
383            *
384            * @param companyId the primary key of the company
385            * @param name the role's name
386            * @return Returns the role with the name or <code>null</code> if a role
387            with the name could not be found in the company
388            * @throws SystemException if a system exception occurred
389            */
390            public static com.liferay.portal.model.Role fetchRole(long companyId,
391                    java.lang.String name)
392                    throws com.liferay.portal.kernel.exception.SystemException {
393                    return getService().fetchRole(companyId, name);
394            }
395    
396            /**
397            * Returns the default role for the group with the primary key.
398            *
399            * <p>
400            * If the group is a site, then the default role is {@link
401            * com.liferay.portal.model.RoleConstants#SITE_MEMBER}. If the group is an
402            * organization, then the default role is {@link
403            * com.liferay.portal.model.RoleConstants#ORGANIZATION_USER}. If the group
404            * is a user or user group, then the default role is {@link
405            * com.liferay.portal.model.RoleConstants#POWER_USER}. For all other group
406            * types, the default role is {@link
407            * com.liferay.portal.model.RoleConstants#USER}.
408            * </p>
409            *
410            * @param groupId the primary key of the group
411            * @return the default role for the group with the primary key
412            * @throws PortalException if a group with the primary key could not be
413            found, or if a default role could not be found for the group
414            * @throws SystemException if a system exception occurred
415            */
416            public static com.liferay.portal.model.Role getDefaultGroupRole(
417                    long groupId)
418                    throws com.liferay.portal.kernel.exception.PortalException,
419                            com.liferay.portal.kernel.exception.SystemException {
420                    return getService().getDefaultGroupRole(groupId);
421            }
422    
423            /**
424            * Returns all the roles associated with the group.
425            *
426            * @param groupId the primary key of the group
427            * @return the roles associated with the group
428            * @throws SystemException if a system exception occurred
429            */
430            public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
431                    long groupId)
432                    throws com.liferay.portal.kernel.exception.SystemException {
433                    return getService().getGroupRoles(groupId);
434            }
435    
436            public static java.util.List<com.liferay.portal.model.Role> getResourceBlockRoles(
437                    long resourceBlockId, java.lang.String className,
438                    java.lang.String actionId)
439                    throws com.liferay.portal.kernel.exception.SystemException {
440                    return getService()
441                                       .getResourceBlockRoles(resourceBlockId, className, actionId);
442            }
443    
444            /**
445            * Returns a map of role names to associated action IDs for the named
446            * resource in the company within the permission scope.
447            *
448            * @param companyId the primary key of the company
449            * @param name the resource name
450            * @param scope the permission scope
451            * @param primKey the primary key of the resource's class
452            * @return the role names and action IDs
453            * @throws SystemException if a system exception occurred
454            * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P(
455            long, String, int, String)
456            */
457            public static java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles(
458                    long companyId, java.lang.String name, int scope,
459                    java.lang.String primKey)
460                    throws com.liferay.portal.kernel.exception.SystemException {
461                    return getService().getResourceRoles(companyId, name, scope, primKey);
462            }
463    
464            /**
465            * Returns all the roles associated with the action ID in the company within
466            * the permission scope.
467            *
468            * @param companyId the primary key of the company
469            * @param name the resource name
470            * @param scope the permission scope
471            * @param primKey the primary key of the resource's class
472            * @param actionId the name of the resource action
473            * @return the roles
474            * @throws SystemException if a system exception occurred
475            * @see com.liferay.portal.service.persistence.RoleFinder#findByC_N_S_P_A(
476            long, String, int, String, String)
477            */
478            public static java.util.List<com.liferay.portal.model.Role> getResourceRoles(
479                    long companyId, java.lang.String name, int scope,
480                    java.lang.String primKey, java.lang.String actionId)
481                    throws com.liferay.portal.kernel.exception.SystemException {
482                    return getService()
483                                       .getResourceRoles(companyId, name, scope, primKey, actionId);
484            }
485    
486            /**
487            * Returns the role with the name in the company.
488            *
489            * <p>
490            * The method searches the system roles map first for default roles. If a
491            * role with the name is not found, then the method will query the database.
492            * </p>
493            *
494            * @param companyId the primary key of the company
495            * @param name the role's name
496            * @return the role with the name
497            * @throws PortalException if a role with the name could not be found in the
498            company
499            * @throws SystemException if a system exception occurred
500            */
501            public static com.liferay.portal.model.Role getRole(long companyId,
502                    java.lang.String name)
503                    throws com.liferay.portal.kernel.exception.PortalException,
504                            com.liferay.portal.kernel.exception.SystemException {
505                    return getService().getRole(companyId, name);
506            }
507    
508            /**
509            * Returns all the roles of the type and subtype.
510            *
511            * @param type the role's type (optionally <code>0</code>)
512            * @param subtype the role's subtype (optionally <code>null</code>)
513            * @return the roles of the type and subtype
514            * @throws SystemException if a system exception occurred
515            */
516            public static java.util.List<com.liferay.portal.model.Role> getRoles(
517                    int type, java.lang.String subtype)
518                    throws com.liferay.portal.kernel.exception.SystemException {
519                    return getService().getRoles(type, subtype);
520            }
521    
522            /**
523            * Returns all the roles in the company.
524            *
525            * @param companyId the primary key of the company
526            * @return the roles in the company
527            * @throws SystemException if a system exception occurred
528            */
529            public static java.util.List<com.liferay.portal.model.Role> getRoles(
530                    long companyId)
531                    throws com.liferay.portal.kernel.exception.SystemException {
532                    return getService().getRoles(companyId);
533            }
534    
535            /**
536            * Returns all the roles with the primary keys.
537            *
538            * @param roleIds the primary keys of the roles
539            * @return the roles with the primary keys
540            * @throws PortalException if any one of the roles with the primary keys
541            could not be found
542            * @throws SystemException if a system exception occurred
543            */
544            public static java.util.List<com.liferay.portal.model.Role> getRoles(
545                    long[] roleIds)
546                    throws com.liferay.portal.kernel.exception.PortalException,
547                            com.liferay.portal.kernel.exception.SystemException {
548                    return getService().getRoles(roleIds);
549            }
550    
551            /**
552            * Returns all the roles of the subtype.
553            *
554            * @param subtype the role's subtype (optionally <code>null</code>)
555            * @return the roles of the subtype
556            * @throws SystemException if a system exception occurred
557            */
558            public static java.util.List<com.liferay.portal.model.Role> getSubtypeRoles(
559                    java.lang.String subtype)
560                    throws com.liferay.portal.kernel.exception.SystemException {
561                    return getService().getSubtypeRoles(subtype);
562            }
563    
564            /**
565            * Returns the number of roles of the subtype.
566            *
567            * @param subtype the role's subtype (optionally <code>null</code>)
568            * @return the number of roles of the subtype
569            * @throws SystemException if a system exception occurred
570            */
571            public static int getSubtypeRolesCount(java.lang.String subtype)
572                    throws com.liferay.portal.kernel.exception.SystemException {
573                    return getService().getSubtypeRolesCount(subtype);
574            }
575    
576            /**
577            * Returns the team role in the company.
578            *
579            * @param companyId the primary key of the company
580            * @param teamId the primary key of the team
581            * @return the team role in the company
582            * @throws PortalException if a role could not be found in the team and
583            company
584            * @throws SystemException if a system exception occurred
585            */
586            public static com.liferay.portal.model.Role getTeamRole(long companyId,
587                    long teamId)
588                    throws com.liferay.portal.kernel.exception.PortalException,
589                            com.liferay.portal.kernel.exception.SystemException {
590                    return getService().getTeamRole(companyId, teamId);
591            }
592    
593            /**
594            * Returns all the user's roles within the user group.
595            *
596            * @param userId the primary key of the user
597            * @param groupId the primary key of the group
598            * @return the user's roles within the user group
599            * @throws SystemException if a system exception occurred
600            * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupGroupRole(
601            long, long)
602            */
603            public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
604                    long userId, long groupId)
605                    throws com.liferay.portal.kernel.exception.SystemException {
606                    return getService().getUserGroupGroupRoles(userId, groupId);
607            }
608    
609            /**
610            * Returns all the user's roles within the user group.
611            *
612            * @param userId the primary key of the user
613            * @param groupId the primary key of the group
614            * @return the user's roles within the user group
615            * @throws SystemException if a system exception occurred
616            * @see com.liferay.portal.service.persistence.RoleFinder#findByUserGroupRole(
617            long, long)
618            */
619            public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
620                    long userId, long groupId)
621                    throws com.liferay.portal.kernel.exception.SystemException {
622                    return getService().getUserGroupRoles(userId, groupId);
623            }
624    
625            /**
626            * Returns the union of all the user's roles within the groups.
627            *
628            * @param userId the primary key of the user
629            * @param groups the groups (optionally <code>null</code>)
630            * @return the union of all the user's roles within the groups
631            * @throws SystemException if a system exception occurred
632            * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(
633            long, List)
634            */
635            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
636                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
637                    throws com.liferay.portal.kernel.exception.SystemException {
638                    return getService().getUserRelatedRoles(userId, groups);
639            }
640    
641            /**
642            * Returns all the user's roles within the group.
643            *
644            * @param userId the primary key of the user
645            * @param groupId the primary key of the group
646            * @return the user's roles within the group
647            * @throws SystemException if a system exception occurred
648            * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(
649            long, long)
650            */
651            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
652                    long userId, long groupId)
653                    throws com.liferay.portal.kernel.exception.SystemException {
654                    return getService().getUserRelatedRoles(userId, groupId);
655            }
656    
657            /**
658            * Returns the union of all the user's roles within the groups.
659            *
660            * @param userId the primary key of the user
661            * @param groupIds the primary keys of the groups
662            * @return the union of all the user's roles within the groups
663            * @throws SystemException if a system exception occurred
664            * @see com.liferay.portal.service.persistence.RoleFinder#findByU_G(
665            long, long[])
666            */
667            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
668                    long userId, long[] groupIds)
669                    throws com.liferay.portal.kernel.exception.SystemException {
670                    return getService().getUserRelatedRoles(userId, groupIds);
671            }
672    
673            /**
674            * Returns all the roles associated with the user.
675            *
676            * @param userId the primary key of the user
677            * @return the roles associated with the user
678            * @throws SystemException if a system exception occurred
679            */
680            public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
681                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
682                    return getService().getUserRoles(userId);
683            }
684    
685            /**
686            * Returns <code>true</code> if the user is associated with the role.
687            *
688            * @param userId the primary key of the user
689            * @param roleId the primary key of the role
690            * @return <code>true</code> if the user is associated with the role;
691            <code>false</code> otherwise
692            * @throws SystemException if a system exception occurred
693            */
694            public static boolean hasUserRole(long userId, long roleId)
695                    throws com.liferay.portal.kernel.exception.SystemException {
696                    return getService().hasUserRole(userId, roleId);
697            }
698    
699            /**
700            * Returns <code>true</code> if the user is associated with the named
701            * regular role.
702            *
703            * @param userId the primary key of the user
704            * @param companyId the primary key of the company
705            * @param name the name of the role
706            * @param inherited whether to include the user's inherited roles in the
707            search
708            * @return <code>true</code> if the user is associated with the regular
709            role; <code>false</code> otherwise
710            * @throws PortalException if a role with the name could not be found in the
711            company or if a default user for the company could not be found
712            * @throws SystemException if a system exception occurred
713            */
714            public static boolean hasUserRole(long userId, long companyId,
715                    java.lang.String name, boolean inherited)
716                    throws com.liferay.portal.kernel.exception.PortalException,
717                            com.liferay.portal.kernel.exception.SystemException {
718                    return getService().hasUserRole(userId, companyId, name, inherited);
719            }
720    
721            /**
722            * Returns <code>true</code> if the user has any one of the named regular
723            * roles.
724            *
725            * @param userId the primary key of the user
726            * @param companyId the primary key of the company
727            * @param names the names of the roles
728            * @param inherited whether to include the user's inherited roles in the
729            search
730            * @return <code>true</code> if the user has any one of the regular roles;
731            <code>false</code> otherwise
732            * @throws PortalException if any one of the roles with the names could not
733            be found in the company or if the default user for the company
734            could not be found
735            * @throws SystemException if a system exception occurred
736            */
737            public static boolean hasUserRoles(long userId, long companyId,
738                    java.lang.String[] names, boolean inherited)
739                    throws com.liferay.portal.kernel.exception.PortalException,
740                            com.liferay.portal.kernel.exception.SystemException {
741                    return getService().hasUserRoles(userId, companyId, names, inherited);
742            }
743    
744            /**
745            * Returns a role with the name in the company.
746            *
747            * @param companyId the primary key of the company
748            * @param name the role's name (optionally <code>null</code>)
749            * @return the role with the name, or <code>null</code> if a role with the
750            name could not be found in the company
751            * @throws SystemException if a system exception occurred
752            */
753            public static com.liferay.portal.model.Role loadFetchRole(long companyId,
754                    java.lang.String name)
755                    throws com.liferay.portal.kernel.exception.SystemException {
756                    return getService().loadFetchRole(companyId, name);
757            }
758    
759            /**
760            * Returns a role with the name in the company.
761            *
762            * @param companyId the primary key of the company
763            * @param name the role's name
764            * @return the role with the name in the company
765            * @throws PortalException if a role with the name could not be found in the
766            company
767            * @throws SystemException if a system exception occurred
768            */
769            public static com.liferay.portal.model.Role loadGetRole(long companyId,
770                    java.lang.String name)
771                    throws com.liferay.portal.kernel.exception.PortalException,
772                            com.liferay.portal.kernel.exception.SystemException {
773                    return getService().loadGetRole(companyId, name);
774            }
775    
776            /**
777            * Returns an ordered range of all the roles that match the keywords and
778            * types.
779            *
780            * <p>
781            * Useful when paginating results. Returns a maximum of <code>end -
782            * start</code> instances. <code>start</code> and <code>end</code> are not
783            * primary keys, they are indexes in the result set. Thus, <code>0</code>
784            * refers to the first result in the set. Setting both <code>start</code>
785            * and <code>end</code> to {@link
786            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
787            * result set.
788            * </p>
789            *
790            * @param companyId the primary key of the company
791            * @param keywords the keywords (space separated), which may occur in the
792            role's name or description (optionally <code>null</code>)
793            * @param types the role types (optionally <code>null</code>)
794            * @param start the lower bound of the range of roles to return
795            * @param end the upper bound of the range of roles to return (not
796            inclusive)
797            * @param obc the comparator to order the roles (optionally
798            <code>null</code>)
799            * @return the ordered range of the matching roles, ordered by
800            <code>obc</code>
801            * @throws SystemException if a system exception occurred
802            * @see com.liferay.portal.service.persistence.RoleFinder
803            */
804            public static java.util.List<com.liferay.portal.model.Role> search(
805                    long companyId, java.lang.String keywords, java.lang.Integer[] types,
806                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
807                    throws com.liferay.portal.kernel.exception.SystemException {
808                    return getService().search(companyId, keywords, types, start, end, obc);
809            }
810    
811            /**
812            * Returns an ordered range of all the roles that match the keywords, types,
813            * and params.
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 params the finder parameters. Can specify values for
830            "permissionsResourceId" and "usersRoles" keys. For more
831            information, see {@link
832            com.liferay.portal.service.persistence.RoleFinder}
833            * @param start the lower bound of the range of roles to return
834            * @param end the upper bound of the range of roles to return (not
835            inclusive)
836            * @param obc the comparator to order the roles (optionally
837            <code>null</code>)
838            * @return the ordered range of the matching roles, ordered by
839            <code>obc</code>
840            * @throws SystemException if a system exception occurred
841            * @see com.liferay.portal.service.persistence.RoleFinder
842            */
843            public static java.util.List<com.liferay.portal.model.Role> search(
844                    long companyId, java.lang.String keywords, java.lang.Integer[] types,
845                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
846                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
847                    throws com.liferay.portal.kernel.exception.SystemException {
848                    return getService()
849                                       .search(companyId, keywords, types, params, start, end, obc);
850            }
851    
852            /**
853            * Returns an ordered range of all the roles that match the name,
854            * description, and types.
855            *
856            * <p>
857            * Useful when paginating results. Returns a maximum of <code>end -
858            * start</code> instances. <code>start</code> and <code>end</code> are not
859            * primary keys, they are indexes in the result set. Thus, <code>0</code>
860            * refers to the first result in the set. Setting both <code>start</code>
861            * and <code>end</code> to {@link
862            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
863            * result set.
864            * </p>
865            *
866            * @param companyId the primary key of the company
867            * @param name the role's name (optionally <code>null</code>)
868            * @param description the role's description (optionally <code>null</code>)
869            * @param types the role types (optionally <code>null</code>)
870            * @param start the lower bound of the range of the roles to return
871            * @param end the upper bound of the range of the roles to return (not
872            inclusive)
873            * @param obc the comparator to order the roles (optionally
874            <code>null</code>)
875            * @return the ordered range of the matching roles, ordered by
876            <code>obc</code>
877            * @throws SystemException if a system exception occurred
878            * @see com.liferay.portal.service.persistence.RoleFinder
879            */
880            public static java.util.List<com.liferay.portal.model.Role> search(
881                    long companyId, java.lang.String name, java.lang.String description,
882                    java.lang.Integer[] types, int start, int end,
883                    com.liferay.portal.kernel.util.OrderByComparator obc)
884                    throws com.liferay.portal.kernel.exception.SystemException {
885                    return getService()
886                                       .search(companyId, name, description, types, start, end, obc);
887            }
888    
889            /**
890            * Returns an ordered range of all the roles that match the name,
891            * description, types, and params.
892            *
893            * <p>
894            * Useful when paginating results. Returns a maximum of <code>end -
895            * start</code> instances. <code>start</code> and <code>end</code> are not
896            * primary keys, they are indexes in the result set. Thus, <code>0</code>
897            * refers to the first result in the set. Setting both <code>start</code>
898            * and <code>end</code> to {@link
899            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
900            * result set.
901            * </p>
902            *
903            * @param companyId the primary key of the company
904            * @param name the role's name (optionally <code>null</code>)
905            * @param description the role's description (optionally <code>null</code>)
906            * @param types the role types (optionally <code>null</code>)
907            * @param params the finder's parameters. Can specify values for
908            "permissionsResourceId" and "usersRoles" keys. For more
909            information, see {@link
910            com.liferay.portal.service.persistence.RoleFinder}
911            * @param start the lower bound of the range of the roles to return
912            * @param end the upper bound of the range of the roles to return (not
913            inclusive)
914            * @param obc the comparator to order the roles (optionally
915            <code>null</code>)
916            * @return the ordered range of the matching roles, ordered by
917            <code>obc</code>
918            * @throws SystemException if a system exception occurred
919            * @see com.liferay.portal.service.persistence.RoleFinder
920            */
921            public static java.util.List<com.liferay.portal.model.Role> search(
922                    long companyId, java.lang.String name, java.lang.String description,
923                    java.lang.Integer[] types,
924                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
925                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
926                    throws com.liferay.portal.kernel.exception.SystemException {
927                    return getService()
928                                       .search(companyId, name, description, types, params, start,
929                            end, obc);
930            }
931    
932            /**
933            * Returns the number of roles that match the keywords and types.
934            *
935            * @param companyId the primary key of the company
936            * @param keywords the keywords (space separated), which may occur in the
937            role's name or description (optionally <code>null</code>)
938            * @param types the role types (optionally <code>null</code>)
939            * @return the number of matching roles
940            * @throws SystemException if a system exception occurred
941            */
942            public static int searchCount(long companyId, java.lang.String keywords,
943                    java.lang.Integer[] types)
944                    throws com.liferay.portal.kernel.exception.SystemException {
945                    return getService().searchCount(companyId, keywords, types);
946            }
947    
948            /**
949            * Returns the number of roles that match the keywords, types and params.
950            *
951            * @param companyId the primary key of the company
952            * @param keywords the keywords (space separated), which may occur in the
953            role's name or description (optionally <code>null</code>)
954            * @param types the role types (optionally <code>null</code>)
955            * @param params the finder parameters. For more information, see {@link
956            com.liferay.portal.service.persistence.RoleFinder}
957            * @return the number of matching roles
958            * @throws SystemException if a system exception occurred
959            */
960            public static int searchCount(long companyId, java.lang.String keywords,
961                    java.lang.Integer[] types,
962                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
963                    throws com.liferay.portal.kernel.exception.SystemException {
964                    return getService().searchCount(companyId, keywords, types, params);
965            }
966    
967            /**
968            * Returns the number of roles that match the name, description, and types.
969            *
970            * @param companyId the primary key of the company
971            * @param name the role's name (optionally <code>null</code>)
972            * @param description the role's description (optionally <code>null</code>)
973            * @param types the role types (optionally <code>null</code>)
974            * @return the number of matching roles
975            * @throws SystemException if a system exception occurred
976            */
977            public static int searchCount(long companyId, java.lang.String name,
978                    java.lang.String description, java.lang.Integer[] types)
979                    throws com.liferay.portal.kernel.exception.SystemException {
980                    return getService().searchCount(companyId, name, description, types);
981            }
982    
983            /**
984            * Returns the number of roles that match the name, description, types, and
985            * params.
986            *
987            * @param companyId the primary key of the company
988            * @param name the role's name (optionally <code>null</code>)
989            * @param description the role's description (optionally <code>null</code>)
990            * @param types the role types (optionally <code>null</code>)
991            * @param params the finder parameters. Can specify values for
992            "permissionsResourceId" and "usersRoles" keys. For more
993            information, see {@link
994            com.liferay.portal.service.persistence.RoleFinder}
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                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
1001                    throws com.liferay.portal.kernel.exception.SystemException {
1002                    return getService()
1003                                       .searchCount(companyId, name, description, types, params);
1004            }
1005    
1006            /**
1007            * Sets the roles associated with the user, replacing the user's existing
1008            * roles. The user is reindexed after the roles are set.
1009            *
1010            * @param userId the primary key of the user
1011            * @param roleIds the primary keys of the roles
1012            * @throws PortalException if a user with the primary could not be found or
1013            if any one of the roles with the primary keys could not be found
1014            * @throws SystemException if a system exception occurred
1015            */
1016            public static void setUserRoles(long userId, long[] roleIds)
1017                    throws com.liferay.portal.kernel.exception.PortalException,
1018                            com.liferay.portal.kernel.exception.SystemException {
1019                    getService().setUserRoles(userId, roleIds);
1020            }
1021    
1022            /**
1023            * Removes the matching roles associated with the user. The user is
1024            * reindexed after the roles are removed.
1025            *
1026            * @param userId the primary key of the user
1027            * @param roleIds the primary keys of the roles
1028            * @throws PortalException if a user with the primary key could not be found
1029            or if a role with any one of the primary keys could not be found
1030            * @throws SystemException if a system exception occurred
1031            */
1032            public static void unsetUserRoles(long userId, long[] roleIds)
1033                    throws com.liferay.portal.kernel.exception.PortalException,
1034                            com.liferay.portal.kernel.exception.SystemException {
1035                    getService().unsetUserRoles(userId, roleIds);
1036            }
1037    
1038            /**
1039            * Updates the role with the primary key.
1040            *
1041            * @param roleId the primary key of the role
1042            * @param name the role's new name
1043            * @param titleMap the new localized titles (optionally <code>null</code>)
1044            to replace those existing for the role
1045            * @param descriptionMap the new localized descriptions (optionally
1046            <code>null</code>) to replace those existing for the role
1047            * @param subtype the role's new subtype (optionally <code>null</code>)
1048            * @return the role with the primary key
1049            * @throws PortalException if a role with the primary could not be found or
1050            if the role's name was invalid
1051            * @throws SystemException if a system exception occurred
1052            */
1053            public static com.liferay.portal.model.Role updateRole(long roleId,
1054                    java.lang.String name,
1055                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
1056                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
1057                    java.lang.String subtype)
1058                    throws com.liferay.portal.kernel.exception.PortalException,
1059                            com.liferay.portal.kernel.exception.SystemException {
1060                    return getService()
1061                                       .updateRole(roleId, name, titleMap, descriptionMap, subtype);
1062            }
1063    
1064            public static RoleLocalService getService() {
1065                    if (_service == null) {
1066                            _service = (RoleLocalService)PortalBeanLocatorUtil.locate(RoleLocalService.class.getName());
1067    
1068                            ReferenceRegistry.registerReference(RoleLocalServiceUtil.class,
1069                                    "_service");
1070                    }
1071    
1072                    return _service;
1073            }
1074    
1075            /**
1076             * @deprecated
1077             */
1078            public void setService(RoleLocalService service) {
1079            }
1080    
1081            private static RoleLocalService _service;
1082    }