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