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.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.UserGroupGroupRoleServiceUtil;
23  
24  /**
25   * <a href="UserGroupGroupRoleServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.UserGroupGroupRoleServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       UserGroupGroupRoleServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.UserGroupGroupRoleServiceUtil
59   * @generated
60   */
61  public class UserGroupGroupRoleServiceHttp {
62      public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
63          long userGroupId, long groupId, long[] roleIds)
64          throws com.liferay.portal.PortalException,
65              com.liferay.portal.SystemException {
66          try {
67              MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class.getName(),
68                      "addUserGroupGroupRoles",
69                      _addUserGroupGroupRolesParameterTypes0);
70  
71              MethodHandler methodHandler = new MethodHandler(methodKey,
72                      userGroupId, groupId, roleIds);
73  
74              try {
75                  TunnelUtil.invoke(httpPrincipal, methodHandler);
76              }
77              catch (Exception e) {
78                  if (e instanceof com.liferay.portal.PortalException) {
79                      throw (com.liferay.portal.PortalException)e;
80                  }
81  
82                  if (e instanceof com.liferay.portal.SystemException) {
83                      throw (com.liferay.portal.SystemException)e;
84                  }
85  
86                  throw new com.liferay.portal.SystemException(e);
87              }
88          }
89          catch (com.liferay.portal.SystemException se) {
90              _log.error(se, se);
91  
92              throw se;
93          }
94      }
95  
96      public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
97          long[] userGroupIds, long groupId, long roleId)
98          throws com.liferay.portal.PortalException,
99              com.liferay.portal.SystemException {
100         try {
101             MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class.getName(),
102                     "addUserGroupGroupRoles",
103                     _addUserGroupGroupRolesParameterTypes1);
104 
105             MethodHandler methodHandler = new MethodHandler(methodKey,
106                     userGroupIds, groupId, roleId);
107 
108             try {
109                 TunnelUtil.invoke(httpPrincipal, methodHandler);
110             }
111             catch (Exception e) {
112                 if (e instanceof com.liferay.portal.PortalException) {
113                     throw (com.liferay.portal.PortalException)e;
114                 }
115 
116                 if (e instanceof com.liferay.portal.SystemException) {
117                     throw (com.liferay.portal.SystemException)e;
118                 }
119 
120                 throw new com.liferay.portal.SystemException(e);
121             }
122         }
123         catch (com.liferay.portal.SystemException se) {
124             _log.error(se, se);
125 
126             throw se;
127         }
128     }
129 
130     public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
131         long userGroupId, long groupId, long[] roleIds)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException {
134         try {
135             MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class.getName(),
136                     "deleteUserGroupGroupRoles",
137                     _deleteUserGroupGroupRolesParameterTypes2);
138 
139             MethodHandler methodHandler = new MethodHandler(methodKey,
140                     userGroupId, groupId, roleIds);
141 
142             try {
143                 TunnelUtil.invoke(httpPrincipal, methodHandler);
144             }
145             catch (Exception e) {
146                 if (e instanceof com.liferay.portal.PortalException) {
147                     throw (com.liferay.portal.PortalException)e;
148                 }
149 
150                 if (e instanceof com.liferay.portal.SystemException) {
151                     throw (com.liferay.portal.SystemException)e;
152                 }
153 
154                 throw new com.liferay.portal.SystemException(e);
155             }
156         }
157         catch (com.liferay.portal.SystemException se) {
158             _log.error(se, se);
159 
160             throw se;
161         }
162     }
163 
164     public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
165         long[] userGroupIds, long groupId, long roleId)
166         throws com.liferay.portal.PortalException,
167             com.liferay.portal.SystemException {
168         try {
169             MethodKey methodKey = new MethodKey(UserGroupGroupRoleServiceUtil.class.getName(),
170                     "deleteUserGroupGroupRoles",
171                     _deleteUserGroupGroupRolesParameterTypes3);
172 
173             MethodHandler methodHandler = new MethodHandler(methodKey,
174                     userGroupIds, groupId, roleId);
175 
176             try {
177                 TunnelUtil.invoke(httpPrincipal, methodHandler);
178             }
179             catch (Exception e) {
180                 if (e instanceof com.liferay.portal.PortalException) {
181                     throw (com.liferay.portal.PortalException)e;
182                 }
183 
184                 if (e instanceof com.liferay.portal.SystemException) {
185                     throw (com.liferay.portal.SystemException)e;
186                 }
187 
188                 throw new com.liferay.portal.SystemException(e);
189             }
190         }
191         catch (com.liferay.portal.SystemException se) {
192             _log.error(se, se);
193 
194             throw se;
195         }
196     }
197 
198     private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRoleServiceHttp.class);
199     private static final Class<?>[] _addUserGroupGroupRolesParameterTypes0 = new Class[] {
200             long.class, long.class, long[].class
201         };
202     private static final Class<?>[] _addUserGroupGroupRolesParameterTypes1 = new Class[] {
203             long[].class, long.class, long.class
204         };
205     private static final Class<?>[] _deleteUserGroupGroupRolesParameterTypes2 = new Class[] {
206             long.class, long.class, long[].class
207         };
208     private static final Class<?>[] _deleteUserGroupGroupRolesParameterTypes3 = new Class[] {
209             long[].class, long.class, long.class
210         };
211 }