1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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="RoleServiceUtil.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   * {@link RoleService} bean. The static methods of
37   * this class calls the same methods of the bean instance. It's convenient to be
38   * able to just write one line to call a method on a bean instead of writing a
39   * lookup call and a method call.
40   * </p>
41   *
42   * @author    Brian Wing Shun Chan
43   * @see       RoleService
44   * @generated
45   */
46  public class RoleServiceUtil {
47      public static com.liferay.portal.model.Role addRole(java.lang.String name,
48          java.lang.String description, int type)
49          throws com.liferay.portal.PortalException,
50              com.liferay.portal.SystemException, java.rmi.RemoteException {
51          return getService().addRole(name, description, type);
52      }
53  
54      public static void addUserRoles(long userId, long[] roleIds)
55          throws com.liferay.portal.PortalException,
56              com.liferay.portal.SystemException, java.rmi.RemoteException {
57          getService().addUserRoles(userId, roleIds);
58      }
59  
60      public static void deleteRole(long roleId)
61          throws com.liferay.portal.PortalException,
62              com.liferay.portal.SystemException, java.rmi.RemoteException {
63          getService().deleteRole(roleId);
64      }
65  
66      public static com.liferay.portal.model.Role getGroupRole(long companyId,
67          long groupId)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException, java.rmi.RemoteException {
70          return getService().getGroupRole(companyId, groupId);
71      }
72  
73      public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
74          long groupId)
75          throws com.liferay.portal.SystemException, java.rmi.RemoteException {
76          return getService().getGroupRoles(groupId);
77      }
78  
79      public static com.liferay.portal.model.Role getRole(long roleId)
80          throws com.liferay.portal.PortalException,
81              com.liferay.portal.SystemException, java.rmi.RemoteException {
82          return getService().getRole(roleId);
83      }
84  
85      public static com.liferay.portal.model.Role getRole(long companyId,
86          java.lang.String name)
87          throws com.liferay.portal.PortalException,
88              com.liferay.portal.SystemException, java.rmi.RemoteException {
89          return getService().getRole(companyId, name);
90      }
91  
92      public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
93          long userId, long groupId)
94          throws com.liferay.portal.SystemException, java.rmi.RemoteException {
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.SystemException, java.rmi.RemoteException {
101         return getService().getUserRelatedRoles(userId, groups);
102     }
103 
104     public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
105         long userId)
106         throws com.liferay.portal.SystemException, java.rmi.RemoteException {
107         return getService().getUserRoles(userId);
108     }
109 
110     public static boolean hasUserRole(long userId, long companyId,
111         java.lang.String name, boolean inherited)
112         throws com.liferay.portal.PortalException,
113             com.liferay.portal.SystemException, java.rmi.RemoteException {
114         return getService().hasUserRole(userId, companyId, name, inherited);
115     }
116 
117     public static boolean hasUserRoles(long userId, long companyId,
118         java.lang.String[] names, boolean inherited)
119         throws com.liferay.portal.PortalException,
120             com.liferay.portal.SystemException, java.rmi.RemoteException {
121         return getService().hasUserRoles(userId, companyId, names, inherited);
122     }
123 
124     public static void unsetUserRoles(long userId, long[] roleIds)
125         throws com.liferay.portal.PortalException,
126             com.liferay.portal.SystemException, java.rmi.RemoteException {
127         getService().unsetUserRoles(userId, roleIds);
128     }
129 
130     public static com.liferay.portal.model.Role updateRole(long roleId,
131         java.lang.String name, java.lang.String description)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException, java.rmi.RemoteException {
134         return getService().updateRole(roleId, name, description);
135     }
136 
137     public static RoleService getService() {
138         if (_service == null) {
139             throw new RuntimeException("RoleService is not set");
140         }
141 
142         return _service;
143     }
144 
145     public void setService(RoleService service) {
146         _service = service;
147     }
148 
149     private static RoleService _service;
150 }