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