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