1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service;
16  
17  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
18  import com.liferay.portal.kernel.util.MethodCache;
19  import com.liferay.portal.kernel.util.ReferenceRegistry;
20  
21  /**
22   * <a href="RoleLocalServiceUtil.java.html"><b><i>View Source</i></b></a>
23   *
24   * <p>
25   * ServiceBuilder generated this class. Modifications in this class will be
26   * overwritten the next time is generated.
27   * </p>
28   *
29   * <p>
30   * This class provides static methods for the
31   * {@link RoleLocalService} bean. The static methods of
32   * this class calls the same methods of the bean instance. It's convenient to be
33   * able to just write one line to call a method on a bean instead of writing a
34   * lookup call and a method call.
35   * </p>
36   *
37   * @author    Brian Wing Shun Chan
38   * @see       RoleLocalService
39   * @generated
40   */
41  public class RoleLocalServiceUtil {
42      public static com.liferay.portal.model.Role addRole(
43          com.liferay.portal.model.Role role)
44          throws com.liferay.portal.SystemException {
45          return getService().addRole(role);
46      }
47  
48      public static com.liferay.portal.model.Role createRole(long roleId) {
49          return getService().createRole(roleId);
50      }
51  
52      public static void deleteRole(long roleId)
53          throws com.liferay.portal.PortalException,
54              com.liferay.portal.SystemException {
55          getService().deleteRole(roleId);
56      }
57  
58      public static void deleteRole(com.liferay.portal.model.Role role)
59          throws com.liferay.portal.SystemException {
60          getService().deleteRole(role);
61      }
62  
63      @SuppressWarnings("rawtypes")
64      public static java.util.List dynamicQuery(
65          com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
66          throws com.liferay.portal.SystemException {
67          return getService().dynamicQuery(dynamicQuery);
68      }
69  
70      @SuppressWarnings("rawtypes")
71      public static java.util.List dynamicQuery(
72          com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
73          int end) throws com.liferay.portal.SystemException {
74          return getService().dynamicQuery(dynamicQuery, start, end);
75      }
76  
77      @SuppressWarnings("rawtypes")
78      public static java.util.List dynamicQuery(
79          com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
80          int end,
81          com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
82          throws com.liferay.portal.SystemException {
83          return getService()
84                     .dynamicQuery(dynamicQuery, start, end, orderByComparator);
85      }
86  
87      public static int dynamicQueryCount(
88          com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
89          throws com.liferay.portal.SystemException {
90          return getService().dynamicQueryCount(dynamicQuery);
91      }
92  
93      public static com.liferay.portal.model.Role getRole(long roleId)
94          throws com.liferay.portal.PortalException,
95              com.liferay.portal.SystemException {
96          return getService().getRole(roleId);
97      }
98  
99      public static java.util.List<com.liferay.portal.model.Role> getRoles(
100         int start, int end) throws com.liferay.portal.SystemException {
101         return getService().getRoles(start, end);
102     }
103 
104     public static int getRolesCount() throws com.liferay.portal.SystemException {
105         return getService().getRolesCount();
106     }
107 
108     public static com.liferay.portal.model.Role updateRole(
109         com.liferay.portal.model.Role role)
110         throws com.liferay.portal.SystemException {
111         return getService().updateRole(role);
112     }
113 
114     public static com.liferay.portal.model.Role updateRole(
115         com.liferay.portal.model.Role role, boolean merge)
116         throws com.liferay.portal.SystemException {
117         return getService().updateRole(role, merge);
118     }
119 
120     public static com.liferay.portal.model.Role addRole(long userId,
121         long companyId, java.lang.String name, java.lang.String description,
122         int type)
123         throws com.liferay.portal.PortalException,
124             com.liferay.portal.SystemException {
125         return getService().addRole(userId, companyId, name, description, type);
126     }
127 
128     public static com.liferay.portal.model.Role addRole(long userId,
129         long companyId, java.lang.String name, java.lang.String description,
130         int type, java.lang.String className, long classPK)
131         throws com.liferay.portal.PortalException,
132             com.liferay.portal.SystemException {
133         return getService()
134                    .addRole(userId, companyId, name, description, type,
135             className, classPK);
136     }
137 
138     public static void addUserRoles(long userId, long[] roleIds)
139         throws com.liferay.portal.SystemException {
140         getService().addUserRoles(userId, roleIds);
141     }
142 
143     public static void checkSystemRoles(long companyId)
144         throws com.liferay.portal.PortalException,
145             com.liferay.portal.SystemException {
146         getService().checkSystemRoles(companyId);
147     }
148 
149     public static com.liferay.portal.model.Role getGroupRole(long companyId,
150         long groupId)
151         throws com.liferay.portal.PortalException,
152             com.liferay.portal.SystemException {
153         return getService().getGroupRole(companyId, groupId);
154     }
155 
156     public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
157         long groupId) throws com.liferay.portal.SystemException {
158         return getService().getGroupRoles(groupId);
159     }
160 
161     public static java.util.Map<java.lang.String, java.util.List<java.lang.String>> getResourceRoles(
162         long companyId, java.lang.String name, int scope,
163         java.lang.String primKey) throws com.liferay.portal.SystemException {
164         return getService().getResourceRoles(companyId, name, scope, primKey);
165     }
166 
167     public static com.liferay.portal.model.Role getRole(long companyId,
168         java.lang.String name)
169         throws com.liferay.portal.PortalException,
170             com.liferay.portal.SystemException {
171         return getService().getRole(companyId, name);
172     }
173 
174     public static java.util.List<com.liferay.portal.model.Role> getRoles(
175         long companyId) throws com.liferay.portal.SystemException {
176         return getService().getRoles(companyId);
177     }
178 
179     public static java.util.List<com.liferay.portal.model.Role> getRoles(
180         long[] roleIds)
181         throws com.liferay.portal.PortalException,
182             com.liferay.portal.SystemException {
183         return getService().getRoles(roleIds);
184     }
185 
186     public static java.util.List<com.liferay.portal.model.Role> getRoles(
187         int type, java.lang.String subtype)
188         throws com.liferay.portal.SystemException {
189         return getService().getRoles(type, subtype);
190     }
191 
192     public static java.util.List<com.liferay.portal.model.Role> getSubtypeRoles(
193         java.lang.String subtype) throws com.liferay.portal.SystemException {
194         return getService().getSubtypeRoles(subtype);
195     }
196 
197     public static int getSubtypeRolesCount(java.lang.String subtype)
198         throws com.liferay.portal.SystemException {
199         return getService().getSubtypeRolesCount(subtype);
200     }
201 
202     public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
203         long userId, long groupId) throws com.liferay.portal.SystemException {
204         return getService().getUserGroupGroupRoles(userId, groupId);
205     }
206 
207     public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
208         long userId, long groupId) throws com.liferay.portal.SystemException {
209         return getService().getUserGroupRoles(userId, groupId);
210     }
211 
212     public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
213         long userId, long groupId) throws com.liferay.portal.SystemException {
214         return getService().getUserRelatedRoles(userId, groupId);
215     }
216 
217     public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
218         long userId, long[] groupIds) throws com.liferay.portal.SystemException {
219         return getService().getUserRelatedRoles(userId, groupIds);
220     }
221 
222     public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
223         long userId, java.util.List<com.liferay.portal.model.Group> groups)
224         throws com.liferay.portal.SystemException {
225         return getService().getUserRelatedRoles(userId, groups);
226     }
227 
228     public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
229         long userId) throws com.liferay.portal.SystemException {
230         return getService().getUserRoles(userId);
231     }
232 
233     public static boolean hasUserRole(long userId, long roleId)
234         throws com.liferay.portal.SystemException {
235         return getService().hasUserRole(userId, roleId);
236     }
237 
238     /**
239     * Returns true if the user has the regular role.
240     *
241     * @return true if the user has the regular role
242     */
243     public static boolean hasUserRole(long userId, long companyId,
244         java.lang.String name, boolean inherited)
245         throws com.liferay.portal.PortalException,
246             com.liferay.portal.SystemException {
247         return getService().hasUserRole(userId, companyId, name, inherited);
248     }
249 
250     /**
251     * Returns true if the user has any one of the specified regular roles.
252     *
253     * @return true if the user has the regular role
254     */
255     public static boolean hasUserRoles(long userId, long companyId,
256         java.lang.String[] names, boolean inherited)
257         throws com.liferay.portal.PortalException,
258             com.liferay.portal.SystemException {
259         return getService().hasUserRoles(userId, companyId, names, inherited);
260     }
261 
262     public static java.util.List<com.liferay.portal.model.Role> search(
263         long companyId, java.lang.String name, java.lang.String description,
264         java.lang.Integer type, int start, int end,
265         com.liferay.portal.kernel.util.OrderByComparator obc)
266         throws com.liferay.portal.SystemException {
267         return getService()
268                    .search(companyId, name, description, type, start, end, obc);
269     }
270 
271     public static java.util.List<com.liferay.portal.model.Role> search(
272         long companyId, java.lang.String name, java.lang.String description,
273         java.lang.Integer type,
274         java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
275         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
276         throws com.liferay.portal.SystemException {
277         return getService()
278                    .search(companyId, name, description, type, params, start,
279             end, obc);
280     }
281 
282     public static int searchCount(long companyId, java.lang.String name,
283         java.lang.String description, java.lang.Integer type)
284         throws com.liferay.portal.SystemException {
285         return getService().searchCount(companyId, name, description, type);
286     }
287 
288     public static int searchCount(long companyId, java.lang.String name,
289         java.lang.String description, java.lang.Integer type,
290         java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
291         throws com.liferay.portal.SystemException {
292         return getService()
293                    .searchCount(companyId, name, description, type, params);
294     }
295 
296     public static void setUserRoles(long userId, long[] roleIds)
297         throws com.liferay.portal.PortalException,
298             com.liferay.portal.SystemException {
299         getService().setUserRoles(userId, roleIds);
300     }
301 
302     public static void unsetUserRoles(long userId, long[] roleIds)
303         throws com.liferay.portal.PortalException,
304             com.liferay.portal.SystemException {
305         getService().unsetUserRoles(userId, roleIds);
306     }
307 
308     public static com.liferay.portal.model.Role updateRole(long roleId,
309         java.lang.String name,
310         java.util.Map<java.util.Locale, java.lang.String> localeTitlesMap,
311         java.lang.String description, java.lang.String subtype)
312         throws com.liferay.portal.PortalException,
313             com.liferay.portal.SystemException {
314         return getService()
315                    .updateRole(roleId, name, localeTitlesMap, description,
316             subtype);
317     }
318 
319     public static RoleLocalService getService() {
320         if (_service == null) {
321             _service = (RoleLocalService)PortalBeanLocatorUtil.locate(RoleLocalService.class.getName());
322 
323             ReferenceRegistry.registerReference(RoleLocalServiceUtil.class,
324                 "_service");
325             MethodCache.remove(RoleLocalService.class);
326         }
327 
328         return _service;
329     }
330 
331     public void setService(RoleLocalService service) {
332         MethodCache.remove(RoleLocalService.class);
333 
334         _service = service;
335 
336         ReferenceRegistry.registerReference(RoleLocalServiceUtil.class,
337             "_service");
338         MethodCache.remove(RoleLocalService.class);
339     }
340 
341     private static RoleLocalService _service;
342 }