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.TeamServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link TeamServiceUtil} 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 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 TeamServiceSoap
050     * @see HttpPrincipal
051     * @see TeamServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class TeamServiceHttp {
056            public static com.liferay.portal.model.Team addTeam(
057                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
058                    java.lang.String description)
059                    throws com.liferay.portal.kernel.exception.PortalException {
060                    try {
061                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
062                                            "addTeam", _addTeamParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
065                                            name, description);
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079    
080                            return (com.liferay.portal.model.Team)returnObj;
081                    }
082                    catch (com.liferay.portal.kernel.exception.SystemException se) {
083                            _log.error(se, se);
084    
085                            throw se;
086                    }
087            }
088    
089            public static void deleteTeam(HttpPrincipal httpPrincipal, long teamId)
090                    throws com.liferay.portal.kernel.exception.PortalException {
091                    try {
092                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
093                                            "deleteTeam", _deleteTeamParameterTypes1);
094    
095                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
096    
097                            try {
098                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
099                            }
100                            catch (Exception e) {
101                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
102                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
103                                    }
104    
105                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
106                            }
107                    }
108                    catch (com.liferay.portal.kernel.exception.SystemException se) {
109                            _log.error(se, se);
110    
111                            throw se;
112                    }
113            }
114    
115            public static java.util.List<com.liferay.portal.model.Team> getGroupTeams(
116                    HttpPrincipal httpPrincipal, long groupId)
117                    throws com.liferay.portal.kernel.exception.PortalException {
118                    try {
119                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
120                                            "getGroupTeams", _getGroupTeamsParameterTypes2);
121    
122                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
123    
124                            Object returnObj = null;
125    
126                            try {
127                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
128                            }
129                            catch (Exception e) {
130                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
131                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
132                                    }
133    
134                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
135                            }
136    
137                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
138                    }
139                    catch (com.liferay.portal.kernel.exception.SystemException se) {
140                            _log.error(se, se);
141    
142                            throw se;
143                    }
144            }
145    
146            public static com.liferay.portal.model.Team getTeam(
147                    HttpPrincipal httpPrincipal, long teamId)
148                    throws com.liferay.portal.kernel.exception.PortalException {
149                    try {
150                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
151                                            "getTeam", _getTeamParameterTypes3);
152    
153                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
154    
155                            Object returnObj = null;
156    
157                            try {
158                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
159                            }
160                            catch (Exception e) {
161                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
162                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
163                                    }
164    
165                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
166                            }
167    
168                            return (com.liferay.portal.model.Team)returnObj;
169                    }
170                    catch (com.liferay.portal.kernel.exception.SystemException se) {
171                            _log.error(se, se);
172    
173                            throw se;
174                    }
175            }
176    
177            public static com.liferay.portal.model.Team getTeam(
178                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
179                    throws com.liferay.portal.kernel.exception.PortalException {
180                    try {
181                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
182                                            "getTeam", _getTeamParameterTypes4);
183    
184                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
185                                            name);
186    
187                            Object returnObj = null;
188    
189                            try {
190                                    returnObj = 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                            return (com.liferay.portal.model.Team)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 java.util.List<com.liferay.portal.model.Team> getUserTeams(
210                    HttpPrincipal httpPrincipal, long userId)
211                    throws com.liferay.portal.kernel.exception.PortalException {
212                    try {
213                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
214                                            "getUserTeams", _getUserTeamsParameterTypes5);
215    
216                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
217    
218                            Object returnObj = null;
219    
220                            try {
221                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
222                            }
223                            catch (Exception e) {
224                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
225                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230    
231                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            public static java.util.List<com.liferay.portal.model.Team> getUserTeams(
241                    HttpPrincipal httpPrincipal, long userId, long groupId)
242                    throws com.liferay.portal.kernel.exception.PortalException {
243                    try {
244                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
245                                            "getUserTeams", _getUserTeamsParameterTypes6);
246    
247                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
248                                            groupId);
249    
250                            Object returnObj = null;
251    
252                            try {
253                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
254                            }
255                            catch (Exception e) {
256                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
257                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
258                                    }
259    
260                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
261                            }
262    
263                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
264                    }
265                    catch (com.liferay.portal.kernel.exception.SystemException se) {
266                            _log.error(se, se);
267    
268                            throw se;
269                    }
270            }
271    
272            public static boolean hasUserTeam(HttpPrincipal httpPrincipal, long userId,
273                    long teamId) throws com.liferay.portal.kernel.exception.PortalException {
274                    try {
275                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
276                                            "hasUserTeam", _hasUserTeamParameterTypes7);
277    
278                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
279                                            teamId);
280    
281                            Object returnObj = null;
282    
283                            try {
284                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
285                            }
286                            catch (Exception e) {
287                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
288                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
289                                    }
290    
291                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
292                            }
293    
294                            return ((Boolean)returnObj).booleanValue();
295                    }
296                    catch (com.liferay.portal.kernel.exception.SystemException se) {
297                            _log.error(se, se);
298    
299                            throw se;
300                    }
301            }
302    
303            public static com.liferay.portal.model.Team updateTeam(
304                    HttpPrincipal httpPrincipal, long teamId, java.lang.String name,
305                    java.lang.String description)
306                    throws com.liferay.portal.kernel.exception.PortalException {
307                    try {
308                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
309                                            "updateTeam", _updateTeamParameterTypes8);
310    
311                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
312                                            name, description);
313    
314                            Object returnObj = null;
315    
316                            try {
317                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
318                            }
319                            catch (Exception e) {
320                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
321                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
322                                    }
323    
324                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
325                            }
326    
327                            return (com.liferay.portal.model.Team)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(TeamServiceHttp.class);
337            private static final Class<?>[] _addTeamParameterTypes0 = new Class[] {
338                            long.class, java.lang.String.class, java.lang.String.class
339                    };
340            private static final Class<?>[] _deleteTeamParameterTypes1 = new Class[] {
341                            long.class
342                    };
343            private static final Class<?>[] _getGroupTeamsParameterTypes2 = new Class[] {
344                            long.class
345                    };
346            private static final Class<?>[] _getTeamParameterTypes3 = new Class[] {
347                            long.class
348                    };
349            private static final Class<?>[] _getTeamParameterTypes4 = new Class[] {
350                            long.class, java.lang.String.class
351                    };
352            private static final Class<?>[] _getUserTeamsParameterTypes5 = new Class[] {
353                            long.class
354                    };
355            private static final Class<?>[] _getUserTeamsParameterTypes6 = new Class[] {
356                            long.class, long.class
357                    };
358            private static final Class<?>[] _hasUserTeamParameterTypes7 = new Class[] {
359                            long.class, long.class
360                    };
361            private static final Class<?>[] _updateTeamParameterTypes8 = new Class[] {
362                            long.class, java.lang.String.class, java.lang.String.class
363                    };
364    }