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