001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.UserGroupServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.UserGroupServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       UserGroupServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.UserGroupServiceUtil
052     * @generated
053     */
054    public class UserGroupServiceHttp {
055            public static void addGroupUserGroups(HttpPrincipal httpPrincipal,
056                    long groupId, long[] userGroupIds)
057                    throws com.liferay.portal.kernel.exception.PortalException,
058                            com.liferay.portal.kernel.exception.SystemException {
059                    try {
060                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
061                                            "addGroupUserGroups", _addGroupUserGroupsParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
064                                            userGroupIds);
065    
066                            try {
067                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
068                            }
069                            catch (Exception e) {
070                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
071                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
072                                    }
073    
074                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static void addTeamUserGroups(HttpPrincipal httpPrincipal,
089                    long teamId, long[] userGroupIds)
090                    throws com.liferay.portal.kernel.exception.PortalException,
091                            com.liferay.portal.kernel.exception.SystemException {
092                    try {
093                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
094                                            "addTeamUserGroups", _addTeamUserGroupsParameterTypes1);
095    
096                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
097                                            userGroupIds);
098    
099                            try {
100                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
101                            }
102                            catch (Exception e) {
103                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
104                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
105                                    }
106    
107                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
108                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113                    }
114                    catch (com.liferay.portal.kernel.exception.SystemException se) {
115                            _log.error(se, se);
116    
117                            throw se;
118                    }
119            }
120    
121            public static com.liferay.portal.model.UserGroup addUserGroup(
122                    HttpPrincipal httpPrincipal, java.lang.String name,
123                    java.lang.String description)
124                    throws com.liferay.portal.kernel.exception.PortalException,
125                            com.liferay.portal.kernel.exception.SystemException {
126                    try {
127                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
128                                            "addUserGroup", _addUserGroupParameterTypes2);
129    
130                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
131                                            description);
132    
133                            Object returnObj = null;
134    
135                            try {
136                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
137                            }
138                            catch (Exception e) {
139                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
140                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
141                                    }
142    
143                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
144                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
145                                    }
146    
147                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
148                            }
149    
150                            return (com.liferay.portal.model.UserGroup)returnObj;
151                    }
152                    catch (com.liferay.portal.kernel.exception.SystemException se) {
153                            _log.error(se, se);
154    
155                            throw se;
156                    }
157            }
158    
159            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
160                    long userGroupId)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
165                                            "deleteUserGroup", _deleteUserGroupParameterTypes3);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey,
168                                            userGroupId);
169    
170                            try {
171                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
172                            }
173                            catch (Exception e) {
174                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
175                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
176                                    }
177    
178                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
179                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
180                                    }
181    
182                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
183                            }
184                    }
185                    catch (com.liferay.portal.kernel.exception.SystemException se) {
186                            _log.error(se, se);
187    
188                            throw se;
189                    }
190            }
191    
192            public static com.liferay.portal.model.UserGroup getUserGroup(
193                    HttpPrincipal httpPrincipal, long userGroupId)
194                    throws com.liferay.portal.kernel.exception.PortalException,
195                            com.liferay.portal.kernel.exception.SystemException {
196                    try {
197                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
198                                            "getUserGroup", _getUserGroupParameterTypes4);
199    
200                            MethodHandler methodHandler = new MethodHandler(methodKey,
201                                            userGroupId);
202    
203                            Object returnObj = null;
204    
205                            try {
206                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
207                            }
208                            catch (Exception e) {
209                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
210                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
211                                    }
212    
213                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
214                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
215                                    }
216    
217                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
218                            }
219    
220                            return (com.liferay.portal.model.UserGroup)returnObj;
221                    }
222                    catch (com.liferay.portal.kernel.exception.SystemException se) {
223                            _log.error(se, se);
224    
225                            throw se;
226                    }
227            }
228    
229            public static com.liferay.portal.model.UserGroup getUserGroup(
230                    HttpPrincipal httpPrincipal, java.lang.String name)
231                    throws com.liferay.portal.kernel.exception.PortalException,
232                            com.liferay.portal.kernel.exception.SystemException {
233                    try {
234                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
235                                            "getUserGroup", _getUserGroupParameterTypes5);
236    
237                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
238    
239                            Object returnObj = null;
240    
241                            try {
242                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
243                            }
244                            catch (Exception e) {
245                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
246                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
247                                    }
248    
249                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
250                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
251                                    }
252    
253                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
254                            }
255    
256                            return (com.liferay.portal.model.UserGroup)returnObj;
257                    }
258                    catch (com.liferay.portal.kernel.exception.SystemException se) {
259                            _log.error(se, se);
260    
261                            throw se;
262                    }
263            }
264    
265            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
266                    HttpPrincipal httpPrincipal, long userId)
267                    throws com.liferay.portal.kernel.exception.PortalException,
268                            com.liferay.portal.kernel.exception.SystemException {
269                    try {
270                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
271                                            "getUserUserGroups", _getUserUserGroupsParameterTypes6);
272    
273                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
274    
275                            Object returnObj = null;
276    
277                            try {
278                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
279                            }
280                            catch (Exception e) {
281                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
282                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
283                                    }
284    
285                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
286                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
287                                    }
288    
289                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
290                            }
291    
292                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
293                    }
294                    catch (com.liferay.portal.kernel.exception.SystemException se) {
295                            _log.error(se, se);
296    
297                            throw se;
298                    }
299            }
300    
301            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
302                    long groupId, long[] userGroupIds)
303                    throws com.liferay.portal.kernel.exception.PortalException,
304                            com.liferay.portal.kernel.exception.SystemException {
305                    try {
306                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
307                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes7);
308    
309                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
310                                            userGroupIds);
311    
312                            try {
313                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
314                            }
315                            catch (Exception e) {
316                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
317                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
318                                    }
319    
320                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
321                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
322                                    }
323    
324                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
325                            }
326                    }
327                    catch (com.liferay.portal.kernel.exception.SystemException se) {
328                            _log.error(se, se);
329    
330                            throw se;
331                    }
332            }
333    
334            public static void unsetTeamUserGroups(HttpPrincipal httpPrincipal,
335                    long teamId, long[] userGroupIds)
336                    throws com.liferay.portal.kernel.exception.PortalException,
337                            com.liferay.portal.kernel.exception.SystemException {
338                    try {
339                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
340                                            "unsetTeamUserGroups", _unsetTeamUserGroupsParameterTypes8);
341    
342                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
343                                            userGroupIds);
344    
345                            try {
346                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
347                            }
348                            catch (Exception e) {
349                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
350                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
351                                    }
352    
353                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
354                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
355                                    }
356    
357                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
358                            }
359                    }
360                    catch (com.liferay.portal.kernel.exception.SystemException se) {
361                            _log.error(se, se);
362    
363                            throw se;
364                    }
365            }
366    
367            public static com.liferay.portal.model.UserGroup updateUserGroup(
368                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
369                    java.lang.String description)
370                    throws com.liferay.portal.kernel.exception.PortalException,
371                            com.liferay.portal.kernel.exception.SystemException {
372                    try {
373                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
374                                            "updateUserGroup", _updateUserGroupParameterTypes9);
375    
376                            MethodHandler methodHandler = new MethodHandler(methodKey,
377                                            userGroupId, name, description);
378    
379                            Object returnObj = null;
380    
381                            try {
382                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
383                            }
384                            catch (Exception e) {
385                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
386                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
387                                    }
388    
389                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
390                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
391                                    }
392    
393                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
394                            }
395    
396                            return (com.liferay.portal.model.UserGroup)returnObj;
397                    }
398                    catch (com.liferay.portal.kernel.exception.SystemException se) {
399                            _log.error(se, se);
400    
401                            throw se;
402                    }
403            }
404    
405            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
406            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
407                            long.class, long[].class
408                    };
409            private static final Class<?>[] _addTeamUserGroupsParameterTypes1 = new Class[] {
410                            long.class, long[].class
411                    };
412            private static final Class<?>[] _addUserGroupParameterTypes2 = new Class[] {
413                            java.lang.String.class, java.lang.String.class
414                    };
415            private static final Class<?>[] _deleteUserGroupParameterTypes3 = new Class[] {
416                            long.class
417                    };
418            private static final Class<?>[] _getUserGroupParameterTypes4 = new Class[] {
419                            long.class
420                    };
421            private static final Class<?>[] _getUserGroupParameterTypes5 = new Class[] {
422                            java.lang.String.class
423                    };
424            private static final Class<?>[] _getUserUserGroupsParameterTypes6 = new Class[] {
425                            long.class
426                    };
427            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes7 = new Class[] {
428                            long.class, long[].class
429                    };
430            private static final Class<?>[] _unsetTeamUserGroupsParameterTypes8 = new Class[] {
431                            long.class, long[].class
432                    };
433            private static final Class<?>[] _updateUserGroupParameterTypes9 = new Class[] {
434                            long.class, java.lang.String.class, java.lang.String.class
435                    };
436    }