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 com.liferay.portal.service.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 com.liferay.portal.security.auth.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 com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portal.service.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 getUserGroup(
208                    HttpPrincipal httpPrincipal, long userGroupId)
209                    throws com.liferay.portal.kernel.exception.PortalException {
210                    try {
211                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
212                                            "getUserGroup", _getUserGroupParameterTypes5);
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, java.lang.String name)
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, name);
247    
248                            Object returnObj = null;
249    
250                            try {
251                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
252                            }
253                            catch (Exception e) {
254                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
255                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
256                                    }
257    
258                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
259                            }
260    
261                            return (com.liferay.portal.model.UserGroup)returnObj;
262                    }
263                    catch (com.liferay.portal.kernel.exception.SystemException se) {
264                            _log.error(se, se);
265    
266                            throw se;
267                    }
268            }
269    
270            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
271                    HttpPrincipal httpPrincipal, long userId)
272                    throws com.liferay.portal.kernel.exception.PortalException {
273                    try {
274                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
275                                            "getUserUserGroups", _getUserUserGroupsParameterTypes7);
276    
277                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
278    
279                            Object returnObj = null;
280    
281                            try {
282                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
283                            }
284                            catch (Exception e) {
285                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
286                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
287                                    }
288    
289                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
290                            }
291    
292                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
293                    }
294                    catch (com.liferay.portal.kernel.exception.SystemException se) {
295                            _log.error(se, se);
296    
297                            throw se;
298                    }
299            }
300    
301            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
302                    long groupId, long[] userGroupIds)
303                    throws com.liferay.portal.kernel.exception.PortalException {
304                    try {
305                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
306                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes8);
307    
308                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
309                                            userGroupIds);
310    
311                            try {
312                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
313                            }
314                            catch (Exception e) {
315                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
316                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
317                                    }
318    
319                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
320                            }
321                    }
322                    catch (com.liferay.portal.kernel.exception.SystemException se) {
323                            _log.error(se, se);
324    
325                            throw se;
326                    }
327            }
328    
329            public static void unsetTeamUserGroups(HttpPrincipal httpPrincipal,
330                    long teamId, long[] userGroupIds)
331                    throws com.liferay.portal.kernel.exception.PortalException {
332                    try {
333                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
334                                            "unsetTeamUserGroups", _unsetTeamUserGroupsParameterTypes9);
335    
336                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
337                                            userGroupIds);
338    
339                            try {
340                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
341                            }
342                            catch (Exception e) {
343                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
344                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
345                                    }
346    
347                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
348                            }
349                    }
350                    catch (com.liferay.portal.kernel.exception.SystemException se) {
351                            _log.error(se, se);
352    
353                            throw se;
354                    }
355            }
356    
357            public static com.liferay.portal.model.UserGroup updateUserGroup(
358                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
359                    java.lang.String description)
360                    throws com.liferay.portal.kernel.exception.PortalException {
361                    try {
362                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
363                                            "updateUserGroup", _updateUserGroupParameterTypes10);
364    
365                            MethodHandler methodHandler = new MethodHandler(methodKey,
366                                            userGroupId, name, description);
367    
368                            Object returnObj = null;
369    
370                            try {
371                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
372                            }
373                            catch (Exception e) {
374                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
375                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
376                                    }
377    
378                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
379                            }
380    
381                            return (com.liferay.portal.model.UserGroup)returnObj;
382                    }
383                    catch (com.liferay.portal.kernel.exception.SystemException se) {
384                            _log.error(se, se);
385    
386                            throw se;
387                    }
388            }
389    
390            public static com.liferay.portal.model.UserGroup updateUserGroup(
391                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
392                    java.lang.String description,
393                    com.liferay.portal.service.ServiceContext serviceContext)
394                    throws com.liferay.portal.kernel.exception.PortalException {
395                    try {
396                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class,
397                                            "updateUserGroup", _updateUserGroupParameterTypes11);
398    
399                            MethodHandler methodHandler = new MethodHandler(methodKey,
400                                            userGroupId, name, description, serviceContext);
401    
402                            Object returnObj = null;
403    
404                            try {
405                                    returnObj = 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                            return (com.liferay.portal.model.UserGroup)returnObj;
416                    }
417                    catch (com.liferay.portal.kernel.exception.SystemException se) {
418                            _log.error(se, se);
419    
420                            throw se;
421                    }
422            }
423    
424            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
425            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
426                            long.class, long[].class
427                    };
428            private static final Class<?>[] _addTeamUserGroupsParameterTypes1 = new Class[] {
429                            long.class, long[].class
430                    };
431            private static final Class<?>[] _addUserGroupParameterTypes2 = new Class[] {
432                            java.lang.String.class, java.lang.String.class
433                    };
434            private static final Class<?>[] _addUserGroupParameterTypes3 = new Class[] {
435                            java.lang.String.class, java.lang.String.class,
436                            com.liferay.portal.service.ServiceContext.class
437                    };
438            private static final Class<?>[] _deleteUserGroupParameterTypes4 = new Class[] {
439                            long.class
440                    };
441            private static final Class<?>[] _getUserGroupParameterTypes5 = new Class[] {
442                            long.class
443                    };
444            private static final Class<?>[] _getUserGroupParameterTypes6 = new Class[] {
445                            java.lang.String.class
446                    };
447            private static final Class<?>[] _getUserUserGroupsParameterTypes7 = new Class[] {
448                            long.class
449                    };
450            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes8 = new Class[] {
451                            long.class, long[].class
452                    };
453            private static final Class<?>[] _unsetTeamUserGroupsParameterTypes9 = new Class[] {
454                            long.class, long[].class
455                    };
456            private static final Class<?>[] _updateUserGroupParameterTypes10 = new Class[] {
457                            long.class, java.lang.String.class, java.lang.String.class
458                    };
459            private static final Class<?>[] _updateUserGroupParameterTypes11 = new Class[] {
460                            long.class, java.lang.String.class, java.lang.String.class,
461                            com.liferay.portal.service.ServiceContext.class
462                    };
463    }