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