1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service;
16  
17  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
18  
19  /**
20   * <a href="RoleServiceUtil.java.html"><b><i>View Source</i></b></a>
21   *
22   * <p>
23   * ServiceBuilder generated this class. Modifications in this class will be
24   * overwritten the next time is generated.
25   * </p>
26   *
27   * <p>
28   * This class provides static methods for the
29   * {@link RoleService} bean. The static methods of
30   * this class calls the same methods of the bean instance. It's convenient to be
31   * able to just write one line to call a method on a bean instead of writing a
32   * lookup call and a method call.
33   * </p>
34   *
35   * @author    Brian Wing Shun Chan
36   * @see       RoleService
37   * @generated
38   */
39  public class RoleServiceUtil {
40      public static com.liferay.portal.model.Role addRole(java.lang.String name,
41          java.util.Map<java.util.Locale, java.lang.String> titleMap,
42          java.lang.String description, int type)
43          throws com.liferay.portal.kernel.exception.PortalException,
44              com.liferay.portal.kernel.exception.SystemException {
45          return getService().addRole(name, titleMap, description, type);
46      }
47  
48      public static void addUserRoles(long userId, long[] roleIds)
49          throws com.liferay.portal.kernel.exception.PortalException,
50              com.liferay.portal.kernel.exception.SystemException {
51          getService().addUserRoles(userId, roleIds);
52      }
53  
54      public static void deleteRole(long roleId)
55          throws com.liferay.portal.kernel.exception.PortalException,
56              com.liferay.portal.kernel.exception.SystemException {
57          getService().deleteRole(roleId);
58      }
59  
60      public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
61          long groupId)
62          throws com.liferay.portal.kernel.exception.SystemException {
63          return getService().getGroupRoles(groupId);
64      }
65  
66      public static com.liferay.portal.model.Role getRole(long roleId)
67          throws com.liferay.portal.kernel.exception.PortalException,
68              com.liferay.portal.kernel.exception.SystemException {
69          return getService().getRole(roleId);
70      }
71  
72      public static com.liferay.portal.model.Role getRole(long companyId,
73          java.lang.String name)
74          throws com.liferay.portal.kernel.exception.PortalException,
75              com.liferay.portal.kernel.exception.SystemException {
76          return getService().getRole(companyId, name);
77      }
78  
79      public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
80          long userId, long groupId)
81          throws com.liferay.portal.kernel.exception.SystemException {
82          return getService().getUserGroupGroupRoles(userId, groupId);
83      }
84  
85      public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
86          long userId, long groupId)
87          throws com.liferay.portal.kernel.exception.SystemException {
88          return getService().getUserGroupRoles(userId, groupId);
89      }
90  
91      public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
92          long userId, java.util.List<com.liferay.portal.model.Group> groups)
93          throws com.liferay.portal.kernel.exception.SystemException {
94          return getService().getUserRelatedRoles(userId, groups);
95      }
96  
97      public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
98          long userId) throws com.liferay.portal.kernel.exception.SystemException {
99          return getService().getUserRoles(userId);
100     }
101 
102     public static boolean hasUserRole(long userId, long companyId,
103         java.lang.String name, boolean inherited)
104         throws com.liferay.portal.kernel.exception.PortalException,
105             com.liferay.portal.kernel.exception.SystemException {
106         return getService().hasUserRole(userId, companyId, name, inherited);
107     }
108 
109     public static boolean hasUserRoles(long userId, long companyId,
110         java.lang.String[] names, boolean inherited)
111         throws com.liferay.portal.kernel.exception.PortalException,
112             com.liferay.portal.kernel.exception.SystemException {
113         return getService().hasUserRoles(userId, companyId, names, inherited);
114     }
115 
116     public static void unsetUserRoles(long userId, long[] roleIds)
117         throws com.liferay.portal.kernel.exception.PortalException,
118             com.liferay.portal.kernel.exception.SystemException {
119         getService().unsetUserRoles(userId, roleIds);
120     }
121 
122     public static com.liferay.portal.model.Role updateRole(long roleId,
123         java.lang.String name,
124         java.util.Map<java.util.Locale, java.lang.String> titleMap,
125         java.lang.String description, java.lang.String subtype)
126         throws com.liferay.portal.kernel.exception.PortalException,
127             com.liferay.portal.kernel.exception.SystemException {
128         return getService()
129                    .updateRole(roleId, name, titleMap, description, subtype);
130     }
131 
132     public static RoleService getService() {
133         if (_service == null) {
134             _service = (RoleService)PortalBeanLocatorUtil.locate(RoleService.class.getName());
135         }
136 
137         return _service;
138     }
139 
140     public void setService(RoleService service) {
141         _service = service;
142     }
143 
144     private static RoleService _service;
145 }