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,
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,
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,
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 com.liferay.portal.model.UserGroup addUserGroup(
160                    HttpPrincipal httpPrincipal, java.lang.String name,
161                    java.lang.String description,
162                    com.liferay.portal.service.ServiceContext serviceContext)
163                    throws com.liferay.portal.kernel.exception.PortalException,
164                            com.liferay.portal.kernel.exception.SystemException {
165                    try {
166                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
167                                            "addUserGroup", _addUserGroupParameterTypes3);
168    
169                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
170                                            description, serviceContext);
171    
172                            Object returnObj = null;
173    
174                            try {
175                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
176                            }
177                            catch (Exception e) {
178                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
179                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
180                                    }
181    
182                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
183                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
184                                    }
185    
186                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
187                            }
188    
189                            return (com.liferay.portal.model.UserGroup)returnObj;
190                    }
191                    catch (com.liferay.portal.kernel.exception.SystemException se) {
192                            _log.error(se, se);
193    
194                            throw se;
195                    }
196            }
197    
198            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
199                    long userGroupId)
200                    throws com.liferay.portal.kernel.exception.PortalException,
201                            com.liferay.portal.kernel.exception.SystemException {
202                    try {
203                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
204                                            "deleteUserGroup", _deleteUserGroupParameterTypes4);
205    
206                            MethodHandler methodHandler = new MethodHandler(methodKey,
207                                            userGroupId);
208    
209                            try {
210                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
211                            }
212                            catch (Exception e) {
213                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
214                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
215                                    }
216    
217                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
218                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
219                                    }
220    
221                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
222                            }
223                    }
224                    catch (com.liferay.portal.kernel.exception.SystemException se) {
225                            _log.error(se, se);
226    
227                            throw se;
228                    }
229            }
230    
231            public static com.liferay.portal.model.UserGroup getUserGroup(
232                    HttpPrincipal httpPrincipal, long userGroupId)
233                    throws com.liferay.portal.kernel.exception.PortalException,
234                            com.liferay.portal.kernel.exception.SystemException {
235                    try {
236                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
237                                            "getUserGroup", _getUserGroupParameterTypes5);
238    
239                            MethodHandler methodHandler = new MethodHandler(methodKey,
240                                            userGroupId);
241    
242                            Object returnObj = null;
243    
244                            try {
245                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
246                            }
247                            catch (Exception e) {
248                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
249                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
250                                    }
251    
252                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
253                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
254                                    }
255    
256                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
257                            }
258    
259                            return (com.liferay.portal.model.UserGroup)returnObj;
260                    }
261                    catch (com.liferay.portal.kernel.exception.SystemException se) {
262                            _log.error(se, se);
263    
264                            throw se;
265                    }
266            }
267    
268            public static com.liferay.portal.model.UserGroup getUserGroup(
269                    HttpPrincipal httpPrincipal, java.lang.String name)
270                    throws com.liferay.portal.kernel.exception.PortalException,
271                            com.liferay.portal.kernel.exception.SystemException {
272                    try {
273                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
274                                            "getUserGroup", _getUserGroupParameterTypes6);
275    
276                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
277    
278                            Object returnObj = null;
279    
280                            try {
281                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
282                            }
283                            catch (Exception e) {
284                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
285                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
286                                    }
287    
288                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
289                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
290                                    }
291    
292                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
293                            }
294    
295                            return (com.liferay.portal.model.UserGroup)returnObj;
296                    }
297                    catch (com.liferay.portal.kernel.exception.SystemException se) {
298                            _log.error(se, se);
299    
300                            throw se;
301                    }
302            }
303    
304            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
305                    HttpPrincipal httpPrincipal, long userId)
306                    throws com.liferay.portal.kernel.exception.PortalException,
307                            com.liferay.portal.kernel.exception.SystemException {
308                    try {
309                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
310                                            "getUserUserGroups", _getUserUserGroupsParameterTypes7);
311    
312                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
313    
314                            Object returnObj = null;
315    
316                            try {
317                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
318                            }
319                            catch (Exception e) {
320                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
321                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
322                                    }
323    
324                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
325                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
326                                    }
327    
328                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
329                            }
330    
331                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
332                    }
333                    catch (com.liferay.portal.kernel.exception.SystemException se) {
334                            _log.error(se, se);
335    
336                            throw se;
337                    }
338            }
339    
340            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
341                    long groupId, long[] userGroupIds)
342                    throws com.liferay.portal.kernel.exception.PortalException,
343                            com.liferay.portal.kernel.exception.SystemException {
344                    try {
345                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
346                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes8);
347    
348                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
349                                            userGroupIds);
350    
351                            try {
352                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
353                            }
354                            catch (Exception e) {
355                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
356                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
357                                    }
358    
359                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
360                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
361                                    }
362    
363                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
364                            }
365                    }
366                    catch (com.liferay.portal.kernel.exception.SystemException se) {
367                            _log.error(se, se);
368    
369                            throw se;
370                    }
371            }
372    
373            public static void unsetTeamUserGroups(HttpPrincipal httpPrincipal,
374                    long teamId, long[] userGroupIds)
375                    throws com.liferay.portal.kernel.exception.PortalException,
376                            com.liferay.portal.kernel.exception.SystemException {
377                    try {
378                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
379                                            "unsetTeamUserGroups", _unsetTeamUserGroupsParameterTypes9);
380    
381                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
382                                            userGroupIds);
383    
384                            try {
385                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
386                            }
387                            catch (Exception e) {
388                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
389                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
390                                    }
391    
392                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
393                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
394                                    }
395    
396                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
397                            }
398                    }
399                    catch (com.liferay.portal.kernel.exception.SystemException se) {
400                            _log.error(se, se);
401    
402                            throw se;
403                    }
404            }
405    
406            public static com.liferay.portal.model.UserGroup updateUserGroup(
407                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
408                    java.lang.String description)
409                    throws com.liferay.portal.kernel.exception.PortalException,
410                            com.liferay.portal.kernel.exception.SystemException {
411                    try {
412                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
413                                            "updateUserGroup", _updateUserGroupParameterTypes10);
414    
415                            MethodHandler methodHandler = new MethodHandler(methodKey,
416                                            userGroupId, name, description);
417    
418                            Object returnObj = null;
419    
420                            try {
421                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
422                            }
423                            catch (Exception e) {
424                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
425                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
426                                    }
427    
428                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
429                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
430                                    }
431    
432                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
433                            }
434    
435                            return (com.liferay.portal.model.UserGroup)returnObj;
436                    }
437                    catch (com.liferay.portal.kernel.exception.SystemException se) {
438                            _log.error(se, se);
439    
440                            throw se;
441                    }
442            }
443    
444            public static com.liferay.portal.model.UserGroup updateUserGroup(
445                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
446                    java.lang.String description,
447                    com.liferay.portal.service.ServiceContext serviceContext)
448                    throws com.liferay.portal.kernel.exception.PortalException,
449                            com.liferay.portal.kernel.exception.SystemException {
450                    try {
451                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
452                                            "updateUserGroup", _updateUserGroupParameterTypes11);
453    
454                            MethodHandler methodHandler = new MethodHandler(methodKey,
455                                            userGroupId, name, description, serviceContext);
456    
457                            Object returnObj = null;
458    
459                            try {
460                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
461                            }
462                            catch (Exception e) {
463                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
464                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
465                                    }
466    
467                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
468                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
469                                    }
470    
471                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
472                            }
473    
474                            return (com.liferay.portal.model.UserGroup)returnObj;
475                    }
476                    catch (com.liferay.portal.kernel.exception.SystemException se) {
477                            _log.error(se, se);
478    
479                            throw se;
480                    }
481            }
482    
483            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
484            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
485                            long.class, long[].class
486                    };
487            private static final Class<?>[] _addTeamUserGroupsParameterTypes1 = new Class[] {
488                            long.class, long[].class
489                    };
490            private static final Class<?>[] _addUserGroupParameterTypes2 = new Class[] {
491                            java.lang.String.class, java.lang.String.class
492                    };
493            private static final Class<?>[] _addUserGroupParameterTypes3 = new Class[] {
494                            java.lang.String.class, java.lang.String.class,
495                            com.liferay.portal.service.ServiceContext.class
496                    };
497            private static final Class<?>[] _deleteUserGroupParameterTypes4 = new Class[] {
498                            long.class
499                    };
500            private static final Class<?>[] _getUserGroupParameterTypes5 = new Class[] {
501                            long.class
502                    };
503            private static final Class<?>[] _getUserGroupParameterTypes6 = new Class[] {
504                            java.lang.String.class
505                    };
506            private static final Class<?>[] _getUserUserGroupsParameterTypes7 = new Class[] {
507                            long.class
508                    };
509            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes8 = new Class[] {
510                            long.class, long[].class
511                    };
512            private static final Class<?>[] _unsetTeamUserGroupsParameterTypes9 = new Class[] {
513                            long.class, long[].class
514                    };
515            private static final Class<?>[] _updateUserGroupParameterTypes10 = new Class[] {
516                            long.class, java.lang.String.class, java.lang.String.class
517                    };
518            private static final Class<?>[] _updateUserGroupParameterTypes11 = new Class[] {
519                            long.class, java.lang.String.class, java.lang.String.class,
520                            com.liferay.portal.service.ServiceContext.class
521                    };
522    }