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.portlet.dynamicdatalists.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.http.TunnelUtil;
023    
024    import com.liferay.portlet.dynamicdatalists.service.DDLRecordServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link com.liferay.portlet.dynamicdatalists.service.DDLRecordServiceUtil} 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     *
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 DDLRecordServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portlet.dynamicdatalists.service.DDLRecordServiceUtil
052     * @generated
053     */
054    public class DDLRecordServiceHttp {
055            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord addRecord(
056                    HttpPrincipal httpPrincipal, long groupId, long recordSetId,
057                    int displayIndex,
058                    com.liferay.portlet.dynamicdatamapping.storage.Fields fields,
059                    com.liferay.portal.service.ServiceContext serviceContext)
060                    throws com.liferay.portal.kernel.exception.PortalException,
061                            com.liferay.portal.kernel.exception.SystemException {
062                    try {
063                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
064                                            "addRecord", _addRecordParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
067                                            recordSetId, displayIndex, fields, serviceContext);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
080                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
081                                    }
082    
083                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
084                            }
085    
086                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
087                    }
088                    catch (com.liferay.portal.kernel.exception.SystemException se) {
089                            _log.error(se, se);
090    
091                            throw se;
092                    }
093            }
094    
095            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord addRecord(
096                    HttpPrincipal httpPrincipal, long groupId, long recordSetId,
097                    int displayIndex,
098                    java.util.Map<java.lang.String, java.io.Serializable> fieldsMap,
099                    com.liferay.portal.service.ServiceContext serviceContext)
100                    throws com.liferay.portal.kernel.exception.PortalException,
101                            com.liferay.portal.kernel.exception.SystemException {
102                    try {
103                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
104                                            "addRecord", _addRecordParameterTypes1);
105    
106                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
107                                            recordSetId, displayIndex, fieldsMap, serviceContext);
108    
109                            Object returnObj = null;
110    
111                            try {
112                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
113                            }
114                            catch (Exception e) {
115                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
116                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
117                                    }
118    
119                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
120                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
121                                    }
122    
123                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
124                            }
125    
126                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
127                    }
128                    catch (com.liferay.portal.kernel.exception.SystemException se) {
129                            _log.error(se, se);
130    
131                            throw se;
132                    }
133            }
134    
135            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord deleteRecordLocale(
136                    HttpPrincipal httpPrincipal, long recordId, java.util.Locale locale,
137                    com.liferay.portal.service.ServiceContext serviceContext)
138                    throws com.liferay.portal.kernel.exception.PortalException,
139                            com.liferay.portal.kernel.exception.SystemException {
140                    try {
141                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
142                                            "deleteRecordLocale", _deleteRecordLocaleParameterTypes2);
143    
144                            MethodHandler methodHandler = new MethodHandler(methodKey,
145                                            recordId, locale, serviceContext);
146    
147                            Object returnObj = null;
148    
149                            try {
150                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
151                            }
152                            catch (Exception e) {
153                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
154                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
155                                    }
156    
157                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
158                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
159                                    }
160    
161                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
162                            }
163    
164                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord getRecord(
174                    HttpPrincipal httpPrincipal, long recordId)
175                    throws com.liferay.portal.kernel.exception.PortalException,
176                            com.liferay.portal.kernel.exception.SystemException {
177                    try {
178                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
179                                            "getRecord", _getRecordParameterTypes3);
180    
181                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
182    
183                            Object returnObj = null;
184    
185                            try {
186                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
187                            }
188                            catch (Exception e) {
189                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
190                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
191                                    }
192    
193                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
194                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
195                                    }
196    
197                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
198                            }
199    
200                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
201                    }
202                    catch (com.liferay.portal.kernel.exception.SystemException se) {
203                            _log.error(se, se);
204    
205                            throw se;
206                    }
207            }
208    
209            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
210                    HttpPrincipal httpPrincipal, long recordId, boolean majorVersion,
211                    int displayIndex,
212                    com.liferay.portlet.dynamicdatamapping.storage.Fields fields,
213                    boolean mergeFields,
214                    com.liferay.portal.service.ServiceContext serviceContext)
215                    throws com.liferay.portal.kernel.exception.PortalException,
216                            com.liferay.portal.kernel.exception.SystemException {
217                    try {
218                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
219                                            "updateRecord", _updateRecordParameterTypes4);
220    
221                            MethodHandler methodHandler = new MethodHandler(methodKey,
222                                            recordId, majorVersion, displayIndex, fields, mergeFields,
223                                            serviceContext);
224    
225                            Object returnObj = null;
226    
227                            try {
228                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
229                            }
230                            catch (Exception e) {
231                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
232                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
233                                    }
234    
235                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
236                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
237                                    }
238    
239                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
240                            }
241    
242                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
243                    }
244                    catch (com.liferay.portal.kernel.exception.SystemException se) {
245                            _log.error(se, se);
246    
247                            throw se;
248                    }
249            }
250    
251            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
252                    HttpPrincipal httpPrincipal, long recordId, int displayIndex,
253                    java.util.Map<java.lang.String, java.io.Serializable> fieldsMap,
254                    boolean mergeFields,
255                    com.liferay.portal.service.ServiceContext serviceContext)
256                    throws com.liferay.portal.kernel.exception.PortalException,
257                            com.liferay.portal.kernel.exception.SystemException {
258                    try {
259                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
260                                            "updateRecord", _updateRecordParameterTypes5);
261    
262                            MethodHandler methodHandler = new MethodHandler(methodKey,
263                                            recordId, displayIndex, fieldsMap, mergeFields,
264                                            serviceContext);
265    
266                            Object returnObj = null;
267    
268                            try {
269                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
270                            }
271                            catch (Exception e) {
272                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
273                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
274                                    }
275    
276                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
277                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
278                                    }
279    
280                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
281                            }
282    
283                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
284                    }
285                    catch (com.liferay.portal.kernel.exception.SystemException se) {
286                            _log.error(se, se);
287    
288                            throw se;
289                    }
290            }
291    
292            private static Log _log = LogFactoryUtil.getLog(DDLRecordServiceHttp.class);
293            private static final Class<?>[] _addRecordParameterTypes0 = new Class[] {
294                            long.class, long.class, int.class,
295                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
296                            com.liferay.portal.service.ServiceContext.class
297                    };
298            private static final Class<?>[] _addRecordParameterTypes1 = new Class[] {
299                            long.class, long.class, int.class, java.util.Map.class,
300                            com.liferay.portal.service.ServiceContext.class
301                    };
302            private static final Class<?>[] _deleteRecordLocaleParameterTypes2 = new Class[] {
303                            long.class, java.util.Locale.class,
304                            com.liferay.portal.service.ServiceContext.class
305                    };
306            private static final Class<?>[] _getRecordParameterTypes3 = new Class[] {
307                            long.class
308                    };
309            private static final Class<?>[] _updateRecordParameterTypes4 = new Class[] {
310                            long.class, boolean.class, int.class,
311                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
312                            boolean.class, com.liferay.portal.service.ServiceContext.class
313                    };
314            private static final Class<?>[] _updateRecordParameterTypes5 = new Class[] {
315                            long.class, int.class, java.util.Map.class, boolean.class,
316                            com.liferay.portal.service.ServiceContext.class
317                    };
318    }