001    /**
002     * Copyright (c) 2000-2010 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    
019    /**
020     * 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.
021     *
022     * <p>
023     * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.RoleLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
024     * </p>
025     *
026     * <p>
027     * 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.
028     * </p>
029     *
030     * @author Brian Wing Shun Chan
031     * @see RoleLocalService
032     * @see com.liferay.portal.service.base.RoleLocalServiceBaseImpl
033     * @see com.liferay.portal.service.impl.RoleLocalServiceImpl
034     * @generated
035     */
036    public class RoleLocalServiceUtil {
037            /**
038            * Adds the role to the database. Also notifies the appropriate model listeners.
039            *
040            * @param role the role to add
041            * @return the role that was added
042            * @throws SystemException if a system exception occurred
043            */
044            public static com.liferay.portal.model.Role addRole(
045                    com.liferay.portal.model.Role role)
046                    throws com.liferay.portal.kernel.exception.SystemException {
047                    return getService().addRole(role);
048            }
049    
050            /**
051            * Creates a new role with the primary key. Does not add the role to the database.
052            *
053            * @param roleId the primary key for the new role
054            * @return the new role
055            */
056            public static com.liferay.portal.model.Role createRole(long roleId) {
057                    return getService().createRole(roleId);
058            }
059    
060            /**
061            * Deletes the role with the primary key from the database. Also notifies the appropriate model listeners.
062            *
063            * @param roleId the primary key of the role to delete
064            * @throws PortalException if a role with the primary key could not be found
065            * @throws SystemException if a system exception occurred
066            */
067            public static void deleteRole(long roleId)
068                    throws com.liferay.portal.kernel.exception.PortalException,
069                            com.liferay.portal.kernel.exception.SystemException {
070                    getService().deleteRole(roleId);
071            }
072    
073            /**
074            * Deletes the role from the database. Also notifies the appropriate model listeners.
075            *
076            * @param role the role to delete
077            * @throws SystemException if a system exception occurred
078            */
079            public static void deleteRole(com.liferay.portal.model.Role role)
080                    throws com.liferay.portal.kernel.exception.SystemException {
081                    getService().deleteRole(role);
082            }
083    
084            /**
085            * Performs a dynamic query on the database and returns the matching rows.
086            *
087            * @param dynamicQuery the dynamic query to search with
088            * @return the matching rows
089            * @throws SystemException if a system exception occurred
090            */
091            @SuppressWarnings("rawtypes")
092            public static java.util.List dynamicQuery(
093                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
094                    throws com.liferay.portal.kernel.exception.SystemException {
095                    return getService().dynamicQuery(dynamicQuery);
096            }
097    
098            /**
099            * Performs a dynamic query on the database and returns a range of the matching rows.
100            *
101            * <p>
102            * 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.
103            * </p>
104            *
105            * @param dynamicQuery the dynamic query to search with
106            * @param start the lower bound of the range of model instances to return
107            * @param end the upper bound of the range of model instances to return (not inclusive)
108            * @return the range of matching rows
109            * @throws SystemException if a system exception occurred
110            */
111            @SuppressWarnings("rawtypes")
112            public static java.util.List dynamicQuery(
113                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
114                    int end) throws com.liferay.portal.kernel.exception.SystemException {
115                    return getService().dynamicQuery(dynamicQuery, start, end);
116            }
117    
118            /**
119            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
120            *
121            * <p>
122            * 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.
123            * </p>
124            *
125            * @param dynamicQuery the dynamic query to search with
126            * @param start the lower bound of the range of model instances to return
127            * @param end the upper bound of the range of model instances to return (not inclusive)
128            * @param orderByComparator the comparator to order the results by
129            * @return the ordered range of matching rows
130            * @throws SystemException if a system exception occurred
131            */
132            @SuppressWarnings("rawtypes")
133            public static java.util.List dynamicQuery(
134                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
135                    int end,
136                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
137                    throws com.liferay.portal.kernel.exception.SystemException {
138                    return getService()
139                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
140            }
141    
142            /**
143            * Counts the number of rows that match the dynamic query.
144            *
145            * @param dynamicQuery the dynamic query to search with
146            * @return the number of rows that match the dynamic query
147            * @throws SystemException if a system exception occurred
148            */
149            public static long dynamicQueryCount(
150                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
151                    throws com.liferay.portal.kernel.exception.SystemException {
152                    return getService().dynamicQueryCount(dynamicQuery);
153            }
154    
155            /**
156            * Gets the role with the primary key.
157            *
158            * @param roleId the primary key of the role to get
159            * @return the role
160            * @throws PortalException if a role with the primary key could not be found
161            * @throws SystemException if a system exception occurred
162            */
163            public static com.liferay.portal.model.Role getRole(long roleId)
164                    throws com.liferay.portal.kernel.exception.PortalException,
165                            com.liferay.portal.kernel.exception.SystemException {
166                    return getService().getRole(roleId);
167            }
168    
169            /**
170            * Gets a range of all the roles.
171            *
172            * <p>
173            * 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.
174            * </p>
175            *
176            * @param start the lower bound of the range of roles to return
177            * @param end the upper bound of the range of roles to return (not inclusive)
178            * @return the range of roles
179            * @throws SystemException if a system exception occurred
180            */
181            public static java.util.List<com.liferay.portal.model.Role> getRoles(
182                    int start, int end)
183                    throws com.liferay.portal.kernel.exception.SystemException {
184                    return getService().getRoles(start, end);
185            }
186    
187            /**
188            * Gets the number of roles.
189            *
190            * @return the number of roles
191            * @throws SystemException if a system exception occurred
192            */
193            public static int getRolesCount()
194                    throws com.liferay.portal.kernel.exception.SystemException {
195                    return getService().getRolesCount();
196            }
197    
198            /**
199            * Updates the role in the database. Also notifies the appropriate model listeners.
200            *
201            * @param role the role to update
202            * @return the role that was updated
203            * @throws SystemException if a system exception occurred
204            */
205            public static com.liferay.portal.model.Role updateRole(
206                    com.liferay.portal.model.Role role)
207                    throws com.liferay.portal.kernel.exception.SystemException {
208                    return getService().updateRole(role);
209            }
210    
211            /**
212            * Updates the role in the database. Also notifies the appropriate model listeners.
213            *
214            * @param role the role to update
215            * @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.
216            * @return the role that was updated
217            * @throws SystemException if a system exception occurred
218            */
219            public static com.liferay.portal.model.Role updateRole(
220                    com.liferay.portal.model.Role role, boolean merge)
221                    throws com.liferay.portal.kernel.exception.SystemException {
222                    return getService().updateRole(role, merge);
223            }
224    
225            public static com.liferay.portal.model.Role addRole(long userId,
226                    long companyId, java.lang.String name,
227                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
228                    java.lang.String description, int type)
229                    throws com.liferay.portal.kernel.exception.PortalException,
230                            com.liferay.portal.kernel.exception.SystemException {
231                    return getService()
232                                       .addRole(userId, companyId, name, titleMap, description, type);
233            }
234    
235            public static com.liferay.portal.model.Role addRole(long userId,
236                    long companyId, java.lang.String name,
237                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
238                    java.lang.String description, int type, java.lang.String className,
239                    long classPK)
240                    throws com.liferay.portal.kernel.exception.PortalException,
241                            com.liferay.portal.kernel.exception.SystemException {
242                    return getService()
243                                       .addRole(userId, companyId, name, titleMap, description,
244                            type, className, classPK);
245            }
246    
247            public static void addUserRoles(long userId, long[] roleIds)
248                    throws com.liferay.portal.kernel.exception.PortalException,
249                            com.liferay.portal.kernel.exception.SystemException {
250                    getService().addUserRoles(userId, roleIds);
251            }
252    
253            public static void checkSystemRoles(long companyId)
254                    throws com.liferay.portal.kernel.exception.PortalException,
255                            com.liferay.portal.kernel.exception.SystemException {
256                    getService().checkSystemRoles(companyId);
257            }
258    
259            public static com.liferay.portal.model.Role getDefaultGroupRole(
260                    long groupId)
261                    throws com.liferay.portal.kernel.exception.PortalException,
262                            com.liferay.portal.kernel.exception.SystemException {
263                    return getService().getDefaultGroupRole(groupId);
264            }
265    
266            public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
267                    long groupId)
268                    throws com.liferay.portal.kernel.exception.SystemException {
269                    return getService().getGroupRoles(groupId);
270            }
271    
272            public static java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles(
273                    long companyId, java.lang.String name, int scope,
274                    java.lang.String primKey)
275                    throws com.liferay.portal.kernel.exception.SystemException {
276                    return getService().getResourceRoles(companyId, name, scope, primKey);
277            }
278    
279            public static com.liferay.portal.model.Role getRole(long companyId,
280                    java.lang.String name)
281                    throws com.liferay.portal.kernel.exception.PortalException,
282                            com.liferay.portal.kernel.exception.SystemException {
283                    return getService().getRole(companyId, name);
284            }
285    
286            public static java.util.List<com.liferay.portal.model.Role> getRoles(
287                    long companyId)
288                    throws com.liferay.portal.kernel.exception.SystemException {
289                    return getService().getRoles(companyId);
290            }
291    
292            public static java.util.List<com.liferay.portal.model.Role> getRoles(
293                    long[] roleIds)
294                    throws com.liferay.portal.kernel.exception.PortalException,
295                            com.liferay.portal.kernel.exception.SystemException {
296                    return getService().getRoles(roleIds);
297            }
298    
299            public static java.util.List<com.liferay.portal.model.Role> getRoles(
300                    int type, java.lang.String subtype)
301                    throws com.liferay.portal.kernel.exception.SystemException {
302                    return getService().getRoles(type, subtype);
303            }
304    
305            public static java.util.List<com.liferay.portal.model.Role> getSubtypeRoles(
306                    java.lang.String subtype)
307                    throws com.liferay.portal.kernel.exception.SystemException {
308                    return getService().getSubtypeRoles(subtype);
309            }
310    
311            public static int getSubtypeRolesCount(java.lang.String subtype)
312                    throws com.liferay.portal.kernel.exception.SystemException {
313                    return getService().getSubtypeRolesCount(subtype);
314            }
315    
316            public static com.liferay.portal.model.Role getTeamRole(long companyId,
317                    long teamId)
318                    throws com.liferay.portal.kernel.exception.PortalException,
319                            com.liferay.portal.kernel.exception.SystemException {
320                    return getService().getTeamRole(companyId, teamId);
321            }
322    
323            public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
324                    long userId, long groupId)
325                    throws com.liferay.portal.kernel.exception.SystemException {
326                    return getService().getUserGroupGroupRoles(userId, groupId);
327            }
328    
329            public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
330                    long userId, long groupId)
331                    throws com.liferay.portal.kernel.exception.SystemException {
332                    return getService().getUserGroupRoles(userId, groupId);
333            }
334    
335            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
336                    long userId, long groupId)
337                    throws com.liferay.portal.kernel.exception.SystemException {
338                    return getService().getUserRelatedRoles(userId, groupId);
339            }
340    
341            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
342                    long userId, long[] groupIds)
343                    throws com.liferay.portal.kernel.exception.SystemException {
344                    return getService().getUserRelatedRoles(userId, groupIds);
345            }
346    
347            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
348                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
349                    throws com.liferay.portal.kernel.exception.SystemException {
350                    return getService().getUserRelatedRoles(userId, groups);
351            }
352    
353            public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
354                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
355                    return getService().getUserRoles(userId);
356            }
357    
358            public static boolean hasUserRole(long userId, long roleId)
359                    throws com.liferay.portal.kernel.exception.SystemException {
360                    return getService().hasUserRole(userId, roleId);
361            }
362    
363            /**
364            * Returns <code>true</code> if the user has the regular role.
365            *
366            * @return <code>true</code> if the user has the regular role
367            */
368            public static boolean hasUserRole(long userId, long companyId,
369                    java.lang.String name, boolean inherited)
370                    throws com.liferay.portal.kernel.exception.PortalException,
371                            com.liferay.portal.kernel.exception.SystemException {
372                    return getService().hasUserRole(userId, companyId, name, inherited);
373            }
374    
375            /**
376            * Returns <code>true</code> if the user has any one of the specified
377            * regular roles.
378            *
379            * @return <code>true</code> if the user has the regular role
380            */
381            public static boolean hasUserRoles(long userId, long companyId,
382                    java.lang.String[] names, boolean inherited)
383                    throws com.liferay.portal.kernel.exception.PortalException,
384                            com.liferay.portal.kernel.exception.SystemException {
385                    return getService().hasUserRoles(userId, companyId, names, inherited);
386            }
387    
388            public static java.util.List<com.liferay.portal.model.Role> search(
389                    long companyId, java.lang.String name, java.lang.String description,
390                    java.lang.Integer[] types, int start, int end,
391                    com.liferay.portal.kernel.util.OrderByComparator obc)
392                    throws com.liferay.portal.kernel.exception.SystemException {
393                    return getService()
394                                       .search(companyId, name, description, types, start, end, obc);
395            }
396    
397            public static java.util.List<com.liferay.portal.model.Role> search(
398                    long companyId, java.lang.String name, java.lang.String description,
399                    java.lang.Integer[] types,
400                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
401                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
402                    throws com.liferay.portal.kernel.exception.SystemException {
403                    return getService()
404                                       .search(companyId, name, description, types, params, start,
405                            end, obc);
406            }
407    
408            public static int searchCount(long companyId, java.lang.String name,
409                    java.lang.String description, java.lang.Integer[] types)
410                    throws com.liferay.portal.kernel.exception.SystemException {
411                    return getService().searchCount(companyId, name, description, types);
412            }
413    
414            public static int searchCount(long companyId, java.lang.String name,
415                    java.lang.String description, java.lang.Integer[] types,
416                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
417                    throws com.liferay.portal.kernel.exception.SystemException {
418                    return getService()
419                                       .searchCount(companyId, name, description, types, params);
420            }
421    
422            public static void setUserRoles(long userId, long[] roleIds)
423                    throws com.liferay.portal.kernel.exception.PortalException,
424                            com.liferay.portal.kernel.exception.SystemException {
425                    getService().setUserRoles(userId, roleIds);
426            }
427    
428            public static void unsetUserRoles(long userId, long[] roleIds)
429                    throws com.liferay.portal.kernel.exception.PortalException,
430                            com.liferay.portal.kernel.exception.SystemException {
431                    getService().unsetUserRoles(userId, roleIds);
432            }
433    
434            public static com.liferay.portal.model.Role updateRole(long roleId,
435                    java.lang.String name,
436                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
437                    java.lang.String description, java.lang.String subtype)
438                    throws com.liferay.portal.kernel.exception.PortalException,
439                            com.liferay.portal.kernel.exception.SystemException {
440                    return getService()
441                                       .updateRole(roleId, name, titleMap, description, subtype);
442            }
443    
444            public static RoleLocalService getService() {
445                    if (_service == null) {
446                            _service = (RoleLocalService)PortalBeanLocatorUtil.locate(RoleLocalService.class.getName());
447                    }
448    
449                    return _service;
450            }
451    
452            public void setService(RoleLocalService service) {
453                    _service = service;
454            }
455    
456            private static RoleLocalService _service;
457    }