001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.UserGroupServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.UserGroupServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       UserGroupServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.UserGroupServiceUtil
052     * @generated
053     */
054    public class UserGroupServiceHttp {
055            public static void addGroupUserGroups(HttpPrincipal httpPrincipal,
056                    long groupId, long[] userGroupIds)
057                    throws com.liferay.portal.kernel.exception.PortalException,
058                            com.liferay.portal.kernel.exception.SystemException {
059                    try {
060                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
061                                            "addGroupUserGroups", _addGroupUserGroupsParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
064                                            userGroupIds);
065    
066                            try {
067                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
068                            }
069                            catch (Exception e) {
070                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
071                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
072                                    }
073    
074                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static void addTeamUserGroups(HttpPrincipal httpPrincipal,
089                    long teamId, long[] userGroupIds)
090                    throws com.liferay.portal.kernel.exception.PortalException,
091                            com.liferay.portal.kernel.exception.SystemException {
092                    try {
093                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
094                                            "addTeamUserGroups", _addTeamUserGroupsParameterTypes1);
095    
096                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
097                                            userGroupIds);
098    
099                            try {
100                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
101                            }
102                            catch (Exception e) {
103                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
104                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
105                                    }
106    
107                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
108                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113                    }
114                    catch (com.liferay.portal.kernel.exception.SystemException se) {
115                            _log.error(se, se);
116    
117                            throw se;
118                    }
119            }
120    
121            public static com.liferay.portal.model.UserGroup addUserGroup(
122                    HttpPrincipal httpPrincipal, java.lang.String name,
123                    java.lang.String description, long publicLayoutSetPrototypeId,
124                    long privateLayoutSetPrototypeId)
125                    throws com.liferay.portal.kernel.exception.PortalException,
126                            com.liferay.portal.kernel.exception.SystemException {
127                    try {
128                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
129                                            "addUserGroup", _addUserGroupParameterTypes2);
130    
131                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
132                                            description, publicLayoutSetPrototypeId,
133                                            privateLayoutSetPrototypeId);
134    
135                            Object returnObj = null;
136    
137                            try {
138                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
139                            }
140                            catch (Exception e) {
141                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
143                                    }
144    
145                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
146                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
147                                    }
148    
149                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
150                            }
151    
152                            return (com.liferay.portal.model.UserGroup)returnObj;
153                    }
154                    catch (com.liferay.portal.kernel.exception.SystemException se) {
155                            _log.error(se, se);
156    
157                            throw se;
158                    }
159            }
160    
161            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
162                    long userGroupId)
163                    throws com.liferay.portal.kernel.exception.PortalException,
164                            com.liferay.portal.kernel.exception.SystemException {
165                    try {
166                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
167                                            "deleteUserGroup", _deleteUserGroupParameterTypes3);
168    
169                            MethodHandler methodHandler = new MethodHandler(methodKey,
170                                            userGroupId);
171    
172                            try {
173                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
188                            _log.error(se, se);
189    
190                            throw se;
191                    }
192            }
193    
194            public static com.liferay.portal.model.UserGroup getUserGroup(
195                    HttpPrincipal httpPrincipal, long userGroupId)
196                    throws com.liferay.portal.kernel.exception.PortalException,
197                            com.liferay.portal.kernel.exception.SystemException {
198                    try {
199                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
200                                            "getUserGroup", _getUserGroupParameterTypes4);
201    
202                            MethodHandler methodHandler = new MethodHandler(methodKey,
203                                            userGroupId);
204    
205                            Object returnObj = null;
206    
207                            try {
208                                    returnObj = 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                            return (com.liferay.portal.model.UserGroup)returnObj;
223                    }
224                    catch (com.liferay.portal.kernel.exception.SystemException se) {
225                            _log.error(se, se);
226    
227                            throw se;
228                    }
229            }
230    
231            public static com.liferay.portal.model.UserGroup getUserGroup(
232                    HttpPrincipal httpPrincipal, java.lang.String name)
233                    throws com.liferay.portal.kernel.exception.PortalException,
234                            com.liferay.portal.kernel.exception.SystemException {
235                    try {
236                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
237                                            "getUserGroup", _getUserGroupParameterTypes5);
238    
239                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
240    
241                            Object returnObj = null;
242    
243                            try {
244                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
245                            }
246                            catch (Exception e) {
247                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
248                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
249                                    }
250    
251                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
252                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
253                                    }
254    
255                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
256                            }
257    
258                            return (com.liferay.portal.model.UserGroup)returnObj;
259                    }
260                    catch (com.liferay.portal.kernel.exception.SystemException se) {
261                            _log.error(se, se);
262    
263                            throw se;
264                    }
265            }
266    
267            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
268                    HttpPrincipal httpPrincipal, long userId)
269                    throws com.liferay.portal.kernel.exception.SystemException {
270                    try {
271                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
272                                            "getUserUserGroups", _getUserUserGroupsParameterTypes6);
273    
274                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
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.SystemException) {
283                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
284                                    }
285    
286                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
287                            }
288    
289                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
290                    }
291                    catch (com.liferay.portal.kernel.exception.SystemException se) {
292                            _log.error(se, se);
293    
294                            throw se;
295                    }
296            }
297    
298            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
299                    long groupId, long[] userGroupIds)
300                    throws com.liferay.portal.kernel.exception.PortalException,
301                            com.liferay.portal.kernel.exception.SystemException {
302                    try {
303                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
304                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes7);
305    
306                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
307                                            userGroupIds);
308    
309                            try {
310                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
311                            }
312                            catch (Exception e) {
313                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
314                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
315                                    }
316    
317                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
318                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
319                                    }
320    
321                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
322                            }
323                    }
324                    catch (com.liferay.portal.kernel.exception.SystemException se) {
325                            _log.error(se, se);
326    
327                            throw se;
328                    }
329            }
330    
331            public static void unsetTeamUserGroups(HttpPrincipal httpPrincipal,
332                    long teamId, long[] userGroupIds)
333                    throws com.liferay.portal.kernel.exception.PortalException,
334                            com.liferay.portal.kernel.exception.SystemException {
335                    try {
336                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
337                                            "unsetTeamUserGroups", _unsetTeamUserGroupsParameterTypes8);
338    
339                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
340                                            userGroupIds);
341    
342                            try {
343                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
344                            }
345                            catch (Exception e) {
346                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
347                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
348                                    }
349    
350                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
351                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
352                                    }
353    
354                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
355                            }
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 com.liferay.portal.model.UserGroup updateUserGroup(
365                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
366                    java.lang.String description, long publicLayoutSetPrototypeId,
367                    long privateLayoutSetPrototypeId)
368                    throws com.liferay.portal.kernel.exception.PortalException,
369                            com.liferay.portal.kernel.exception.SystemException {
370                    try {
371                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
372                                            "updateUserGroup", _updateUserGroupParameterTypes9);
373    
374                            MethodHandler methodHandler = new MethodHandler(methodKey,
375                                            userGroupId, name, description, publicLayoutSetPrototypeId,
376                                            privateLayoutSetPrototypeId);
377    
378                            Object returnObj = null;
379    
380                            try {
381                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
382                            }
383                            catch (Exception e) {
384                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
385                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
386                                    }
387    
388                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
389                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
390                                    }
391    
392                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
393                            }
394    
395                            return (com.liferay.portal.model.UserGroup)returnObj;
396                    }
397                    catch (com.liferay.portal.kernel.exception.SystemException se) {
398                            _log.error(se, se);
399    
400                            throw se;
401                    }
402            }
403    
404            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
405            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
406                            long.class, long[].class
407                    };
408            private static final Class<?>[] _addTeamUserGroupsParameterTypes1 = new Class[] {
409                            long.class, long[].class
410                    };
411            private static final Class<?>[] _addUserGroupParameterTypes2 = new Class[] {
412                            java.lang.String.class, java.lang.String.class, long.class,
413                            long.class
414                    };
415            private static final Class<?>[] _deleteUserGroupParameterTypes3 = new Class[] {
416                            long.class
417                    };
418            private static final Class<?>[] _getUserGroupParameterTypes4 = new Class[] {
419                            long.class
420                    };
421            private static final Class<?>[] _getUserGroupParameterTypes5 = new Class[] {
422                            java.lang.String.class
423                    };
424            private static final Class<?>[] _getUserUserGroupsParameterTypes6 = new Class[] {
425                            long.class
426                    };
427            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes7 = new Class[] {
428                            long.class, long[].class
429                    };
430            private static final Class<?>[] _unsetTeamUserGroupsParameterTypes8 = new Class[] {
431                            long.class, long[].class
432                    };
433            private static final Class<?>[] _updateUserGroupParameterTypes9 = new Class[] {
434                            long.class, java.lang.String.class, java.lang.String.class,
435                            long.class, long.class
436                    };
437    }