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.UserGroupServiceUtil;
23  
24  /**
25   * <a href="UserGroupServiceHttp.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.UserGroupServiceUtil} 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       UserGroupServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.UserGroupServiceUtil
59   * @generated
60   */
61  public class UserGroupServiceHttp {
62      public static void addGroupUserGroups(HttpPrincipal httpPrincipal,
63          long groupId, long[] userGroupIds)
64          throws com.liferay.portal.PortalException,
65              com.liferay.portal.SystemException {
66          try {
67              MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
68                      "addGroupUserGroups", _addGroupUserGroupsParameterTypes0);
69  
70              MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
71                      userGroupIds);
72  
73              try {
74                  TunnelUtil.invoke(httpPrincipal, methodHandler);
75              }
76              catch (Exception e) {
77                  if (e instanceof com.liferay.portal.PortalException) {
78                      throw (com.liferay.portal.PortalException)e;
79                  }
80  
81                  if (e instanceof com.liferay.portal.SystemException) {
82                      throw (com.liferay.portal.SystemException)e;
83                  }
84  
85                  throw new com.liferay.portal.SystemException(e);
86              }
87          }
88          catch (com.liferay.portal.SystemException se) {
89              _log.error(se, se);
90  
91              throw se;
92          }
93      }
94  
95      public static com.liferay.portal.model.UserGroup addUserGroup(
96          HttpPrincipal httpPrincipal, java.lang.String name,
97          java.lang.String description)
98          throws com.liferay.portal.PortalException,
99              com.liferay.portal.SystemException {
100         try {
101             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
102                     "addUserGroup", _addUserGroupParameterTypes1);
103 
104             MethodHandler methodHandler = new MethodHandler(methodKey, name,
105                     description);
106 
107             Object returnObj = null;
108 
109             try {
110                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
111             }
112             catch (Exception e) {
113                 if (e instanceof com.liferay.portal.PortalException) {
114                     throw (com.liferay.portal.PortalException)e;
115                 }
116 
117                 if (e instanceof com.liferay.portal.SystemException) {
118                     throw (com.liferay.portal.SystemException)e;
119                 }
120 
121                 throw new com.liferay.portal.SystemException(e);
122             }
123 
124             return (com.liferay.portal.model.UserGroup)returnObj;
125         }
126         catch (com.liferay.portal.SystemException se) {
127             _log.error(se, se);
128 
129             throw se;
130         }
131     }
132 
133     public static void deleteUserGroup(HttpPrincipal httpPrincipal,
134         long userGroupId)
135         throws com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException {
137         try {
138             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
139                     "deleteUserGroup", _deleteUserGroupParameterTypes2);
140 
141             MethodHandler methodHandler = new MethodHandler(methodKey,
142                     userGroupId);
143 
144             try {
145                 TunnelUtil.invoke(httpPrincipal, methodHandler);
146             }
147             catch (Exception e) {
148                 if (e instanceof com.liferay.portal.PortalException) {
149                     throw (com.liferay.portal.PortalException)e;
150                 }
151 
152                 if (e instanceof com.liferay.portal.SystemException) {
153                     throw (com.liferay.portal.SystemException)e;
154                 }
155 
156                 throw new com.liferay.portal.SystemException(e);
157             }
158         }
159         catch (com.liferay.portal.SystemException se) {
160             _log.error(se, se);
161 
162             throw se;
163         }
164     }
165 
166     public static com.liferay.portal.model.UserGroup getUserGroup(
167         HttpPrincipal httpPrincipal, long userGroupId)
168         throws com.liferay.portal.PortalException,
169             com.liferay.portal.SystemException {
170         try {
171             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
172                     "getUserGroup", _getUserGroupParameterTypes3);
173 
174             MethodHandler methodHandler = new MethodHandler(methodKey,
175                     userGroupId);
176 
177             Object returnObj = null;
178 
179             try {
180                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
181             }
182             catch (Exception e) {
183                 if (e instanceof com.liferay.portal.PortalException) {
184                     throw (com.liferay.portal.PortalException)e;
185                 }
186 
187                 if (e instanceof com.liferay.portal.SystemException) {
188                     throw (com.liferay.portal.SystemException)e;
189                 }
190 
191                 throw new com.liferay.portal.SystemException(e);
192             }
193 
194             return (com.liferay.portal.model.UserGroup)returnObj;
195         }
196         catch (com.liferay.portal.SystemException se) {
197             _log.error(se, se);
198 
199             throw se;
200         }
201     }
202 
203     public static com.liferay.portal.model.UserGroup getUserGroup(
204         HttpPrincipal httpPrincipal, java.lang.String name)
205         throws com.liferay.portal.PortalException,
206             com.liferay.portal.SystemException {
207         try {
208             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
209                     "getUserGroup", _getUserGroupParameterTypes4);
210 
211             MethodHandler methodHandler = new MethodHandler(methodKey, name);
212 
213             Object returnObj = null;
214 
215             try {
216                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
217             }
218             catch (Exception e) {
219                 if (e instanceof com.liferay.portal.PortalException) {
220                     throw (com.liferay.portal.PortalException)e;
221                 }
222 
223                 if (e instanceof com.liferay.portal.SystemException) {
224                     throw (com.liferay.portal.SystemException)e;
225                 }
226 
227                 throw new com.liferay.portal.SystemException(e);
228             }
229 
230             return (com.liferay.portal.model.UserGroup)returnObj;
231         }
232         catch (com.liferay.portal.SystemException se) {
233             _log.error(se, se);
234 
235             throw se;
236         }
237     }
238 
239     public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
240         HttpPrincipal httpPrincipal, long userId)
241         throws com.liferay.portal.SystemException {
242         try {
243             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
244                     "getUserUserGroups", _getUserUserGroupsParameterTypes5);
245 
246             MethodHandler methodHandler = new MethodHandler(methodKey, userId);
247 
248             Object returnObj = null;
249 
250             try {
251                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
252             }
253             catch (Exception e) {
254                 if (e instanceof com.liferay.portal.SystemException) {
255                     throw (com.liferay.portal.SystemException)e;
256                 }
257 
258                 throw new com.liferay.portal.SystemException(e);
259             }
260 
261             return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
262         }
263         catch (com.liferay.portal.SystemException se) {
264             _log.error(se, se);
265 
266             throw se;
267         }
268     }
269 
270     public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
271         long groupId, long[] userGroupIds)
272         throws com.liferay.portal.PortalException,
273             com.liferay.portal.SystemException {
274         try {
275             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
276                     "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes6);
277 
278             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
279                     userGroupIds);
280 
281             try {
282                 TunnelUtil.invoke(httpPrincipal, methodHandler);
283             }
284             catch (Exception e) {
285                 if (e instanceof com.liferay.portal.PortalException) {
286                     throw (com.liferay.portal.PortalException)e;
287                 }
288 
289                 if (e instanceof com.liferay.portal.SystemException) {
290                     throw (com.liferay.portal.SystemException)e;
291                 }
292 
293                 throw new com.liferay.portal.SystemException(e);
294             }
295         }
296         catch (com.liferay.portal.SystemException se) {
297             _log.error(se, se);
298 
299             throw se;
300         }
301     }
302 
303     public static com.liferay.portal.model.UserGroup updateUserGroup(
304         HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
305         java.lang.String description)
306         throws com.liferay.portal.PortalException,
307             com.liferay.portal.SystemException {
308         try {
309             MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
310                     "updateUserGroup", _updateUserGroupParameterTypes7);
311 
312             MethodHandler methodHandler = new MethodHandler(methodKey,
313                     userGroupId, name, description);
314 
315             Object returnObj = null;
316 
317             try {
318                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
319             }
320             catch (Exception e) {
321                 if (e instanceof com.liferay.portal.PortalException) {
322                     throw (com.liferay.portal.PortalException)e;
323                 }
324 
325                 if (e instanceof com.liferay.portal.SystemException) {
326                     throw (com.liferay.portal.SystemException)e;
327                 }
328 
329                 throw new com.liferay.portal.SystemException(e);
330             }
331 
332             return (com.liferay.portal.model.UserGroup)returnObj;
333         }
334         catch (com.liferay.portal.SystemException se) {
335             _log.error(se, se);
336 
337             throw se;
338         }
339     }
340 
341     private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
342     private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
343             long.class, long[].class
344         };
345     private static final Class<?>[] _addUserGroupParameterTypes1 = new Class[] {
346             java.lang.String.class, java.lang.String.class
347         };
348     private static final Class<?>[] _deleteUserGroupParameterTypes2 = new Class[] {
349             long.class
350         };
351     private static final Class<?>[] _getUserGroupParameterTypes3 = new Class[] {
352             long.class
353         };
354     private static final Class<?>[] _getUserGroupParameterTypes4 = new Class[] {
355             java.lang.String.class
356         };
357     private static final Class<?>[] _getUserUserGroupsParameterTypes5 = new Class[] {
358             long.class
359         };
360     private static final Class<?>[] _unsetGroupUserGroupsParameterTypes6 = new Class[] {
361             long.class, long[].class
362         };
363     private static final Class<?>[] _updateUserGroupParameterTypes7 = new Class[] {
364             long.class, java.lang.String.class, java.lang.String.class
365         };
366 }