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