001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.UserGroupServiceUtil;
023    
024    /**
025     * <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", long.class, long[].class);
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 com.liferay.portal.model.UserGroup addUserGroup(
089                    HttpPrincipal httpPrincipal, java.lang.String name,
090                    java.lang.String description)
091                    throws com.liferay.portal.kernel.exception.PortalException,
092                            com.liferay.portal.kernel.exception.SystemException {
093                    try {
094                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
095                                            "addUserGroup", java.lang.String.class,
096                                            java.lang.String.class);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
099                                            description);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
112                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
113                                    }
114    
115                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
116                            }
117    
118                            return (com.liferay.portal.model.UserGroup)returnObj;
119                    }
120                    catch (com.liferay.portal.kernel.exception.SystemException se) {
121                            _log.error(se, se);
122    
123                            throw se;
124                    }
125            }
126    
127            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
128                    long userGroupId)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    try {
132                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
133                                            "deleteUserGroup", long.class);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey,
136                                            userGroupId);
137    
138                            try {
139                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
140                            }
141                            catch (Exception e) {
142                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
143                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
144                                    }
145    
146                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
147                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
148                                    }
149    
150                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
151                            }
152                    }
153                    catch (com.liferay.portal.kernel.exception.SystemException se) {
154                            _log.error(se, se);
155    
156                            throw se;
157                    }
158            }
159    
160            public static com.liferay.portal.model.UserGroup getUserGroup(
161                    HttpPrincipal httpPrincipal, long userGroupId)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
166                                            "getUserGroup", long.class);
167    
168                            MethodHandler methodHandler = new MethodHandler(methodKey,
169                                            userGroupId);
170    
171                            Object returnObj = null;
172    
173                            try {
174                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
175                            }
176                            catch (Exception e) {
177                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
178                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
179                                    }
180    
181                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
182                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
183                                    }
184    
185                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
186                            }
187    
188                            return (com.liferay.portal.model.UserGroup)returnObj;
189                    }
190                    catch (com.liferay.portal.kernel.exception.SystemException se) {
191                            _log.error(se, se);
192    
193                            throw se;
194                    }
195            }
196    
197            public static com.liferay.portal.model.UserGroup getUserGroup(
198                    HttpPrincipal httpPrincipal, java.lang.String name)
199                    throws com.liferay.portal.kernel.exception.PortalException,
200                            com.liferay.portal.kernel.exception.SystemException {
201                    try {
202                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
203                                            "getUserGroup", java.lang.String.class);
204    
205                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
206    
207                            Object returnObj = null;
208    
209                            try {
210                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
211                            }
212                            catch (Exception e) {
213                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
214                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
215                                    }
216    
217                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
218                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
219                                    }
220    
221                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
222                            }
223    
224                            return (com.liferay.portal.model.UserGroup)returnObj;
225                    }
226                    catch (com.liferay.portal.kernel.exception.SystemException se) {
227                            _log.error(se, se);
228    
229                            throw se;
230                    }
231            }
232    
233            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
234                    HttpPrincipal httpPrincipal, long userId)
235                    throws com.liferay.portal.kernel.exception.SystemException {
236                    try {
237                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
238                                            "getUserUserGroups", long.class);
239    
240                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
241    
242                            Object returnObj = null;
243    
244                            try {
245                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
246                            }
247                            catch (Exception e) {
248                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
249                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
250                                    }
251    
252                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
253                            }
254    
255                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
256                    }
257                    catch (com.liferay.portal.kernel.exception.SystemException se) {
258                            _log.error(se, se);
259    
260                            throw se;
261                    }
262            }
263    
264            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
265                    long groupId, long[] userGroupIds)
266                    throws com.liferay.portal.kernel.exception.PortalException,
267                            com.liferay.portal.kernel.exception.SystemException {
268                    try {
269                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
270                                            "unsetGroupUserGroups", long.class, long[].class);
271    
272                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
273                                            userGroupIds);
274    
275                            try {
276                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
277                            }
278                            catch (Exception e) {
279                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
280                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
281                                    }
282    
283                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
284                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
285                                    }
286    
287                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
288                            }
289                    }
290                    catch (com.liferay.portal.kernel.exception.SystemException se) {
291                            _log.error(se, se);
292    
293                            throw se;
294                    }
295            }
296    
297            public static com.liferay.portal.model.UserGroup updateUserGroup(
298                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
299                    java.lang.String description)
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                                            "updateUserGroup", long.class, java.lang.String.class,
305                                            java.lang.String.class);
306    
307                            MethodHandler methodHandler = new MethodHandler(methodKey,
308                                            userGroupId, name, description);
309    
310                            Object returnObj = null;
311    
312                            try {
313                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
314                            }
315                            catch (Exception e) {
316                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
317                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
318                                    }
319    
320                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
321                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
322                                    }
323    
324                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
325                            }
326    
327                            return (com.liferay.portal.model.UserGroup)returnObj;
328                    }
329                    catch (com.liferay.portal.kernel.exception.SystemException se) {
330                            _log.error(se, se);
331    
332                            throw se;
333                    }
334            }
335    
336            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
337    }