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     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.UserGroupServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see UserGroupServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.UserGroupServiceUtil
050     * @generated
051     */
052    public class UserGroupServiceHttp {
053            public static void addGroupUserGroups(HttpPrincipal httpPrincipal,
054                    long groupId, long[] userGroupIds)
055                    throws com.liferay.portal.kernel.exception.PortalException,
056                            com.liferay.portal.kernel.exception.SystemException {
057                    try {
058                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
059                                            "addGroupUserGroups", _addGroupUserGroupsParameterTypes0);
060    
061                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
062                                            userGroupIds);
063    
064                            try {
065                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
066                            }
067                            catch (Exception e) {
068                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
069                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
070                                    }
071    
072                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
073                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
074                                    }
075    
076                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
077                            }
078                    }
079                    catch (com.liferay.portal.kernel.exception.SystemException se) {
080                            _log.error(se, se);
081    
082                            throw se;
083                    }
084            }
085    
086            public static void addTeamUserGroups(HttpPrincipal httpPrincipal,
087                    long teamId, long[] userGroupIds)
088                    throws com.liferay.portal.kernel.exception.PortalException,
089                            com.liferay.portal.kernel.exception.SystemException {
090                    try {
091                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
092                                            "addTeamUserGroups", _addTeamUserGroupsParameterTypes1);
093    
094                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
095                                            userGroupIds);
096    
097                            try {
098                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
099                            }
100                            catch (Exception e) {
101                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
102                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
103                                    }
104    
105                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
106                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
107                                    }
108    
109                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
110                            }
111                    }
112                    catch (com.liferay.portal.kernel.exception.SystemException se) {
113                            _log.error(se, se);
114    
115                            throw se;
116                    }
117            }
118    
119            public static com.liferay.portal.model.UserGroup addUserGroup(
120                    HttpPrincipal httpPrincipal, java.lang.String name,
121                    java.lang.String description)
122                    throws com.liferay.portal.kernel.exception.PortalException,
123                            com.liferay.portal.kernel.exception.SystemException {
124                    try {
125                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
126                                            "addUserGroup", _addUserGroupParameterTypes2);
127    
128                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
129                                            description);
130    
131                            Object returnObj = null;
132    
133                            try {
134                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
135                            }
136                            catch (Exception e) {
137                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
139                                    }
140    
141                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
142                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
143                                    }
144    
145                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
146                            }
147    
148                            return (com.liferay.portal.model.UserGroup)returnObj;
149                    }
150                    catch (com.liferay.portal.kernel.exception.SystemException se) {
151                            _log.error(se, se);
152    
153                            throw se;
154                    }
155            }
156    
157            public static com.liferay.portal.model.UserGroup addUserGroup(
158                    HttpPrincipal httpPrincipal, java.lang.String name,
159                    java.lang.String description,
160                    com.liferay.portal.service.ServiceContext serviceContext)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
165                                            "addUserGroup", _addUserGroupParameterTypes3);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
168                                            description, serviceContext);
169    
170                            Object returnObj = null;
171    
172                            try {
173                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
174                            }
175                            catch (Exception e) {
176                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
177                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
178                                    }
179    
180                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
181                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
182                                    }
183    
184                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
185                            }
186    
187                            return (com.liferay.portal.model.UserGroup)returnObj;
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
197                    long userGroupId)
198                    throws com.liferay.portal.kernel.exception.PortalException,
199                            com.liferay.portal.kernel.exception.SystemException {
200                    try {
201                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
202                                            "deleteUserGroup", _deleteUserGroupParameterTypes4);
203    
204                            MethodHandler methodHandler = new MethodHandler(methodKey,
205                                            userGroupId);
206    
207                            try {
208                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
209                            }
210                            catch (Exception e) {
211                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
212                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
213                                    }
214    
215                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
216                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
217                                    }
218    
219                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
220                            }
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, long userGroupId)
231                    throws com.liferay.portal.kernel.exception.PortalException,
232                            com.liferay.portal.kernel.exception.SystemException {
233                    try {
234                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
235                                            "getUserGroup", _getUserGroupParameterTypes5);
236    
237                            MethodHandler methodHandler = new MethodHandler(methodKey,
238                                            userGroupId);
239    
240                            Object returnObj = null;
241    
242                            try {
243                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
244                            }
245                            catch (Exception e) {
246                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
247                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
248                                    }
249    
250                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
251                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
252                                    }
253    
254                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
255                            }
256    
257                            return (com.liferay.portal.model.UserGroup)returnObj;
258                    }
259                    catch (com.liferay.portal.kernel.exception.SystemException se) {
260                            _log.error(se, se);
261    
262                            throw se;
263                    }
264            }
265    
266            public static com.liferay.portal.model.UserGroup getUserGroup(
267                    HttpPrincipal httpPrincipal, java.lang.String name)
268                    throws com.liferay.portal.kernel.exception.PortalException,
269                            com.liferay.portal.kernel.exception.SystemException {
270                    try {
271                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
272                                            "getUserGroup", _getUserGroupParameterTypes6);
273    
274                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
275    
276                            Object returnObj = null;
277    
278                            try {
279                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
280                            }
281                            catch (Exception e) {
282                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
283                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
284                                    }
285    
286                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
287                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
288                                    }
289    
290                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
291                            }
292    
293                            return (com.liferay.portal.model.UserGroup)returnObj;
294                    }
295                    catch (com.liferay.portal.kernel.exception.SystemException se) {
296                            _log.error(se, se);
297    
298                            throw se;
299                    }
300            }
301    
302            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
303                    HttpPrincipal httpPrincipal, long userId)
304                    throws com.liferay.portal.kernel.exception.PortalException,
305                            com.liferay.portal.kernel.exception.SystemException {
306                    try {
307                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
308                                            "getUserUserGroups", _getUserUserGroupsParameterTypes7);
309    
310                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
311    
312                            Object returnObj = null;
313    
314                            try {
315                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
316                            }
317                            catch (Exception e) {
318                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
319                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
320                                    }
321    
322                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
323                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
324                                    }
325    
326                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
327                            }
328    
329                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
330                    }
331                    catch (com.liferay.portal.kernel.exception.SystemException se) {
332                            _log.error(se, se);
333    
334                            throw se;
335                    }
336            }
337    
338            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
339                    long groupId, long[] userGroupIds)
340                    throws com.liferay.portal.kernel.exception.PortalException,
341                            com.liferay.portal.kernel.exception.SystemException {
342                    try {
343                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
344                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes8);
345    
346                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
347                                            userGroupIds);
348    
349                            try {
350                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
351                            }
352                            catch (Exception e) {
353                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
354                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
355                                    }
356    
357                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
358                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
359                                    }
360    
361                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
362                            }
363                    }
364                    catch (com.liferay.portal.kernel.exception.SystemException se) {
365                            _log.error(se, se);
366    
367                            throw se;
368                    }
369            }
370    
371            public static void unsetTeamUserGroups(HttpPrincipal httpPrincipal,
372                    long teamId, long[] userGroupIds)
373                    throws com.liferay.portal.kernel.exception.PortalException,
374                            com.liferay.portal.kernel.exception.SystemException {
375                    try {
376                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
377                                            "unsetTeamUserGroups", _unsetTeamUserGroupsParameterTypes9);
378    
379                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
380                                            userGroupIds);
381    
382                            try {
383                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
384                            }
385                            catch (Exception e) {
386                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
387                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
388                                    }
389    
390                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
391                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
392                                    }
393    
394                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
395                            }
396                    }
397                    catch (com.liferay.portal.kernel.exception.SystemException se) {
398                            _log.error(se, se);
399    
400                            throw se;
401                    }
402            }
403    
404            public static com.liferay.portal.model.UserGroup updateUserGroup(
405                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
406                    java.lang.String description)
407                    throws com.liferay.portal.kernel.exception.PortalException,
408                            com.liferay.portal.kernel.exception.SystemException {
409                    try {
410                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
411                                            "updateUserGroup", _updateUserGroupParameterTypes10);
412    
413                            MethodHandler methodHandler = new MethodHandler(methodKey,
414                                            userGroupId, name, description);
415    
416                            Object returnObj = null;
417    
418                            try {
419                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
420                            }
421                            catch (Exception e) {
422                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
423                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
424                                    }
425    
426                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
427                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
428                                    }
429    
430                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
431                            }
432    
433                            return (com.liferay.portal.model.UserGroup)returnObj;
434                    }
435                    catch (com.liferay.portal.kernel.exception.SystemException se) {
436                            _log.error(se, se);
437    
438                            throw se;
439                    }
440            }
441    
442            public static com.liferay.portal.model.UserGroup updateUserGroup(
443                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
444                    java.lang.String description,
445                    com.liferay.portal.service.ServiceContext serviceContext)
446                    throws com.liferay.portal.kernel.exception.PortalException,
447                            com.liferay.portal.kernel.exception.SystemException {
448                    try {
449                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
450                                            "updateUserGroup", _updateUserGroupParameterTypes11);
451    
452                            MethodHandler methodHandler = new MethodHandler(methodKey,
453                                            userGroupId, name, description, serviceContext);
454    
455                            Object returnObj = null;
456    
457                            try {
458                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
459                            }
460                            catch (Exception e) {
461                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
462                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
463                                    }
464    
465                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
466                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
467                                    }
468    
469                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
470                            }
471    
472                            return (com.liferay.portal.model.UserGroup)returnObj;
473                    }
474                    catch (com.liferay.portal.kernel.exception.SystemException se) {
475                            _log.error(se, se);
476    
477                            throw se;
478                    }
479            }
480    
481            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
482            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
483                            long.class, long[].class
484                    };
485            private static final Class<?>[] _addTeamUserGroupsParameterTypes1 = new Class[] {
486                            long.class, long[].class
487                    };
488            private static final Class<?>[] _addUserGroupParameterTypes2 = new Class[] {
489                            java.lang.String.class, java.lang.String.class
490                    };
491            private static final Class<?>[] _addUserGroupParameterTypes3 = new Class[] {
492                            java.lang.String.class, java.lang.String.class,
493                            com.liferay.portal.service.ServiceContext.class
494                    };
495            private static final Class<?>[] _deleteUserGroupParameterTypes4 = new Class[] {
496                            long.class
497                    };
498            private static final Class<?>[] _getUserGroupParameterTypes5 = new Class[] {
499                            long.class
500                    };
501            private static final Class<?>[] _getUserGroupParameterTypes6 = new Class[] {
502                            java.lang.String.class
503                    };
504            private static final Class<?>[] _getUserUserGroupsParameterTypes7 = new Class[] {
505                            long.class
506                    };
507            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes8 = new Class[] {
508                            long.class, long[].class
509                    };
510            private static final Class<?>[] _unsetTeamUserGroupsParameterTypes9 = new Class[] {
511                            long.class, long[].class
512                    };
513            private static final Class<?>[] _updateUserGroupParameterTypes10 = new Class[] {
514                            long.class, java.lang.String.class, java.lang.String.class
515                    };
516            private static final Class<?>[] _updateUserGroupParameterTypes11 = new Class[] {
517                            long.class, java.lang.String.class, java.lang.String.class,
518                            com.liferay.portal.service.ServiceContext.class
519                    };
520    }