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.portlet.expando.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.http.TunnelUtil;
024    
025    import com.liferay.portlet.expando.service.ExpandoValueServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portlet.expando.service.ExpandoValueServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
034     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       ExpandoValueServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portlet.expando.service.ExpandoValueServiceUtil
055     * @generated
056     */
057    public class ExpandoValueServiceHttp {
058            public static com.liferay.portlet.expando.model.ExpandoValue addValue(
059                    HttpPrincipal httpPrincipal, long companyId,
060                    java.lang.String className, java.lang.String tableName,
061                    java.lang.String columnName, long classPK, java.lang.Object data)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            Object paramObj0 = new LongWrapper(companyId);
066    
067                            Object paramObj1 = className;
068    
069                            if (className == null) {
070                                    paramObj1 = new NullWrapper("java.lang.String");
071                            }
072    
073                            Object paramObj2 = tableName;
074    
075                            if (tableName == null) {
076                                    paramObj2 = new NullWrapper("java.lang.String");
077                            }
078    
079                            Object paramObj3 = columnName;
080    
081                            if (columnName == null) {
082                                    paramObj3 = new NullWrapper("java.lang.String");
083                            }
084    
085                            Object paramObj4 = new LongWrapper(classPK);
086    
087                            Object paramObj5 = data;
088    
089                            if (data == null) {
090                                    paramObj5 = new NullWrapper("java.lang.Object");
091                            }
092    
093                            MethodWrapper methodWrapper = new MethodWrapper(ExpandoValueServiceUtil.class.getName(),
094                                            "addValue",
095                                            new Object[] {
096                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
097                                                    paramObj5
098                                            });
099    
100                            Object returnObj = null;
101    
102                            try {
103                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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                            return (com.liferay.portlet.expando.model.ExpandoValue)returnObj;
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static com.liferay.portlet.expando.model.ExpandoValue addValue(
127                    HttpPrincipal httpPrincipal, long companyId,
128                    java.lang.String className, java.lang.String tableName,
129                    java.lang.String columnName, long classPK, java.lang.String data)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            Object paramObj0 = new LongWrapper(companyId);
134    
135                            Object paramObj1 = className;
136    
137                            if (className == null) {
138                                    paramObj1 = new NullWrapper("java.lang.String");
139                            }
140    
141                            Object paramObj2 = tableName;
142    
143                            if (tableName == null) {
144                                    paramObj2 = new NullWrapper("java.lang.String");
145                            }
146    
147                            Object paramObj3 = columnName;
148    
149                            if (columnName == null) {
150                                    paramObj3 = new NullWrapper("java.lang.String");
151                            }
152    
153                            Object paramObj4 = new LongWrapper(classPK);
154    
155                            Object paramObj5 = data;
156    
157                            if (data == null) {
158                                    paramObj5 = new NullWrapper("java.lang.String");
159                            }
160    
161                            MethodWrapper methodWrapper = new MethodWrapper(ExpandoValueServiceUtil.class.getName(),
162                                            "addValue",
163                                            new Object[] {
164                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
165                                                    paramObj5
166                                            });
167    
168                            Object returnObj = null;
169    
170                            try {
171                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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.portlet.expando.model.ExpandoValue)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 java.io.Serializable getData(HttpPrincipal httpPrincipal,
195                    long companyId, java.lang.String className, java.lang.String tableName,
196                    java.lang.String columnName, long classPK)
197                    throws com.liferay.portal.kernel.exception.PortalException,
198                            com.liferay.portal.kernel.exception.SystemException {
199                    try {
200                            Object paramObj0 = new LongWrapper(companyId);
201    
202                            Object paramObj1 = className;
203    
204                            if (className == null) {
205                                    paramObj1 = new NullWrapper("java.lang.String");
206                            }
207    
208                            Object paramObj2 = tableName;
209    
210                            if (tableName == null) {
211                                    paramObj2 = new NullWrapper("java.lang.String");
212                            }
213    
214                            Object paramObj3 = columnName;
215    
216                            if (columnName == null) {
217                                    paramObj3 = new NullWrapper("java.lang.String");
218                            }
219    
220                            Object paramObj4 = new LongWrapper(classPK);
221    
222                            MethodWrapper methodWrapper = new MethodWrapper(ExpandoValueServiceUtil.class.getName(),
223                                            "getData",
224                                            new Object[] {
225                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
226                                            });
227    
228                            Object returnObj = null;
229    
230                            try {
231                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
232                            }
233                            catch (Exception e) {
234                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
235                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
236                                    }
237    
238                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
239                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
240                                    }
241    
242                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
243                            }
244    
245                            return (java.io.Serializable)returnObj;
246                    }
247                    catch (com.liferay.portal.kernel.exception.SystemException se) {
248                            _log.error(se, se);
249    
250                            throw se;
251                    }
252            }
253    
254            public static com.liferay.portal.kernel.json.JSONObject getJSONData(
255                    HttpPrincipal httpPrincipal, long companyId,
256                    java.lang.String className, java.lang.String tableName,
257                    java.lang.String columnName, long classPK)
258                    throws com.liferay.portal.kernel.exception.PortalException,
259                            com.liferay.portal.kernel.exception.SystemException {
260                    try {
261                            Object paramObj0 = new LongWrapper(companyId);
262    
263                            Object paramObj1 = className;
264    
265                            if (className == null) {
266                                    paramObj1 = new NullWrapper("java.lang.String");
267                            }
268    
269                            Object paramObj2 = tableName;
270    
271                            if (tableName == null) {
272                                    paramObj2 = new NullWrapper("java.lang.String");
273                            }
274    
275                            Object paramObj3 = columnName;
276    
277                            if (columnName == null) {
278                                    paramObj3 = new NullWrapper("java.lang.String");
279                            }
280    
281                            Object paramObj4 = new LongWrapper(classPK);
282    
283                            MethodWrapper methodWrapper = new MethodWrapper(ExpandoValueServiceUtil.class.getName(),
284                                            "getJSONData",
285                                            new Object[] {
286                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
287                                            });
288    
289                            Object returnObj = null;
290    
291                            try {
292                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
293                            }
294                            catch (Exception e) {
295                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
296                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
297                                    }
298    
299                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
300                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
301                                    }
302    
303                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
304                            }
305    
306                            return (com.liferay.portal.kernel.json.JSONObject)returnObj;
307                    }
308                    catch (com.liferay.portal.kernel.exception.SystemException se) {
309                            _log.error(se, se);
310    
311                            throw se;
312                    }
313            }
314    
315            private static Log _log = LogFactoryUtil.getLog(ExpandoValueServiceHttp.class);
316    }