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="RoleServiceUtil.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 RoleService} 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       RoleService
39   * @generated
40   */
41  public class RoleServiceUtil {
42      public static com.liferay.portal.model.Role addRole(java.lang.String name,
43          java.lang.String description, int type)
44          throws com.liferay.portal.PortalException,
45              com.liferay.portal.SystemException {
46          return getService().addRole(name, description, type);
47      }
48  
49      public static void addUserRoles(long userId, long[] roleIds)
50          throws com.liferay.portal.PortalException,
51              com.liferay.portal.SystemException {
52          getService().addUserRoles(userId, roleIds);
53      }
54  
55      public static void deleteRole(long roleId)
56          throws com.liferay.portal.PortalException,
57              com.liferay.portal.SystemException {
58          getService().deleteRole(roleId);
59      }
60  
61      public static com.liferay.portal.model.Role getGroupRole(long companyId,
62          long groupId)
63          throws com.liferay.portal.PortalException,
64              com.liferay.portal.SystemException {
65          return getService().getGroupRole(companyId, groupId);
66      }
67  
68      public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
69          long groupId) throws com.liferay.portal.SystemException {
70          return getService().getGroupRoles(groupId);
71      }
72  
73      public static com.liferay.portal.model.Role getRole(long roleId)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.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.PortalException,
82              com.liferay.portal.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) throws com.liferay.portal.SystemException {
88          return getService().getUserGroupGroupRoles(userId, groupId);
89      }
90  
91      public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
92          long userId, long groupId) throws com.liferay.portal.SystemException {
93          return getService().getUserGroupRoles(userId, groupId);
94      }
95  
96      public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
97          long userId, java.util.List<com.liferay.portal.model.Group> groups)
98          throws com.liferay.portal.SystemException {
99          return getService().getUserRelatedRoles(userId, groups);
100     }
101 
102     public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
103         long userId) throws com.liferay.portal.SystemException {
104         return getService().getUserRoles(userId);
105     }
106 
107     public static boolean hasUserRole(long userId, long companyId,
108         java.lang.String name, boolean inherited)
109         throws com.liferay.portal.PortalException,
110             com.liferay.portal.SystemException {
111         return getService().hasUserRole(userId, companyId, name, inherited);
112     }
113 
114     public static boolean hasUserRoles(long userId, long companyId,
115         java.lang.String[] names, boolean inherited)
116         throws com.liferay.portal.PortalException,
117             com.liferay.portal.SystemException {
118         return getService().hasUserRoles(userId, companyId, names, inherited);
119     }
120 
121     public static void unsetUserRoles(long userId, long[] roleIds)
122         throws com.liferay.portal.PortalException,
123             com.liferay.portal.SystemException {
124         getService().unsetUserRoles(userId, roleIds);
125     }
126 
127     public static com.liferay.portal.model.Role updateRole(long roleId,
128         java.lang.String name,
129         java.util.Map<java.util.Locale, java.lang.String> localeTitlesMap,
130         java.lang.String description, java.lang.String subtype)
131         throws com.liferay.portal.PortalException,
132             com.liferay.portal.SystemException {
133         return getService()
134                    .updateRole(roleId, name, localeTitlesMap, description,
135             subtype);
136     }
137 
138     public static RoleService getService() {
139         if (_service == null) {
140             _service = (RoleService)PortalBeanLocatorUtil.locate(RoleService.class.getName());
141 
142             ReferenceRegistry.registerReference(RoleServiceUtil.class,
143                 "_service");
144             MethodCache.remove(RoleService.class);
145         }
146 
147         return _service;
148     }
149 
150     public void setService(RoleService service) {
151         MethodCache.remove(RoleService.class);
152 
153         _service = service;
154 
155         ReferenceRegistry.registerReference(RoleServiceUtil.class, "_service");
156         MethodCache.remove(RoleService.class);
157     }
158 
159     private static RoleService _service;
160 }