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.getName(),
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.getName(),
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 getRecord(
138                    HttpPrincipal httpPrincipal, long recordId)
139                    throws com.liferay.portal.kernel.exception.PortalException,
140                            com.liferay.portal.kernel.exception.SystemException {
141                    try {
142                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class.getName(),
143                                            "getRecord", _getRecordParameterTypes2);
144    
145                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
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 updateRecord(
174                    HttpPrincipal httpPrincipal, long recordId, boolean majorVersion,
175                    int displayIndex,
176                    com.liferay.portlet.dynamicdatamapping.storage.Fields fields,
177                    boolean mergeFields,
178                    com.liferay.portal.service.ServiceContext serviceContext)
179                    throws com.liferay.portal.kernel.exception.PortalException,
180                            com.liferay.portal.kernel.exception.SystemException {
181                    try {
182                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class.getName(),
183                                            "updateRecord", _updateRecordParameterTypes3);
184    
185                            MethodHandler methodHandler = new MethodHandler(methodKey,
186                                            recordId, majorVersion, displayIndex, fields, mergeFields,
187                                            serviceContext);
188    
189                            Object returnObj = null;
190    
191                            try {
192                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
193                            }
194                            catch (Exception e) {
195                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
196                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
197                                    }
198    
199                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
200                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
201                                    }
202    
203                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
204                            }
205    
206                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
207                    }
208                    catch (com.liferay.portal.kernel.exception.SystemException se) {
209                            _log.error(se, se);
210    
211                            throw se;
212                    }
213            }
214    
215            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
216                    HttpPrincipal httpPrincipal, long recordId, int displayIndex,
217                    java.util.Map<java.lang.String, java.io.Serializable> fieldsMap,
218                    boolean mergeFields,
219                    com.liferay.portal.service.ServiceContext serviceContext)
220                    throws com.liferay.portal.kernel.exception.PortalException,
221                            com.liferay.portal.kernel.exception.SystemException {
222                    try {
223                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class.getName(),
224                                            "updateRecord", _updateRecordParameterTypes4);
225    
226                            MethodHandler methodHandler = new MethodHandler(methodKey,
227                                            recordId, displayIndex, fieldsMap, mergeFields,
228                                            serviceContext);
229    
230                            Object returnObj = null;
231    
232                            try {
233                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
234                            }
235                            catch (Exception e) {
236                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
237                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
238                                    }
239    
240                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
241                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
242                                    }
243    
244                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
245                            }
246    
247                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)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(DDLRecordServiceHttp.class);
257            private static final Class<?>[] _addRecordParameterTypes0 = new Class[] {
258                            long.class, long.class, int.class,
259                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
260                            com.liferay.portal.service.ServiceContext.class
261                    };
262            private static final Class<?>[] _addRecordParameterTypes1 = new Class[] {
263                            long.class, long.class, int.class, java.util.Map.class,
264                            com.liferay.portal.service.ServiceContext.class
265                    };
266            private static final Class<?>[] _getRecordParameterTypes2 = new Class[] {
267                            long.class
268                    };
269            private static final Class<?>[] _updateRecordParameterTypes3 = new Class[] {
270                            long.class, boolean.class, int.class,
271                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
272                            boolean.class, com.liferay.portal.service.ServiceContext.class
273                    };
274            private static final Class<?>[] _updateRecordParameterTypes4 = new Class[] {
275                            long.class, int.class, java.util.Map.class, boolean.class,
276                            com.liferay.portal.service.ServiceContext.class
277                    };
278    }