1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service;
24  
25  
26  /**
27   * <a href="RoleLocalServiceUtil.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides static methods for the
36   * <code>com.liferay.portal.service.RoleLocalService</code>
37   * bean. The static methods of this class calls the same methods of the bean
38   * instance. It's convenient to be able to just write one line to call a method
39   * on a bean instead of writing a lookup call and a method call.
40   * </p>
41   *
42   * @author Brian Wing Shun Chan
43   *
44   * @see com.liferay.portal.service.RoleLocalService
45   *
46   */
47  public class RoleLocalServiceUtil {
48      public static com.liferay.portal.model.Role addRole(
49          com.liferay.portal.model.Role role)
50          throws com.liferay.portal.SystemException {
51          return getService().addRole(role);
52      }
53  
54      public static com.liferay.portal.model.Role createRole(long roleId) {
55          return getService().createRole(roleId);
56      }
57  
58      public static void deleteRole(long roleId)
59          throws com.liferay.portal.PortalException,
60              com.liferay.portal.SystemException {
61          getService().deleteRole(roleId);
62      }
63  
64      public static void deleteRole(com.liferay.portal.model.Role role)
65          throws com.liferay.portal.SystemException {
66          getService().deleteRole(role);
67      }
68  
69      public static java.util.List<Object> dynamicQuery(
70          com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
71          throws com.liferay.portal.SystemException {
72          return getService().dynamicQuery(dynamicQuery);
73      }
74  
75      public static java.util.List<Object> dynamicQuery(
76          com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
77          int end) throws com.liferay.portal.SystemException {
78          return getService().dynamicQuery(dynamicQuery, start, end);
79      }
80  
81      public static com.liferay.portal.model.Role getRole(long roleId)
82          throws com.liferay.portal.PortalException,
83              com.liferay.portal.SystemException {
84          return getService().getRole(roleId);
85      }
86  
87      public static java.util.List<com.liferay.portal.model.Role> getRoles(
88          int start, int end) throws com.liferay.portal.SystemException {
89          return getService().getRoles(start, end);
90      }
91  
92      public static int getRolesCount() throws com.liferay.portal.SystemException {
93          return getService().getRolesCount();
94      }
95  
96      public static com.liferay.portal.model.Role updateRole(
97          com.liferay.portal.model.Role role)
98          throws com.liferay.portal.SystemException {
99          return getService().updateRole(role);
100     }
101 
102     public static com.liferay.portal.model.Role addRole(long userId,
103         long companyId, java.lang.String name, java.lang.String description,
104         int type)
105         throws com.liferay.portal.PortalException,
106             com.liferay.portal.SystemException {
107         return getService().addRole(userId, companyId, name, description, type);
108     }
109 
110     public static com.liferay.portal.model.Role addRole(long userId,
111         long companyId, java.lang.String name, java.lang.String description,
112         int type, java.lang.String className, long classPK)
113         throws com.liferay.portal.PortalException,
114             com.liferay.portal.SystemException {
115         return getService()
116                    .addRole(userId, companyId, name, description, type,
117             className, classPK);
118     }
119 
120     public static void addUserRoles(long userId, long[] roleIds)
121         throws com.liferay.portal.SystemException {
122         getService().addUserRoles(userId, roleIds);
123     }
124 
125     public static void checkSystemRoles(long companyId)
126         throws com.liferay.portal.PortalException,
127             com.liferay.portal.SystemException {
128         getService().checkSystemRoles(companyId);
129     }
130 
131     public static com.liferay.portal.model.Role getGroupRole(long companyId,
132         long groupId)
133         throws com.liferay.portal.PortalException,
134             com.liferay.portal.SystemException {
135         return getService().getGroupRole(companyId, groupId);
136     }
137 
138     public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
139         long groupId) throws com.liferay.portal.SystemException {
140         return getService().getGroupRoles(groupId);
141     }
142 
143     public static java.util.Map<String, java.util.List<String>> getResourceRoles(
144         long companyId, java.lang.String name, int scope,
145         java.lang.String primKey) throws com.liferay.portal.SystemException {
146         return getService().getResourceRoles(companyId, name, scope, primKey);
147     }
148 
149     public static com.liferay.portal.model.Role getRole(long companyId,
150         java.lang.String name)
151         throws com.liferay.portal.PortalException,
152             com.liferay.portal.SystemException {
153         return getService().getRole(companyId, name);
154     }
155 
156     public static java.util.List<com.liferay.portal.model.Role> getRoles(
157         long companyId) throws com.liferay.portal.SystemException {
158         return getService().getRoles(companyId);
159     }
160 
161     public static java.util.List<com.liferay.portal.model.Role> getRoles(
162         long[] roleIds)
163         throws com.liferay.portal.PortalException,
164             com.liferay.portal.SystemException {
165         return getService().getRoles(roleIds);
166     }
167 
168     public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
169         long userId, long groupId) throws com.liferay.portal.SystemException {
170         return getService().getUserGroupRoles(userId, groupId);
171     }
172 
173     public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
174         long userId, long groupId) throws com.liferay.portal.SystemException {
175         return getService().getUserRelatedRoles(userId, groupId);
176     }
177 
178     public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
179         long userId, long[] groupIds) throws com.liferay.portal.SystemException {
180         return getService().getUserRelatedRoles(userId, groupIds);
181     }
182 
183     public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
184         long userId, java.util.List<com.liferay.portal.model.Group> groups)
185         throws com.liferay.portal.SystemException {
186         return getService().getUserRelatedRoles(userId, groups);
187     }
188 
189     public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
190         long userId) throws com.liferay.portal.SystemException {
191         return getService().getUserRoles(userId);
192     }
193 
194     public static boolean hasUserRole(long userId, long roleId)
195         throws com.liferay.portal.SystemException {
196         return getService().hasUserRole(userId, roleId);
197     }
198 
199     public static boolean hasUserRole(long userId, long companyId,
200         java.lang.String name, boolean inherited)
201         throws com.liferay.portal.PortalException,
202             com.liferay.portal.SystemException {
203         return getService().hasUserRole(userId, companyId, name, inherited);
204     }
205 
206     public static boolean hasUserRoles(long userId, long companyId,
207         java.lang.String[] names, boolean inherited)
208         throws com.liferay.portal.PortalException,
209             com.liferay.portal.SystemException {
210         return getService().hasUserRoles(userId, companyId, names, inherited);
211     }
212 
213     public static java.util.List<com.liferay.portal.model.Role> search(
214         long companyId, java.lang.String name, java.lang.String description,
215         java.lang.Integer type, int start, int end,
216         com.liferay.portal.kernel.util.OrderByComparator obc)
217         throws com.liferay.portal.SystemException {
218         return getService()
219                    .search(companyId, name, description, type, start, end, obc);
220     }
221 
222     public static java.util.List<com.liferay.portal.model.Role> search(
223         long companyId, java.lang.String name, java.lang.String description,
224         java.lang.Integer type, java.util.LinkedHashMap<String, Object> params,
225         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
226         throws com.liferay.portal.SystemException {
227         return getService()
228                    .search(companyId, name, description, type, params, start,
229             end, obc);
230     }
231 
232     public static int searchCount(long companyId, java.lang.String name,
233         java.lang.String description, java.lang.Integer type)
234         throws com.liferay.portal.SystemException {
235         return getService().searchCount(companyId, name, description, type);
236     }
237 
238     public static int searchCount(long companyId, java.lang.String name,
239         java.lang.String description, java.lang.Integer type,
240         java.util.LinkedHashMap<String, Object> params)
241         throws com.liferay.portal.SystemException {
242         return getService()
243                    .searchCount(companyId, name, description, type, params);
244     }
245 
246     public static void setUserRoles(long userId, long[] roleIds)
247         throws com.liferay.portal.PortalException,
248             com.liferay.portal.SystemException {
249         getService().setUserRoles(userId, roleIds);
250     }
251 
252     public static void unsetUserRoles(long userId, long[] roleIds)
253         throws com.liferay.portal.SystemException {
254         getService().unsetUserRoles(userId, roleIds);
255     }
256 
257     public static com.liferay.portal.model.Role updateRole(long roleId,
258         java.lang.String name,
259         java.util.Map<java.util.Locale, String> localeTitlesMap,
260         java.lang.String description, java.lang.String subtype)
261         throws com.liferay.portal.PortalException,
262             com.liferay.portal.SystemException {
263         return getService()
264                    .updateRole(roleId, name, localeTitlesMap, description,
265             subtype);
266     }
267 
268     public static RoleLocalService getService() {
269         if (_service == null) {
270             throw new RuntimeException("RoleLocalService is not set");
271         }
272 
273         return _service;
274     }
275 
276     public void setService(RoleLocalService service) {
277         _service = service;
278     }
279 
280     private static RoleLocalService _service;
281 }