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.portlet.expando.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.http.TunnelUtil;
025    
026    import com.liferay.portlet.expando.service.ExpandoValueServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link 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 HttpPrincipal} parameter.
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author Brian Wing Shun Chan
051     * @see ExpandoValueServiceSoap
052     * @see HttpPrincipal
053     * @see ExpandoValueServiceUtil
054     * @generated
055     */
056    @ProviderType
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                    try {
064                            MethodKey methodKey = new MethodKey(ExpandoValueServiceUtil.class,
065                                            "addValue", _addValueParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            companyId, className, tableName, columnName, classPK, data);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082    
083                            return (com.liferay.portlet.expando.model.ExpandoValue)returnObj;
084                    }
085                    catch (com.liferay.portal.kernel.exception.SystemException se) {
086                            _log.error(se, se);
087    
088                            throw se;
089                    }
090            }
091    
092            public static com.liferay.portlet.expando.model.ExpandoValue addValue(
093                    HttpPrincipal httpPrincipal, long companyId,
094                    java.lang.String className, java.lang.String tableName,
095                    java.lang.String columnName, long classPK, java.lang.String data)
096                    throws com.liferay.portal.kernel.exception.PortalException {
097                    try {
098                            MethodKey methodKey = new MethodKey(ExpandoValueServiceUtil.class,
099                                            "addValue", _addValueParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey,
102                                            companyId, className, tableName, columnName, classPK, data);
103    
104                            Object returnObj = null;
105    
106                            try {
107                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
108                            }
109                            catch (Exception e) {
110                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111                                            throw (com.liferay.portal.kernel.exception.PortalException)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 void addValues(HttpPrincipal httpPrincipal, long companyId,
127                    java.lang.String className, java.lang.String tableName, long classPK,
128                    java.util.Map<java.lang.String, java.io.Serializable> attributeValues)
129                    throws com.liferay.portal.kernel.exception.PortalException {
130                    try {
131                            MethodKey methodKey = new MethodKey(ExpandoValueServiceUtil.class,
132                                            "addValues", _addValuesParameterTypes2);
133    
134                            MethodHandler methodHandler = new MethodHandler(methodKey,
135                                            companyId, className, tableName, classPK, attributeValues);
136    
137                            try {
138                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
139                            }
140                            catch (Exception e) {
141                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
143                                    }
144    
145                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
146                            }
147                    }
148                    catch (com.liferay.portal.kernel.exception.SystemException se) {
149                            _log.error(se, se);
150    
151                            throw se;
152                    }
153            }
154    
155            public static java.util.Map<java.lang.String, java.io.Serializable> getData(
156                    HttpPrincipal httpPrincipal, long companyId,
157                    java.lang.String className, java.lang.String tableName,
158                    java.util.Collection<java.lang.String> columnNames, long classPK)
159                    throws com.liferay.portal.kernel.exception.PortalException {
160                    try {
161                            MethodKey methodKey = new MethodKey(ExpandoValueServiceUtil.class,
162                                            "getData", _getDataParameterTypes3);
163    
164                            MethodHandler methodHandler = new MethodHandler(methodKey,
165                                            companyId, className, tableName, columnNames, classPK);
166    
167                            Object returnObj = null;
168    
169                            try {
170                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
171                            }
172                            catch (Exception e) {
173                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
174                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
175                                    }
176    
177                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
178                            }
179    
180                            return (java.util.Map<java.lang.String, java.io.Serializable>)returnObj;
181                    }
182                    catch (com.liferay.portal.kernel.exception.SystemException se) {
183                            _log.error(se, se);
184    
185                            throw se;
186                    }
187            }
188    
189            public static java.io.Serializable getData(HttpPrincipal httpPrincipal,
190                    long companyId, java.lang.String className, java.lang.String tableName,
191                    java.lang.String columnName, long classPK)
192                    throws com.liferay.portal.kernel.exception.PortalException {
193                    try {
194                            MethodKey methodKey = new MethodKey(ExpandoValueServiceUtil.class,
195                                            "getData", _getDataParameterTypes4);
196    
197                            MethodHandler methodHandler = new MethodHandler(methodKey,
198                                            companyId, className, tableName, columnName, classPK);
199    
200                            Object returnObj = null;
201    
202                            try {
203                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
204                            }
205                            catch (Exception e) {
206                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
207                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
208                                    }
209    
210                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
211                            }
212    
213                            return (java.io.Serializable)returnObj;
214                    }
215                    catch (com.liferay.portal.kernel.exception.SystemException se) {
216                            _log.error(se, se);
217    
218                            throw se;
219                    }
220            }
221    
222            public static com.liferay.portal.kernel.json.JSONObject getJSONData(
223                    HttpPrincipal httpPrincipal, long companyId,
224                    java.lang.String className, java.lang.String tableName,
225                    java.lang.String columnName, long classPK)
226                    throws com.liferay.portal.kernel.exception.PortalException {
227                    try {
228                            MethodKey methodKey = new MethodKey(ExpandoValueServiceUtil.class,
229                                            "getJSONData", _getJSONDataParameterTypes5);
230    
231                            MethodHandler methodHandler = new MethodHandler(methodKey,
232                                            companyId, className, tableName, columnName, classPK);
233    
234                            Object returnObj = null;
235    
236                            try {
237                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
238                            }
239                            catch (Exception e) {
240                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
241                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
242                                    }
243    
244                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
245                            }
246    
247                            return (com.liferay.portal.kernel.json.JSONObject)returnObj;
248                    }
249                    catch (com.liferay.portal.kernel.exception.SystemException se) {
250                            _log.error(se, se);
251    
252                            throw se;
253                    }
254            }
255    
256            private static Log _log = LogFactoryUtil.getLog(ExpandoValueServiceHttp.class);
257            private static final Class<?>[] _addValueParameterTypes0 = new Class[] {
258                            long.class, java.lang.String.class, java.lang.String.class,
259                            java.lang.String.class, long.class, java.lang.Object.class
260                    };
261            private static final Class<?>[] _addValueParameterTypes1 = new Class[] {
262                            long.class, java.lang.String.class, java.lang.String.class,
263                            java.lang.String.class, long.class, java.lang.String.class
264                    };
265            private static final Class<?>[] _addValuesParameterTypes2 = new Class[] {
266                            long.class, java.lang.String.class, java.lang.String.class,
267                            long.class, java.util.Map.class
268                    };
269            private static final Class<?>[] _getDataParameterTypes3 = new Class[] {
270                            long.class, java.lang.String.class, java.lang.String.class,
271                            java.util.Collection.class, long.class
272                    };
273            private static final Class<?>[] _getDataParameterTypes4 = new Class[] {
274                            long.class, java.lang.String.class, java.lang.String.class,
275                            java.lang.String.class, long.class
276                    };
277            private static final Class<?>[] _getJSONDataParameterTypes5 = new Class[] {
278                            long.class, java.lang.String.class, java.lang.String.class,
279                            java.lang.String.class, long.class
280                    };
281    }