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 com.liferay.portal.model.Team addTeam(
090                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
091                    java.lang.String description,
092                    com.liferay.portal.service.ServiceContext serviceContext)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
096                                            "addTeam", _addTeamParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
099                                            name, description, serviceContext);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113    
114                            return (com.liferay.portal.model.Team)returnObj;
115                    }
116                    catch (com.liferay.portal.kernel.exception.SystemException se) {
117                            _log.error(se, se);
118    
119                            throw se;
120                    }
121            }
122    
123            public static void deleteTeam(HttpPrincipal httpPrincipal, long teamId)
124                    throws com.liferay.portal.kernel.exception.PortalException {
125                    try {
126                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
127                                            "deleteTeam", _deleteTeamParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
130    
131                            try {
132                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
133                            }
134                            catch (Exception e) {
135                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
136                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
137                                    }
138    
139                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
140                            }
141                    }
142                    catch (com.liferay.portal.kernel.exception.SystemException se) {
143                            _log.error(se, se);
144    
145                            throw se;
146                    }
147            }
148    
149            public static java.util.List<com.liferay.portal.model.Team> getGroupTeams(
150                    HttpPrincipal httpPrincipal, long groupId)
151                    throws com.liferay.portal.kernel.exception.PortalException {
152                    try {
153                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
154                                            "getGroupTeams", _getGroupTeamsParameterTypes3);
155    
156                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
157    
158                            Object returnObj = null;
159    
160                            try {
161                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
162                            }
163                            catch (Exception e) {
164                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
165                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
166                                    }
167    
168                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
169                            }
170    
171                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
172                    }
173                    catch (com.liferay.portal.kernel.exception.SystemException se) {
174                            _log.error(se, se);
175    
176                            throw se;
177                    }
178            }
179    
180            public static com.liferay.portal.model.Team getTeam(
181                    HttpPrincipal httpPrincipal, long teamId)
182                    throws com.liferay.portal.kernel.exception.PortalException {
183                    try {
184                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
185                                            "getTeam", _getTeamParameterTypes4);
186    
187                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId);
188    
189                            Object returnObj = null;
190    
191                            try {
192                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
193                            }
194                            catch (Exception e) {
195                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
196                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
197                                    }
198    
199                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
200                            }
201    
202                            return (com.liferay.portal.model.Team)returnObj;
203                    }
204                    catch (com.liferay.portal.kernel.exception.SystemException se) {
205                            _log.error(se, se);
206    
207                            throw se;
208                    }
209            }
210    
211            public static com.liferay.portal.model.Team getTeam(
212                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
213                    throws com.liferay.portal.kernel.exception.PortalException {
214                    try {
215                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
216                                            "getTeam", _getTeamParameterTypes5);
217    
218                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
219                                            name);
220    
221                            Object returnObj = null;
222    
223                            try {
224                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
225                            }
226                            catch (Exception e) {
227                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
228                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
229                                    }
230    
231                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
232                            }
233    
234                            return (com.liferay.portal.model.Team)returnObj;
235                    }
236                    catch (com.liferay.portal.kernel.exception.SystemException se) {
237                            _log.error(se, se);
238    
239                            throw se;
240                    }
241            }
242    
243            public static java.util.List<com.liferay.portal.model.Team> getUserTeams(
244                    HttpPrincipal httpPrincipal, long userId)
245                    throws com.liferay.portal.kernel.exception.PortalException {
246                    try {
247                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
248                                            "getUserTeams", _getUserTeamsParameterTypes6);
249    
250                            MethodHandler methodHandler = new MethodHandler(methodKey, userId);
251    
252                            Object returnObj = null;
253    
254                            try {
255                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
256                            }
257                            catch (Exception e) {
258                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
259                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
260                                    }
261    
262                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
263                            }
264    
265                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
266                    }
267                    catch (com.liferay.portal.kernel.exception.SystemException se) {
268                            _log.error(se, se);
269    
270                            throw se;
271                    }
272            }
273    
274            public static java.util.List<com.liferay.portal.model.Team> getUserTeams(
275                    HttpPrincipal httpPrincipal, long userId, long groupId)
276                    throws com.liferay.portal.kernel.exception.PortalException {
277                    try {
278                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
279                                            "getUserTeams", _getUserTeamsParameterTypes7);
280    
281                            MethodHandler methodHandler = new MethodHandler(methodKey, userId,
282                                            groupId);
283    
284                            Object returnObj = null;
285    
286                            try {
287                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
288                            }
289                            catch (Exception e) {
290                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
291                                            throw (com.liferay.portal.kernel.exception.PortalException)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) throws com.liferay.portal.kernel.exception.PortalException {
308                    try {
309                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
310                                            "hasUserTeam", _hasUserTeamParameterTypes8);
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
326                            }
327    
328                            return ((Boolean)returnObj).booleanValue();
329                    }
330                    catch (com.liferay.portal.kernel.exception.SystemException se) {
331                            _log.error(se, se);
332    
333                            throw se;
334                    }
335            }
336    
337            public static java.util.List<com.liferay.portal.model.Team> search(
338                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name,
339                    java.lang.String description,
340                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
341                    int start, int end,
342                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Team> obc) {
343                    try {
344                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
345                                            "search", _searchParameterTypes9);
346    
347                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
348                                            name, description, params, start, end, obc);
349    
350                            Object returnObj = null;
351    
352                            try {
353                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
354                            }
355                            catch (Exception e) {
356                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
357                            }
358    
359                            return (java.util.List<com.liferay.portal.model.Team>)returnObj;
360                    }
361                    catch (com.liferay.portal.kernel.exception.SystemException se) {
362                            _log.error(se, se);
363    
364                            throw se;
365                    }
366            }
367    
368            public static int searchCount(HttpPrincipal httpPrincipal, long groupId,
369                    java.lang.String name, java.lang.String description,
370                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) {
371                    try {
372                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
373                                            "searchCount", _searchCountParameterTypes10);
374    
375                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
376                                            name, description, params);
377    
378                            Object returnObj = null;
379    
380                            try {
381                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
382                            }
383                            catch (Exception e) {
384                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
385                            }
386    
387                            return ((Integer)returnObj).intValue();
388                    }
389                    catch (com.liferay.portal.kernel.exception.SystemException se) {
390                            _log.error(se, se);
391    
392                            throw se;
393                    }
394            }
395    
396            public static com.liferay.portal.model.Team updateTeam(
397                    HttpPrincipal httpPrincipal, long teamId, java.lang.String name,
398                    java.lang.String description)
399                    throws com.liferay.portal.kernel.exception.PortalException {
400                    try {
401                            MethodKey methodKey = new MethodKey(TeamServiceUtil.class,
402                                            "updateTeam", _updateTeamParameterTypes11);
403    
404                            MethodHandler methodHandler = new MethodHandler(methodKey, teamId,
405                                            name, description);
406    
407                            Object returnObj = null;
408    
409                            try {
410                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
411                            }
412                            catch (Exception e) {
413                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
414                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
415                                    }
416    
417                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
418                            }
419    
420                            return (com.liferay.portal.model.Team)returnObj;
421                    }
422                    catch (com.liferay.portal.kernel.exception.SystemException se) {
423                            _log.error(se, se);
424    
425                            throw se;
426                    }
427            }
428    
429            private static Log _log = LogFactoryUtil.getLog(TeamServiceHttp.class);
430            private static final Class<?>[] _addTeamParameterTypes0 = new Class[] {
431                            long.class, java.lang.String.class, java.lang.String.class
432                    };
433            private static final Class<?>[] _addTeamParameterTypes1 = new Class[] {
434                            long.class, java.lang.String.class, java.lang.String.class,
435                            com.liferay.portal.service.ServiceContext.class
436                    };
437            private static final Class<?>[] _deleteTeamParameterTypes2 = new Class[] {
438                            long.class
439                    };
440            private static final Class<?>[] _getGroupTeamsParameterTypes3 = new Class[] {
441                            long.class
442                    };
443            private static final Class<?>[] _getTeamParameterTypes4 = new Class[] {
444                            long.class
445                    };
446            private static final Class<?>[] _getTeamParameterTypes5 = new Class[] {
447                            long.class, java.lang.String.class
448                    };
449            private static final Class<?>[] _getUserTeamsParameterTypes6 = new Class[] {
450                            long.class
451                    };
452            private static final Class<?>[] _getUserTeamsParameterTypes7 = new Class[] {
453                            long.class, long.class
454                    };
455            private static final Class<?>[] _hasUserTeamParameterTypes8 = new Class[] {
456                            long.class, long.class
457                    };
458            private static final Class<?>[] _searchParameterTypes9 = new Class[] {
459                            long.class, java.lang.String.class, java.lang.String.class,
460                            java.util.LinkedHashMap.class, int.class, int.class,
461                            com.liferay.portal.kernel.util.OrderByComparator.class
462                    };
463            private static final Class<?>[] _searchCountParameterTypes10 = new Class[] {
464                            long.class, java.lang.String.class, java.lang.String.class,
465                            java.util.LinkedHashMap.class
466                    };
467            private static final Class<?>[] _updateTeamParameterTypes11 = new Class[] {
468                            long.class, java.lang.String.class, java.lang.String.class
469                    };
470    }