001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the role local service. This utility wraps {@link com.liferay.portal.service.impl.RoleLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
023     *
024     * <p>
025     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see RoleLocalService
030     * @see com.liferay.portal.service.base.RoleLocalServiceBaseImpl
031     * @see com.liferay.portal.service.impl.RoleLocalServiceImpl
032     * @generated
033     */
034    public class RoleLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.RoleLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the role to the database. Also notifies the appropriate model listeners.
043            *
044            * @param role the role
045            * @return the role that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portal.model.Role addRole(
049                    com.liferay.portal.model.Role role)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addRole(role);
052            }
053    
054            /**
055            * Creates a new role with the primary key. Does not add the role to the database.
056            *
057            * @param roleId the primary key for the new role
058            * @return the new role
059            */
060            public static com.liferay.portal.model.Role createRole(long roleId) {
061                    return getService().createRole(roleId);
062            }
063    
064            /**
065            * Deletes the role with the primary key from the database. Also notifies the appropriate model listeners.
066            *
067            * @param roleId the primary key of the role
068            * @throws PortalException if a role with the primary key could not be found
069            * @throws SystemException if a system exception occurred
070            */
071            public static void deleteRole(long roleId)
072                    throws com.liferay.portal.kernel.exception.PortalException,
073                            com.liferay.portal.kernel.exception.SystemException {
074                    getService().deleteRole(roleId);
075            }
076    
077            /**
078            * Deletes the role from the database. Also notifies the appropriate model listeners.
079            *
080            * @param role the role
081            * @throws PortalException
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deleteRole(com.liferay.portal.model.Role role)
085                    throws com.liferay.portal.kernel.exception.PortalException,
086                            com.liferay.portal.kernel.exception.SystemException {
087                    getService().deleteRole(role);
088            }
089    
090            /**
091            * Performs a dynamic query on the database and returns the matching rows.
092            *
093            * @param dynamicQuery the dynamic query
094            * @return the matching rows
095            * @throws SystemException if a system exception occurred
096            */
097            @SuppressWarnings("rawtypes")
098            public static java.util.List dynamicQuery(
099                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getService().dynamicQuery(dynamicQuery);
102            }
103    
104            /**
105            * Performs a dynamic query on the database and returns a range of the matching rows.
106            *
107            * <p>
108            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
109            * </p>
110            *
111            * @param dynamicQuery the dynamic query
112            * @param start the lower bound of the range of model instances
113            * @param end the upper bound of the range of model instances (not inclusive)
114            * @return the range of matching rows
115            * @throws SystemException if a system exception occurred
116            */
117            @SuppressWarnings("rawtypes")
118            public static java.util.List dynamicQuery(
119                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
120                    int end) throws com.liferay.portal.kernel.exception.SystemException {
121                    return getService().dynamicQuery(dynamicQuery, start, end);
122            }
123    
124            /**
125            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
126            *
127            * <p>
128            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
129            * </p>
130            *
131            * @param dynamicQuery the dynamic query
132            * @param start the lower bound of the range of model instances
133            * @param end the upper bound of the range of model instances (not inclusive)
134            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
135            * @return the ordered range of matching rows
136            * @throws SystemException if a system exception occurred
137            */
138            @SuppressWarnings("rawtypes")
139            public static java.util.List dynamicQuery(
140                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
141                    int end,
142                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
143                    throws com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
146            }
147    
148            /**
149            * Returns the number of rows that match the dynamic query.
150            *
151            * @param dynamicQuery the dynamic query
152            * @return the number of rows that match the dynamic query
153            * @throws SystemException if a system exception occurred
154            */
155            public static long dynamicQueryCount(
156                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getService().dynamicQueryCount(dynamicQuery);
159            }
160    
161            /**
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            public static com.liferay.portal.model.Role addRole(long userId,
257                    long companyId, java.lang.String name,
258                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
259                    java.lang.String description, int type)
260                    throws com.liferay.portal.kernel.exception.PortalException,
261                            com.liferay.portal.kernel.exception.SystemException {
262                    return getService()
263                                       .addRole(userId, companyId, name, titleMap, description, type);
264            }
265    
266            public static com.liferay.portal.model.Role addRole(long userId,
267                    long companyId, java.lang.String name,
268                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
269                    java.lang.String description, int type, java.lang.String className,
270                    long classPK)
271                    throws com.liferay.portal.kernel.exception.PortalException,
272                            com.liferay.portal.kernel.exception.SystemException {
273                    return getService()
274                                       .addRole(userId, companyId, name, titleMap, description,
275                            type, className, classPK);
276            }
277    
278            public static void addUserRoles(long userId, long[] roleIds)
279                    throws com.liferay.portal.kernel.exception.PortalException,
280                            com.liferay.portal.kernel.exception.SystemException {
281                    getService().addUserRoles(userId, roleIds);
282            }
283    
284            public static void checkSystemRoles()
285                    throws com.liferay.portal.kernel.exception.PortalException,
286                            com.liferay.portal.kernel.exception.SystemException {
287                    getService().checkSystemRoles();
288            }
289    
290            public static void checkSystemRoles(long companyId)
291                    throws com.liferay.portal.kernel.exception.PortalException,
292                            com.liferay.portal.kernel.exception.SystemException {
293                    getService().checkSystemRoles(companyId);
294            }
295    
296            public static com.liferay.portal.model.Role getDefaultGroupRole(
297                    long groupId)
298                    throws com.liferay.portal.kernel.exception.PortalException,
299                            com.liferay.portal.kernel.exception.SystemException {
300                    return getService().getDefaultGroupRole(groupId);
301            }
302    
303            public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
304                    long groupId)
305                    throws com.liferay.portal.kernel.exception.SystemException {
306                    return getService().getGroupRoles(groupId);
307            }
308    
309            public static java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles(
310                    long companyId, java.lang.String name, int scope,
311                    java.lang.String primKey)
312                    throws com.liferay.portal.kernel.exception.SystemException {
313                    return getService().getResourceRoles(companyId, name, scope, primKey);
314            }
315    
316            public static java.util.List<com.liferay.portal.model.Role> getResourceRoles(
317                    long companyId, java.lang.String name, int scope,
318                    java.lang.String primKey, java.lang.String actionId)
319                    throws com.liferay.portal.kernel.exception.SystemException {
320                    return getService()
321                                       .getResourceRoles(companyId, name, scope, primKey, actionId);
322            }
323    
324            public static com.liferay.portal.model.Role getRole(long companyId,
325                    java.lang.String name)
326                    throws com.liferay.portal.kernel.exception.PortalException,
327                            com.liferay.portal.kernel.exception.SystemException {
328                    return getService().getRole(companyId, name);
329            }
330    
331            public static java.util.List<com.liferay.portal.model.Role> getRoles(
332                    int type, java.lang.String subtype)
333                    throws com.liferay.portal.kernel.exception.SystemException {
334                    return getService().getRoles(type, subtype);
335            }
336    
337            public static java.util.List<com.liferay.portal.model.Role> getRoles(
338                    long companyId)
339                    throws com.liferay.portal.kernel.exception.SystemException {
340                    return getService().getRoles(companyId);
341            }
342    
343            public static java.util.List<com.liferay.portal.model.Role> getRoles(
344                    long[] roleIds)
345                    throws com.liferay.portal.kernel.exception.PortalException,
346                            com.liferay.portal.kernel.exception.SystemException {
347                    return getService().getRoles(roleIds);
348            }
349    
350            public static java.util.List<com.liferay.portal.model.Role> getSubtypeRoles(
351                    java.lang.String subtype)
352                    throws com.liferay.portal.kernel.exception.SystemException {
353                    return getService().getSubtypeRoles(subtype);
354            }
355    
356            public static int getSubtypeRolesCount(java.lang.String subtype)
357                    throws com.liferay.portal.kernel.exception.SystemException {
358                    return getService().getSubtypeRolesCount(subtype);
359            }
360    
361            public static com.liferay.portal.model.Role getTeamRole(long companyId,
362                    long teamId)
363                    throws com.liferay.portal.kernel.exception.PortalException,
364                            com.liferay.portal.kernel.exception.SystemException {
365                    return getService().getTeamRole(companyId, teamId);
366            }
367    
368            public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
369                    long userId, long groupId)
370                    throws com.liferay.portal.kernel.exception.SystemException {
371                    return getService().getUserGroupGroupRoles(userId, groupId);
372            }
373    
374            public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
375                    long userId, long groupId)
376                    throws com.liferay.portal.kernel.exception.SystemException {
377                    return getService().getUserGroupRoles(userId, groupId);
378            }
379    
380            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
381                    long userId, java.util.List<com.liferay.portal.model.Group> groups)
382                    throws com.liferay.portal.kernel.exception.SystemException {
383                    return getService().getUserRelatedRoles(userId, groups);
384            }
385    
386            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
387                    long userId, long groupId)
388                    throws com.liferay.portal.kernel.exception.SystemException {
389                    return getService().getUserRelatedRoles(userId, groupId);
390            }
391    
392            public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
393                    long userId, long[] groupIds)
394                    throws com.liferay.portal.kernel.exception.SystemException {
395                    return getService().getUserRelatedRoles(userId, groupIds);
396            }
397    
398            public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
399                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
400                    return getService().getUserRoles(userId);
401            }
402    
403            public static boolean hasUserRole(long userId, long roleId)
404                    throws com.liferay.portal.kernel.exception.SystemException {
405                    return getService().hasUserRole(userId, roleId);
406            }
407    
408            /**
409            * Returns <code>true</code> if the user has the regular role.
410            *
411            * @return <code>true</code> if the user has the regular role
412            */
413            public static boolean hasUserRole(long userId, long companyId,
414                    java.lang.String name, boolean inherited)
415                    throws com.liferay.portal.kernel.exception.PortalException,
416                            com.liferay.portal.kernel.exception.SystemException {
417                    return getService().hasUserRole(userId, companyId, name, inherited);
418            }
419    
420            /**
421            * Returns <code>true</code> if the user has any one of the specified
422            * regular roles.
423            *
424            * @return <code>true</code> if the user has the regular role
425            */
426            public static boolean hasUserRoles(long userId, long companyId,
427                    java.lang.String[] names, boolean inherited)
428                    throws com.liferay.portal.kernel.exception.PortalException,
429                            com.liferay.portal.kernel.exception.SystemException {
430                    return getService().hasUserRoles(userId, companyId, names, inherited);
431            }
432    
433            public static java.util.List<com.liferay.portal.model.Role> search(
434                    long companyId, java.lang.String keywords, java.lang.Integer[] types,
435                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
436                    throws com.liferay.portal.kernel.exception.SystemException {
437                    return getService().search(companyId, keywords, types, start, end, obc);
438            }
439    
440            public static java.util.List<com.liferay.portal.model.Role> search(
441                    long companyId, java.lang.String keywords, java.lang.Integer[] types,
442                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
443                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
444                    throws com.liferay.portal.kernel.exception.SystemException {
445                    return getService()
446                                       .search(companyId, keywords, types, params, start, end, obc);
447            }
448    
449            public static java.util.List<com.liferay.portal.model.Role> search(
450                    long companyId, java.lang.String name, java.lang.String description,
451                    java.lang.Integer[] types, int start, int end,
452                    com.liferay.portal.kernel.util.OrderByComparator obc)
453                    throws com.liferay.portal.kernel.exception.SystemException {
454                    return getService()
455                                       .search(companyId, name, description, types, start, end, obc);
456            }
457    
458            public static java.util.List<com.liferay.portal.model.Role> search(
459                    long companyId, java.lang.String name, java.lang.String description,
460                    java.lang.Integer[] types,
461                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
462                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
463                    throws com.liferay.portal.kernel.exception.SystemException {
464                    return getService()
465                                       .search(companyId, name, description, types, params, start,
466                            end, obc);
467            }
468    
469            public static int searchCount(long companyId, java.lang.String keywords,
470                    java.lang.Integer[] types)
471                    throws com.liferay.portal.kernel.exception.SystemException {
472                    return getService().searchCount(companyId, keywords, types);
473            }
474    
475            public static int searchCount(long companyId, java.lang.String keywords,
476                    java.lang.Integer[] types,
477                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
478                    throws com.liferay.portal.kernel.exception.SystemException {
479                    return getService().searchCount(companyId, keywords, types, params);
480            }
481    
482            public static int searchCount(long companyId, java.lang.String name,
483                    java.lang.String description, java.lang.Integer[] types)
484                    throws com.liferay.portal.kernel.exception.SystemException {
485                    return getService().searchCount(companyId, name, description, types);
486            }
487    
488            public static int searchCount(long companyId, java.lang.String name,
489                    java.lang.String description, java.lang.Integer[] types,
490                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
491                    throws com.liferay.portal.kernel.exception.SystemException {
492                    return getService()
493                                       .searchCount(companyId, name, description, types, params);
494            }
495    
496            public static void setUserRoles(long userId, long[] roleIds)
497                    throws com.liferay.portal.kernel.exception.PortalException,
498                            com.liferay.portal.kernel.exception.SystemException {
499                    getService().setUserRoles(userId, roleIds);
500            }
501    
502            public static void unsetUserRoles(long userId, long[] roleIds)
503                    throws com.liferay.portal.kernel.exception.PortalException,
504                            com.liferay.portal.kernel.exception.SystemException {
505                    getService().unsetUserRoles(userId, roleIds);
506            }
507    
508            public static com.liferay.portal.model.Role updateRole(long roleId,
509                    java.lang.String name,
510                    java.util.Map<java.util.Locale, java.lang.String> titleMap,
511                    java.lang.String description, java.lang.String subtype)
512                    throws com.liferay.portal.kernel.exception.PortalException,
513                            com.liferay.portal.kernel.exception.SystemException {
514                    return getService()
515                                       .updateRole(roleId, name, titleMap, description, subtype);
516            }
517    
518            public static RoleLocalService getService() {
519                    if (_service == null) {
520                            _service = (RoleLocalService)PortalBeanLocatorUtil.locate(RoleLocalService.class.getName());
521    
522                            ReferenceRegistry.registerReference(RoleLocalServiceUtil.class,
523                                    "_service");
524                            MethodCache.remove(RoleLocalService.class);
525                    }
526    
527                    return _service;
528            }
529    
530            public void setService(RoleLocalService service) {
531                    MethodCache.remove(RoleLocalService.class);
532    
533                    _service = service;
534    
535                    ReferenceRegistry.registerReference(RoleLocalServiceUtil.class,
536                            "_service");
537                    MethodCache.remove(RoleLocalService.class);
538            }
539    
540            private static RoleLocalService _service;
541    }