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, 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 com.liferay.portal.model.Role getGroupRole(long companyId,
61          long groupId)
62          throws com.liferay.portal.kernel.exception.PortalException,
63              com.liferay.portal.kernel.exception.SystemException {
64          return getService().getGroupRole(companyId, groupId);
65      }
66  
67      public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
68          long groupId)
69          throws com.liferay.portal.kernel.exception.SystemException {
70          return getService().getGroupRoles(groupId);
71      }
72  
73      public static com.liferay.portal.model.Role getRole(long roleId)
74          throws com.liferay.portal.kernel.exception.PortalException,
75              com.liferay.portal.kernel.exception.SystemException {
76          return getService().getRole(roleId);
77      }
78  
79      public static com.liferay.portal.model.Role getRole(long companyId,
80          java.lang.String name)
81          throws com.liferay.portal.kernel.exception.PortalException,
82              com.liferay.portal.kernel.exception.SystemException {
83          return getService().getRole(companyId, name);
84      }
85  
86      public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
87          long userId, long groupId)
88          throws com.liferay.portal.kernel.exception.SystemException {
89          return getService().getUserGroupGroupRoles(userId, groupId);
90      }
91  
92      public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
93          long userId, long groupId)
94          throws com.liferay.portal.kernel.exception.SystemException {
95          return getService().getUserGroupRoles(userId, groupId);
96      }
97  
98      public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
99          long userId, java.util.List<com.liferay.portal.model.Group> groups)
100         throws com.liferay.portal.kernel.exception.SystemException {
101         return getService().getUserRelatedRoles(userId, groups);
102     }
103 
104     public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
105         long userId) throws com.liferay.portal.kernel.exception.SystemException {
106         return getService().getUserRoles(userId);
107     }
108 
109     public static boolean hasUserRole(long userId, long companyId,
110         java.lang.String name, boolean inherited)
111         throws com.liferay.portal.kernel.exception.PortalException,
112             com.liferay.portal.kernel.exception.SystemException {
113         return getService().hasUserRole(userId, companyId, name, inherited);
114     }
115 
116     public static boolean hasUserRoles(long userId, long companyId,
117         java.lang.String[] names, boolean inherited)
118         throws com.liferay.portal.kernel.exception.PortalException,
119             com.liferay.portal.kernel.exception.SystemException {
120         return getService().hasUserRoles(userId, companyId, names, inherited);
121     }
122 
123     public static void unsetUserRoles(long userId, long[] roleIds)
124         throws com.liferay.portal.kernel.exception.PortalException,
125             com.liferay.portal.kernel.exception.SystemException {
126         getService().unsetUserRoles(userId, roleIds);
127     }
128 
129     public static com.liferay.portal.model.Role updateRole(long roleId,
130         java.lang.String name,
131         java.util.Map<java.util.Locale, String> titleMap,
132         java.lang.String description, java.lang.String subtype)
133         throws com.liferay.portal.kernel.exception.PortalException,
134             com.liferay.portal.kernel.exception.SystemException {
135         return getService()
136                    .updateRole(roleId, name, titleMap, description, subtype);
137     }
138 
139     public static RoleService getService() {
140         if (_service == null) {
141             _service = (RoleService)PortalBeanLocatorUtil.locate(RoleService.class.getName());
142         }
143 
144         return _service;
145     }
146 
147     public void setService(RoleService service) {
148         _service = service;
149     }
150 
151     private static RoleService _service;
152 }