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.TeamServiceUtil;
024    
025    /**
026     * <p>
027     * This class provides a HTTP utility for the
028     * {@link com.liferay.portal.service.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 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       TeamServiceSoap
051     * @see       com.liferay.portal.security.auth.HttpPrincipal
052     * @see       com.liferay.portal.service.TeamServiceUtil
053     * @generated
054     */
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                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            Object paramObj0 = new LongWrapper(groupId);
063    
064                            Object paramObj1 = name;
065    
066                            if (name == null) {
067                                    paramObj1 = new NullWrapper("java.lang.String");
068                            }
069    
070                            Object paramObj2 = description;
071    
072                            if (description == null) {
073                                    paramObj2 = new NullWrapper("java.lang.String");
074                            }
075    
076                            MethodWrapper methodWrapper = new MethodWrapper(TeamServiceUtil.class.getName(),
077                                            "addTeam", new Object[] { paramObj0, paramObj1, paramObj2 });
078    
079                            Object returnObj = null;
080    
081                            try {
082                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
083                            }
084                            catch (Exception e) {
085                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
086                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
087                                    }
088    
089                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
090                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
091                                    }
092    
093                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
094                            }
095    
096                            return (com.liferay.portal.model.Team)returnObj;
097                    }
098                    catch (com.liferay.portal.kernel.exception.SystemException se) {
099                            _log.error(se, se);
100    
101                            throw se;
102                    }
103            }
104    
105            public static void deleteTeam(HttpPrincipal httpPrincipal, long teamId)
106                    throws com.liferay.portal.kernel.exception.PortalException,
107                            com.liferay.portal.kernel.exception.SystemException {
108                    try {
109                            Object paramObj0 = new LongWrapper(teamId);
110    
111                            MethodWrapper methodWrapper = new MethodWrapper(TeamServiceUtil.class.getName(),
112                                            "deleteTeam", new Object[] { paramObj0 });
113    
114                            try {
115                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
116                            }
117                            catch (Exception e) {
118                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
119                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
120                                    }
121    
122                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
123                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
124                                    }
125    
126                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
127                            }
128                    }
129                    catch (com.liferay.portal.kernel.exception.SystemException se) {
130                            _log.error(se, se);
131    
132                            throw se;
133                    }
134            }
135    
136            public static com.liferay.portal.model.Team updateTeam(
137                    HttpPrincipal httpPrincipal, long teamId, java.lang.String name,
138                    java.lang.String description)
139                    throws com.liferay.portal.kernel.exception.PortalException,
140                            com.liferay.portal.kernel.exception.SystemException {
141                    try {
142                            Object paramObj0 = new LongWrapper(teamId);
143    
144                            Object paramObj1 = name;
145    
146                            if (name == null) {
147                                    paramObj1 = new NullWrapper("java.lang.String");
148                            }
149    
150                            Object paramObj2 = description;
151    
152                            if (description == null) {
153                                    paramObj2 = new NullWrapper("java.lang.String");
154                            }
155    
156                            MethodWrapper methodWrapper = new MethodWrapper(TeamServiceUtil.class.getName(),
157                                            "updateTeam",
158                                            new Object[] { paramObj0, paramObj1, paramObj2 });
159    
160                            Object returnObj = null;
161    
162                            try {
163                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
164                            }
165                            catch (Exception e) {
166                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
167                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
168                                    }
169    
170                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
171                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
172                                    }
173    
174                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
175                            }
176    
177                            return (com.liferay.portal.model.Team)returnObj;
178                    }
179                    catch (com.liferay.portal.kernel.exception.SystemException se) {
180                            _log.error(se, se);
181    
182                            throw se;
183                    }
184            }
185    
186            private static Log _log = LogFactoryUtil.getLog(TeamServiceHttp.class);
187    }