001    /**
002     * Copyright (c) 2000-2010 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 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", _addUserGroupParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
098                                            description);
099    
100                            Object returnObj = null;
101    
102                            try {
103                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
111                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
112                                    }
113    
114                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
115                            }
116    
117                            return (com.liferay.portal.model.UserGroup)returnObj;
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
127                    long userGroupId)
128                    throws com.liferay.portal.kernel.exception.PortalException,
129                            com.liferay.portal.kernel.exception.SystemException {
130                    try {
131                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
132                                            "deleteUserGroup", _deleteUserGroupParameterTypes2);
133    
134                            MethodHandler methodHandler = new MethodHandler(methodKey,
135                                            userGroupId);
136    
137                            try {
138                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
153                            _log.error(se, se);
154    
155                            throw se;
156                    }
157            }
158    
159            public static com.liferay.portal.model.UserGroup getUserGroup(
160                    HttpPrincipal httpPrincipal, long userGroupId)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    try {
164                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
165                                            "getUserGroup", _getUserGroupParameterTypes3);
166    
167                            MethodHandler methodHandler = new MethodHandler(methodKey,
168                                            userGroupId);
169    
170                            Object returnObj = null;
171    
172                            try {
173                                    returnObj = 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                            return (com.liferay.portal.model.UserGroup)returnObj;
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            public static com.liferay.portal.model.UserGroup getUserGroup(
197                    HttpPrincipal httpPrincipal, java.lang.String name)
198                    throws com.liferay.portal.kernel.exception.PortalException,
199                            com.liferay.portal.kernel.exception.SystemException {
200                    try {
201                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
202                                            "getUserGroup", _getUserGroupParameterTypes4);
203    
204                            MethodHandler methodHandler = new MethodHandler(methodKey, name);
205    
206                            Object returnObj = null;
207    
208                            try {
209                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
210                            }
211                            catch (Exception e) {
212                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
213                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
214                                    }
215    
216                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
217                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
218                                    }
219    
220                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
221                            }
222    
223                            return (com.liferay.portal.model.UserGroup)returnObj;
224                    }
225                    catch (com.liferay.portal.kernel.exception.SystemException se) {
226                            _log.error(se, se);
227    
228                            throw se;
229                    }
230            }
231    
232            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
233                    HttpPrincipal httpPrincipal, long userId)
234                    throws com.liferay.portal.kernel.exception.SystemException {
235                    try {
236                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
237                                            "getUserUserGroups", _getUserUserGroupsParameterTypes5);
238    
239                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
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.SystemException) {
248                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
249                                    }
250    
251                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
252                            }
253    
254                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
255                    }
256                    catch (com.liferay.portal.kernel.exception.SystemException se) {
257                            _log.error(se, se);
258    
259                            throw se;
260                    }
261            }
262    
263            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
264                    long groupId, long[] userGroupIds)
265                    throws com.liferay.portal.kernel.exception.PortalException,
266                            com.liferay.portal.kernel.exception.SystemException {
267                    try {
268                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
269                                            "unsetGroupUserGroups", _unsetGroupUserGroupsParameterTypes6);
270    
271                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
272                                            userGroupIds);
273    
274                            try {
275                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
276                            }
277                            catch (Exception e) {
278                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
279                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
280                                    }
281    
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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
290                            _log.error(se, se);
291    
292                            throw se;
293                    }
294            }
295    
296            public static com.liferay.portal.model.UserGroup updateUserGroup(
297                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
298                    java.lang.String description)
299                    throws com.liferay.portal.kernel.exception.PortalException,
300                            com.liferay.portal.kernel.exception.SystemException {
301                    try {
302                            MethodKey methodKey = new MethodKey(UserGroupServiceUtil.class.getName(),
303                                            "updateUserGroup", _updateUserGroupParameterTypes7);
304    
305                            MethodHandler methodHandler = new MethodHandler(methodKey,
306                                            userGroupId, name, description);
307    
308                            Object returnObj = null;
309    
310                            try {
311                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
312                            }
313                            catch (Exception e) {
314                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
315                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
316                                    }
317    
318                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
319                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
320                                    }
321    
322                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
323                            }
324    
325                            return (com.liferay.portal.model.UserGroup)returnObj;
326                    }
327                    catch (com.liferay.portal.kernel.exception.SystemException se) {
328                            _log.error(se, se);
329    
330                            throw se;
331                    }
332            }
333    
334            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
335            private static final Class<?>[] _addGroupUserGroupsParameterTypes0 = new Class[] {
336                            long.class, long[].class
337                    };
338            private static final Class<?>[] _addUserGroupParameterTypes1 = new Class[] {
339                            java.lang.String.class, java.lang.String.class
340                    };
341            private static final Class<?>[] _deleteUserGroupParameterTypes2 = new Class[] {
342                            long.class
343                    };
344            private static final Class<?>[] _getUserGroupParameterTypes3 = new Class[] {
345                            long.class
346                    };
347            private static final Class<?>[] _getUserGroupParameterTypes4 = new Class[] {
348                            java.lang.String.class
349                    };
350            private static final Class<?>[] _getUserUserGroupsParameterTypes5 = new Class[] {
351                            long.class
352                    };
353            private static final Class<?>[] _unsetGroupUserGroupsParameterTypes6 = new Class[] {
354                            long.class, long[].class
355                    };
356            private static final Class<?>[] _updateUserGroupParameterTypes7 = new Class[] {
357                            long.class, java.lang.String.class, java.lang.String.class
358                    };
359    }