001    /**
002     * Copyright (c) 2000-2013 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.TeamServiceUtil;
023    
024    /**
025     * Provides the HTTP utility for the
026     * {@link com.liferay.portal.service.TeamServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it requires an additional
029     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
030     *
031     * <p>
032     * The benefits of using the HTTP utility is that it is fast and allows for
033     * tunneling without the cost of serializing to text. The drawback is that it
034     * only works with Java.
035     * </p>
036     *
037     * <p>
038     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
039     * configure security.
040     * </p>
041     *
042     * <p>
043     * The HTTP utility is only generated for remote services.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see TeamServiceSoap
048     * @see com.liferay.portal.security.auth.HttpPrincipal
049     * @see com.liferay.portal.service.TeamServiceUtil
050     * @generated
051     */
052    public class TeamServiceHttp {
053            public static com.liferay.portal.model.Team addTeam(
054                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
055                    java.lang.String description)
056                    throws com.liferay.portal.kernel.exception.PortalException,
057                            com.liferay.portal.kernel.exception.SystemException {
058                    try {
059                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
060                                            "addTeam", _addTeamParameterTypes0);
061    
062                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
063                                            name, description);
064    
065                            Object returnObj = null;
066    
067                            try {
068                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
069                            }
070                            catch (Exception e) {
071                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
072                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
073                                    }
074    
075                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
076                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portal.model.Team)returnObj;
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static void deleteTeam(HttpPrincipal httpPrincipal, long teamId)
092                    throws com.liferay.portal.kernel.exception.PortalException,
093                            com.liferay.portal.kernel.exception.SystemException {
094                    try {
095                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
096                                            "deleteTeam", _deleteTeamParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
099    
100                            try {
101                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
106                                    }
107    
108                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
109                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
110                                    }
111    
112                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
113                            }
114                    }
115                    catch (com.liferay.portal.kernel.exception.SystemException se) {
116                            _log.error(se, se);
117    
118                            throw se;
119                    }
120            }
121    
122            public static java.util.List<com.liferay.portal.model.Team> getGroupTeams(
123                    HttpPrincipal httpPrincipal, long groupId)
124                    throws com.liferay.portal.kernel.exception.PortalException,
125                            com.liferay.portal.kernel.exception.SystemException {
126                    try {
127                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
128                                            "getGroupTeams", _getGroupTeamsParameterTypes2);
129    
130                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
131    
132                            Object returnObj = null;
133    
134                            try {
135                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
136                            }
137                            catch (Exception e) {
138                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
139                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
140                                    }
141    
142                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
143                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
144                                    }
145    
146                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
147                            }
148    
149                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
150                    }
151                    catch (com.liferay.portal.kernel.exception.SystemException se) {
152                            _log.error(se, se);
153    
154                            throw se;
155                    }
156            }
157    
158            public static com.liferay.portal.model.Team getTeam(
159                    HttpPrincipal httpPrincipal, long teamId)
160                    throws com.liferay.portal.kernel.exception.PortalException,
161                            com.liferay.portal.kernel.exception.SystemException {
162                    try {
163                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
164                                            "getTeam", _getTeamParameterTypes3);
165    
166                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
167    
168                            Object returnObj = null;
169    
170                            try {
171                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
172                            }
173                            catch (Exception e) {
174                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
175                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
176                                    }
177    
178                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
179                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
180                                    }
181    
182                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
183                            }
184    
185                            return (com.liferay.portal.model.Team)returnObj;
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.Team getTeam(
195                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
196                    throws com.liferay.portal.kernel.exception.PortalException,
197                            com.liferay.portal.kernel.exception.SystemException {
198                    try {
199                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
200                                            "getTeam", _getTeamParameterTypes4);
201    
202                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
203                                            name);
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.Team)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 java.util.List<com.liferay.portal.model.Team> getUserTeams(
232                    HttpPrincipal httpPrincipal, long userId)
233                    throws com.liferay.portal.kernel.exception.PortalException,
234                            com.liferay.portal.kernel.exception.SystemException {
235                    try {
236                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
237                                            "getUserTeams", _getUserTeamsParameterTypes5);
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.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 (java.util.List<com.liferay.portal.model.Team>)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.Team> getUserTeams(
268                    HttpPrincipal httpPrincipal, long userId, long groupId)
269                    throws com.liferay.portal.kernel.exception.PortalException,
270                            com.liferay.portal.kernel.exception.SystemException {
271                    try {
272                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
273                                            "getUserTeams", _getUserTeamsParameterTypes6);
274    
275                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
276                                            groupId);
277    
278                            Object returnObj = null;
279    
280                            try {
281                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
282                            }
283                            catch (Exception e) {
284                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
285                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
286                                    }
287    
288                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
289                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
290                                    }
291    
292                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
293                            }
294    
295                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
296                    }
297                    catch (com.liferay.portal.kernel.exception.SystemException se) {
298                            _log.error(se, se);
299    
300                            throw se;
301                    }
302            }
303    
304            public static boolean hasUserTeam(HttpPrincipal httpPrincipal, long userId,
305                    long teamId)
306                    throws com.liferay.portal.kernel.exception.PortalException,
307                            com.liferay.portal.kernel.exception.SystemException {
308                    try {
309                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
310                                            "hasUserTeam", _hasUserTeamParameterTypes7);
311    
312                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
313                                            teamId);
314    
315                            Object returnObj = null;
316    
317                            try {
318                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
319                            }
320                            catch (Exception e) {
321                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
322                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
323                                    }
324    
325                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
326                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
327                                    }
328    
329                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
330                            }
331    
332                            return ((Boolean)returnObj).booleanValue();
333                    }
334                    catch (com.liferay.portal.kernel.exception.SystemException se) {
335                            _log.error(se, se);
336    
337                            throw se;
338                    }
339            }
340    
341            public static com.liferay.portal.model.Team updateTeam(
342                    HttpPrincipal httpPrincipal, long teamId, java.lang.String name,
343                    java.lang.String description)
344                    throws com.liferay.portal.kernel.exception.PortalException,
345                            com.liferay.portal.kernel.exception.SystemException {
346                    try {
347                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
348                                            "updateTeam", _updateTeamParameterTypes8);
349    
350                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
351                                            name, description);
352    
353                            Object returnObj = null;
354    
355                            try {
356                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
357                            }
358                            catch (Exception e) {
359                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
360                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
361                                    }
362    
363                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
364                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
365                                    }
366    
367                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
368                            }
369    
370                            return (com.liferay.portal.model.Team)returnObj;
371                    }
372                    catch (com.liferay.portal.kernel.exception.SystemException se) {
373                            _log.error(se, se);
374    
375                            throw se;
376                    }
377            }
378    
379            private static Log _log = LogFactoryUtil.getLog(TeamServiceHttp.class);
380            private static final Class<?>[] _addTeamParameterTypes0 = new Class[] {
381                            long.class, java.lang.String.class, java.lang.String.class
382                    };
383            private static final Class<?>[] _deleteTeamParameterTypes1 = new Class[] {
384                            long.class
385                    };
386            private static final Class<?>[] _getGroupTeamsParameterTypes2 = new Class[] {
387                            long.class
388                    };
389            private static final Class<?>[] _getTeamParameterTypes3 = new Class[] {
390                            long.class
391                    };
392            private static final Class<?>[] _getTeamParameterTypes4 = new Class[] {
393                            long.class, java.lang.String.class
394                    };
395            private static final Class<?>[] _getUserTeamsParameterTypes5 = new Class[] {
396                            long.class
397                    };
398            private static final Class<?>[] _getUserTeamsParameterTypes6 = new Class[] {
399                            long.class, long.class
400                    };
401            private static final Class<?>[] _hasUserTeamParameterTypes7 = new Class[] {
402                            long.class, long.class
403                    };
404            private static final Class<?>[] _updateTeamParameterTypes8 = new Class[] {
405                            long.class, java.lang.String.class, java.lang.String.class
406                    };
407    }