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