001    /**
002     * Copyright (c) 2000-2012 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.SystemException {
268                    try {
269                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
270                                            "getUserUserGroups", _getUserUserGroupsParameterTypes6);
271    
272                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
273    
274                            Object returnObj = null;
275    
276                            try {
277                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
278                            }
279                            catch (Exception e) {
280                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
281                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
282                                    }
283    
284                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
285                            }
286    
287                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
288                    }
289                    catch (com.liferay.portal.kernel.exception.SystemException se) {
290                            _log.error(se, se);
291    
292                            throw se;
293                    }
294            }
295    
296            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
297                    long groupId, long[] userGroupIds)
298                    throws com.liferay.portal.kernel.exception.PortalException,
299                            com.liferay.portal.kernel.exception.SystemException {
300                    try {
301                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
302                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes7);
303    
304                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
305                                            userGroupIds);
306    
307                            try {
308                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
309                            }
310                            catch (Exception e) {
311                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
312                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
313                                    }
314    
315                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
316                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
317                                    }
318    
319                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
320                            }
321                    }
322                    catch (com.liferay.portal.kernel.exception.SystemException se) {
323                            _log.error(se, se);
324    
325                            throw se;
326                    }
327            }
328    
329            public static void unsetTeamUserGroups(HttpPrincipal httpPrincipal,
330                    long teamId, long[] userGroupIds)
331                    throws com.liferay.portal.kernel.exception.PortalException,
332                            com.liferay.portal.kernel.exception.SystemException {
333                    try {
334                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
335                                            "unsetTeamUserGroups", _unsetTeamUserGroupsParameterTypes8);
336    
337                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
338                                            userGroupIds);
339    
340                            try {
341                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
342                            }
343                            catch (Exception e) {
344                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
345                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
346                                    }
347    
348                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
349                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
350                                    }
351    
352                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
353                            }
354                    }
355                    catch (com.liferay.portal.kernel.exception.SystemException se) {
356                            _log.error(se, se);
357    
358                            throw se;
359                    }
360            }
361    
362            public static com.liferay.portal.model.UserGroup updateUserGroup(
363                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
364                    java.lang.String description)
365                    throws com.liferay.portal.kernel.exception.PortalException,
366                            com.liferay.portal.kernel.exception.SystemException {
367                    try {
368                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
369                                            "updateUserGroup", _updateUserGroupParameterTypes9);
370    
371                            MethodHandler methodHandler = new MethodHandler(methodKey,
372                                            userGroupId, name, description);
373    
374                            Object returnObj = null;
375    
376                            try {
377                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
378                            }
379                            catch (Exception e) {
380                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
381                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
382                                    }
383    
384                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
385                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
386                                    }
387    
388                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
389                            }
390    
391                            return (com.liferay.portal.model.UserGroup)returnObj;
392                    }
393                    catch (com.liferay.portal.kernel.exception.SystemException se) {
394                            _log.error(se, se);
395    
396                            throw se;
397                    }
398            }
399    
400            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
401            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
402                            long.class, long[].class
403                    };
404            private static final Class<?>[] _addTeamUserGroupsParameterTypes1 = new Class[] {
405                            long.class, long[].class
406                    };
407            private static final Class<?>[] _addUserGroupParameterTypes2 = new Class[] {
408                            java.lang.String.class, java.lang.String.class
409                    };
410            private static final Class<?>[] _deleteUserGroupParameterTypes3 = new Class[] {
411                            long.class
412                    };
413            private static final Class<?>[] _getUserGroupParameterTypes4 = new Class[] {
414                            long.class
415                    };
416            private static final Class<?>[] _getUserGroupParameterTypes5 = new Class[] {
417                            java.lang.String.class
418                    };
419            private static final Class<?>[] _getUserUserGroupsParameterTypes6 = new Class[] {
420                            long.class
421                    };
422            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes7 = new Class[] {
423                            long.class, long[].class
424                    };
425            private static final Class<?>[] _unsetTeamUserGroupsParameterTypes8 = new Class[] {
426                            long.class, long[].class
427                    };
428            private static final Class<?>[] _updateUserGroupParameterTypes9 = new Class[] {
429                            long.class, java.lang.String.class, java.lang.String.class
430                    };
431    }