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.LongWrapper;
020    import com.liferay.portal.kernel.util.MethodWrapper;
021    import com.liferay.portal.kernel.util.NullWrapper;
022    import com.liferay.portal.security.auth.HttpPrincipal;
023    import com.liferay.portal.service.UserGroupServiceUtil;
024    
025    /**
026     * <p>
027     * This class provides a 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     * </p>
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author    Brian Wing Shun Chan
050     * @see       UserGroupServiceSoap
051     * @see       com.liferay.portal.security.auth.HttpPrincipal
052     * @see       com.liferay.portal.service.UserGroupServiceUtil
053     * @generated
054     */
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                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            Object paramObj0 = new LongWrapper(groupId);
062    
063                            Object paramObj1 = userGroupIds;
064    
065                            if (userGroupIds == null) {
066                                    paramObj1 = new NullWrapper("[J");
067                            }
068    
069                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
070                                            "addGroupUserGroups", new Object[] { paramObj0, paramObj1 });
071    
072                            try {
073                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086                    }
087                    catch (com.liferay.portal.kernel.exception.SystemException se) {
088                            _log.error(se, se);
089    
090                            throw se;
091                    }
092            }
093    
094            public static com.liferay.portal.model.UserGroup addUserGroup(
095                    HttpPrincipal httpPrincipal, java.lang.String name,
096                    java.lang.String description)
097                    throws com.liferay.portal.kernel.exception.PortalException,
098                            com.liferay.portal.kernel.exception.SystemException {
099                    try {
100                            Object paramObj0 = name;
101    
102                            if (name == null) {
103                                    paramObj0 = new NullWrapper("java.lang.String");
104                            }
105    
106                            Object paramObj1 = description;
107    
108                            if (description == null) {
109                                    paramObj1 = new NullWrapper("java.lang.String");
110                            }
111    
112                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
113                                            "addUserGroup", new Object[] { paramObj0, paramObj1 });
114    
115                            Object returnObj = null;
116    
117                            try {
118                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
119                            }
120                            catch (Exception e) {
121                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
122                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
123                                    }
124    
125                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
126                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
127                                    }
128    
129                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
130                            }
131    
132                            return (com.liferay.portal.model.UserGroup)returnObj;
133                    }
134                    catch (com.liferay.portal.kernel.exception.SystemException se) {
135                            _log.error(se, se);
136    
137                            throw se;
138                    }
139            }
140    
141            public static void deleteUserGroup(HttpPrincipal httpPrincipal,
142                    long userGroupId)
143                    throws com.liferay.portal.kernel.exception.PortalException,
144                            com.liferay.portal.kernel.exception.SystemException {
145                    try {
146                            Object paramObj0 = new LongWrapper(userGroupId);
147    
148                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
149                                            "deleteUserGroup", new Object[] { paramObj0 });
150    
151                            try {
152                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
153                            }
154                            catch (Exception e) {
155                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
156                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
157                                    }
158    
159                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
160                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
161                                    }
162    
163                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
164                            }
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            public static com.liferay.portal.model.UserGroup getUserGroup(
174                    HttpPrincipal httpPrincipal, long userGroupId)
175                    throws com.liferay.portal.kernel.exception.PortalException,
176                            com.liferay.portal.kernel.exception.SystemException {
177                    try {
178                            Object paramObj0 = new LongWrapper(userGroupId);
179    
180                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
181                                            "getUserGroup", new Object[] { paramObj0 });
182    
183                            Object returnObj = null;
184    
185                            try {
186                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
187                            }
188                            catch (Exception e) {
189                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
190                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
191                                    }
192    
193                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
194                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
195                                    }
196    
197                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
198                            }
199    
200                            return (com.liferay.portal.model.UserGroup)returnObj;
201                    }
202                    catch (com.liferay.portal.kernel.exception.SystemException se) {
203                            _log.error(se, se);
204    
205                            throw se;
206                    }
207            }
208    
209            public static com.liferay.portal.model.UserGroup getUserGroup(
210                    HttpPrincipal httpPrincipal, java.lang.String name)
211                    throws com.liferay.portal.kernel.exception.PortalException,
212                            com.liferay.portal.kernel.exception.SystemException {
213                    try {
214                            Object paramObj0 = name;
215    
216                            if (name == null) {
217                                    paramObj0 = new NullWrapper("java.lang.String");
218                            }
219    
220                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
221                                            "getUserGroup", new Object[] { paramObj0 });
222    
223                            Object returnObj = null;
224    
225                            try {
226                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
227                            }
228                            catch (Exception e) {
229                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
230                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
231                                    }
232    
233                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
234                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
235                                    }
236    
237                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
238                            }
239    
240                            return (com.liferay.portal.model.UserGroup)returnObj;
241                    }
242                    catch (com.liferay.portal.kernel.exception.SystemException se) {
243                            _log.error(se, se);
244    
245                            throw se;
246                    }
247            }
248    
249            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
250                    HttpPrincipal httpPrincipal, long userId)
251                    throws com.liferay.portal.kernel.exception.SystemException {
252                    try {
253                            Object paramObj0 = new LongWrapper(userId);
254    
255                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
256                                            "getUserUserGroups", new Object[] { paramObj0 });
257    
258                            Object returnObj = null;
259    
260                            try {
261                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
262                            }
263                            catch (Exception e) {
264                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
265                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
266                                    }
267    
268                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
269                            }
270    
271                            return (java.util.List<com.liferay.portal.model.UserGroup>)returnObj;
272                    }
273                    catch (com.liferay.portal.kernel.exception.SystemException se) {
274                            _log.error(se, se);
275    
276                            throw se;
277                    }
278            }
279    
280            public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
281                    long groupId, long[] userGroupIds)
282                    throws com.liferay.portal.kernel.exception.PortalException,
283                            com.liferay.portal.kernel.exception.SystemException {
284                    try {
285                            Object paramObj0 = new LongWrapper(groupId);
286    
287                            Object paramObj1 = userGroupIds;
288    
289                            if (userGroupIds == null) {
290                                    paramObj1 = new NullWrapper("[J");
291                            }
292    
293                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
294                                            "unsetGroupUserGroups",
295                                            new Object[] { paramObj0, paramObj1 });
296    
297                            try {
298                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
299                            }
300                            catch (Exception e) {
301                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
302                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
303                                    }
304    
305                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
306                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
307                                    }
308    
309                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
310                            }
311                    }
312                    catch (com.liferay.portal.kernel.exception.SystemException se) {
313                            _log.error(se, se);
314    
315                            throw se;
316                    }
317            }
318    
319            public static com.liferay.portal.model.UserGroup updateUserGroup(
320                    HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
321                    java.lang.String description)
322                    throws com.liferay.portal.kernel.exception.PortalException,
323                            com.liferay.portal.kernel.exception.SystemException {
324                    try {
325                            Object paramObj0 = new LongWrapper(userGroupId);
326    
327                            Object paramObj1 = name;
328    
329                            if (name == null) {
330                                    paramObj1 = new NullWrapper("java.lang.String");
331                            }
332    
333                            Object paramObj2 = description;
334    
335                            if (description == null) {
336                                    paramObj2 = new NullWrapper("java.lang.String");
337                            }
338    
339                            MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
340                                            "updateUserGroup",
341                                            new Object[] { paramObj0, paramObj1, paramObj2 });
342    
343                            Object returnObj = null;
344    
345                            try {
346                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
347                            }
348                            catch (Exception e) {
349                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
350                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
351                                    }
352    
353                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
354                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
355                                    }
356    
357                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
358                            }
359    
360                            return (com.liferay.portal.model.UserGroup)returnObj;
361                    }
362                    catch (com.liferay.portal.kernel.exception.SystemException se) {
363                            _log.error(se, se);
364    
365                            throw se;
366                    }
367            }
368    
369            private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
370    }