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     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.TeamServiceUtil} 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       TeamServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.TeamServiceUtil
052     * @generated
053     */
054    public class TeamServiceHttp {
055            public static com.liferay.portal.model.Team addTeam(
056                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
057                    java.lang.String description)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portal.model.Team)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static void deleteTeam(HttpPrincipal httpPrincipal, long teamId)
094                    throws com.liferay.portal.kernel.exception.PortalException,
095                            com.liferay.portal.kernel.exception.SystemException {
096                    try {
097                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
098                                            "deleteTeam", _deleteTeamParameterTypes1);
099    
100                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
101    
102                            try {
103                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static java.util.List<com.liferay.portal.model.Team> getGroupTeams(
125                    HttpPrincipal httpPrincipal, long groupId)
126                    throws com.liferay.portal.kernel.exception.PortalException,
127                            com.liferay.portal.kernel.exception.SystemException {
128                    try {
129                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
130                                            "getGroupTeams", _getGroupTeamsParameterTypes2);
131    
132                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
133    
134                            Object returnObj = null;
135    
136                            try {
137                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
146                                    }
147    
148                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
149                            }
150    
151                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
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.Team getTeam(
161                    HttpPrincipal httpPrincipal, long teamId)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
166                                            "getTeam", _getTeamParameterTypes3);
167    
168                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
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.Team)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.Team getTeam(
197                    HttpPrincipal httpPrincipal, long groupId, 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(TeamServiceUtil.class.getName(),
202                                            "getTeam", _getTeamParameterTypes4);
203    
204                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
205                                            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.Team)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.Team> getUserTeams(
234                    HttpPrincipal httpPrincipal, long userId)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    try {
238                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
239                                            "getUserTeams", _getUserTeamsParameterTypes5);
240    
241                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
242    
243                            Object returnObj = null;
244    
245                            try {
246                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
247                            }
248                            catch (Exception e) {
249                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
250                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
251                                    }
252    
253                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
254                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
255                                    }
256    
257                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
258                            }
259    
260                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
261                    }
262                    catch (com.liferay.portal.kernel.exception.SystemException se) {
263                            _log.error(se, se);
264    
265                            throw se;
266                    }
267            }
268    
269            public static java.util.List<com.liferay.portal.model.Team> getUserTeams(
270                    HttpPrincipal httpPrincipal, long userId, long groupId)
271                    throws com.liferay.portal.kernel.exception.PortalException,
272                            com.liferay.portal.kernel.exception.SystemException {
273                    try {
274                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
275                                            "getUserTeams", _getUserTeamsParameterTypes6);
276    
277                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
278                                            groupId);
279    
280                            Object returnObj = null;
281    
282                            try {
283                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
284                            }
285                            catch (Exception e) {
286                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
287                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
288                                    }
289    
290                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
291                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
292                                    }
293    
294                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
295                            }
296    
297                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
298                    }
299                    catch (com.liferay.portal.kernel.exception.SystemException se) {
300                            _log.error(se, se);
301    
302                            throw se;
303                    }
304            }
305    
306            public static boolean hasUserTeam(HttpPrincipal httpPrincipal, long userId,
307                    long teamId)
308                    throws com.liferay.portal.kernel.exception.PortalException,
309                            com.liferay.portal.kernel.exception.SystemException {
310                    try {
311                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
312                                            "hasUserTeam", _hasUserTeamParameterTypes7);
313    
314                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
315                                            teamId);
316    
317                            Object returnObj = null;
318    
319                            try {
320                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
321                            }
322                            catch (Exception e) {
323                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
324                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
325                                    }
326    
327                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
328                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
329                                    }
330    
331                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
332                            }
333    
334                            return ((Boolean)returnObj).booleanValue();
335                    }
336                    catch (com.liferay.portal.kernel.exception.SystemException se) {
337                            _log.error(se, se);
338    
339                            throw se;
340                    }
341            }
342    
343            public static com.liferay.portal.model.Team updateTeam(
344                    HttpPrincipal httpPrincipal, long teamId, java.lang.String name,
345                    java.lang.String description)
346                    throws com.liferay.portal.kernel.exception.PortalException,
347                            com.liferay.portal.kernel.exception.SystemException {
348                    try {
349                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class.getName(),
350                                            "updateTeam", _updateTeamParameterTypes8);
351    
352                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
353                                            name, description);
354    
355                            Object returnObj = null;
356    
357                            try {
358                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
359                            }
360                            catch (Exception e) {
361                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
362                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
363                                    }
364    
365                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
366                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
367                                    }
368    
369                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
370                            }
371    
372                            return (com.liferay.portal.model.Team)returnObj;
373                    }
374                    catch (com.liferay.portal.kernel.exception.SystemException se) {
375                            _log.error(se, se);
376    
377                            throw se;
378                    }
379            }
380    
381            private static Log _log = LogFactoryUtil.getLog(TeamServiceHttp.class);
382            private static final Class<?>[] _addTeamParameterTypes0 = new Class[] {
383                            long.class, java.lang.String.class, java.lang.String.class
384                    };
385            private static final Class<?>[] _deleteTeamParameterTypes1 = new Class[] {
386                            long.class
387                    };
388            private static final Class<?>[] _getGroupTeamsParameterTypes2 = new Class[] {
389                            long.class
390                    };
391            private static final Class<?>[] _getTeamParameterTypes3 = new Class[] {
392                            long.class
393                    };
394            private static final Class<?>[] _getTeamParameterTypes4 = new Class[] {
395                            long.class, java.lang.String.class
396                    };
397            private static final Class<?>[] _getUserTeamsParameterTypes5 = new Class[] {
398                            long.class
399                    };
400            private static final Class<?>[] _getUserTeamsParameterTypes6 = new Class[] {
401                            long.class, long.class
402                    };
403            private static final Class<?>[] _hasUserTeamParameterTypes7 = new Class[] {
404                            long.class, long.class
405                    };
406            private static final Class<?>[] _updateTeamParameterTypes8 = new Class[] {
407                            long.class, java.lang.String.class, java.lang.String.class
408                    };
409    }