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 void deleteRecord(HttpPrincipal httpPrincipal, long recordId)
136                    throws com.liferay.portal.kernel.exception.PortalException,
137                            com.liferay.portal.kernel.exception.SystemException {
138                    try {
139                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
140                                            "deleteRecord", _deleteRecordParameterTypes2);
141    
142                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
143    
144                            try {
145                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
146                            }
147                            catch (Exception e) {
148                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
150                                    }
151    
152                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
153                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
154                                    }
155    
156                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
157                            }
158                    }
159                    catch (com.liferay.portal.kernel.exception.SystemException se) {
160                            _log.error(se, se);
161    
162                            throw se;
163                    }
164            }
165    
166            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord deleteRecordLocale(
167                    HttpPrincipal httpPrincipal, long recordId, java.util.Locale locale,
168                    com.liferay.portal.service.ServiceContext serviceContext)
169                    throws com.liferay.portal.kernel.exception.PortalException,
170                            com.liferay.portal.kernel.exception.SystemException {
171                    try {
172                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
173                                            "deleteRecordLocale", _deleteRecordLocaleParameterTypes3);
174    
175                            MethodHandler methodHandler = new MethodHandler(methodKey,
176                                            recordId, locale, serviceContext);
177    
178                            Object returnObj = null;
179    
180                            try {
181                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
182                            }
183                            catch (Exception e) {
184                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
185                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
186                                    }
187    
188                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
189                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
190                                    }
191    
192                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
193                            }
194    
195                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
196                    }
197                    catch (com.liferay.portal.kernel.exception.SystemException se) {
198                            _log.error(se, se);
199    
200                            throw se;
201                    }
202            }
203    
204            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord getRecord(
205                    HttpPrincipal httpPrincipal, long recordId)
206                    throws com.liferay.portal.kernel.exception.PortalException,
207                            com.liferay.portal.kernel.exception.SystemException {
208                    try {
209                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
210                                            "getRecord", _getRecordParameterTypes4);
211    
212                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
213    
214                            Object returnObj = null;
215    
216                            try {
217                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
218                            }
219                            catch (Exception e) {
220                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
221                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
222                                    }
223    
224                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
225                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230    
231                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            public static void revertRecordVersion(HttpPrincipal httpPrincipal,
241                    long recordId, java.lang.String version,
242                    com.liferay.portal.service.ServiceContext serviceContext)
243                    throws com.liferay.portal.kernel.exception.PortalException,
244                            com.liferay.portal.kernel.exception.SystemException {
245                    try {
246                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
247                                            "revertRecordVersion", _revertRecordVersionParameterTypes5);
248    
249                            MethodHandler methodHandler = new MethodHandler(methodKey,
250                                            recordId, version, serviceContext);
251    
252                            try {
253                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
254                            }
255                            catch (Exception e) {
256                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
257                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
258                                    }
259    
260                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
261                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
262                                    }
263    
264                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
265                            }
266                    }
267                    catch (com.liferay.portal.kernel.exception.SystemException se) {
268                            _log.error(se, se);
269    
270                            throw se;
271                    }
272            }
273    
274            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
275                    HttpPrincipal httpPrincipal, long recordId, boolean majorVersion,
276                    int displayIndex,
277                    com.liferay.portlet.dynamicdatamapping.storage.Fields fields,
278                    boolean mergeFields,
279                    com.liferay.portal.service.ServiceContext serviceContext)
280                    throws com.liferay.portal.kernel.exception.PortalException,
281                            com.liferay.portal.kernel.exception.SystemException {
282                    try {
283                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
284                                            "updateRecord", _updateRecordParameterTypes6);
285    
286                            MethodHandler methodHandler = new MethodHandler(methodKey,
287                                            recordId, majorVersion, displayIndex, fields, mergeFields,
288                                            serviceContext);
289    
290                            Object returnObj = null;
291    
292                            try {
293                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
294                            }
295                            catch (Exception e) {
296                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
297                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
298                                    }
299    
300                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
301                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
302                                    }
303    
304                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
305                            }
306    
307                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
308                    }
309                    catch (com.liferay.portal.kernel.exception.SystemException se) {
310                            _log.error(se, se);
311    
312                            throw se;
313                    }
314            }
315    
316            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
317                    HttpPrincipal httpPrincipal, long recordId, int displayIndex,
318                    java.util.Map<java.lang.String, java.io.Serializable> fieldsMap,
319                    boolean mergeFields,
320                    com.liferay.portal.service.ServiceContext serviceContext)
321                    throws com.liferay.portal.kernel.exception.PortalException,
322                            com.liferay.portal.kernel.exception.SystemException {
323                    try {
324                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
325                                            "updateRecord", _updateRecordParameterTypes7);
326    
327                            MethodHandler methodHandler = new MethodHandler(methodKey,
328                                            recordId, displayIndex, fieldsMap, mergeFields,
329                                            serviceContext);
330    
331                            Object returnObj = null;
332    
333                            try {
334                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
335                            }
336                            catch (Exception e) {
337                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
338                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
339                                    }
340    
341                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
342                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
343                                    }
344    
345                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
346                            }
347    
348                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
349                    }
350                    catch (com.liferay.portal.kernel.exception.SystemException se) {
351                            _log.error(se, se);
352    
353                            throw se;
354                    }
355            }
356    
357            private static Log _log = LogFactoryUtil.getLog(DDLRecordServiceHttp.class);
358            private static final Class<?>[] _addRecordParameterTypes0 = new Class[] {
359                            long.class, long.class, int.class,
360                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
361                            com.liferay.portal.service.ServiceContext.class
362                    };
363            private static final Class<?>[] _addRecordParameterTypes1 = new Class[] {
364                            long.class, long.class, int.class, java.util.Map.class,
365                            com.liferay.portal.service.ServiceContext.class
366                    };
367            private static final Class<?>[] _deleteRecordParameterTypes2 = new Class[] {
368                            long.class
369                    };
370            private static final Class<?>[] _deleteRecordLocaleParameterTypes3 = new Class[] {
371                            long.class, java.util.Locale.class,
372                            com.liferay.portal.service.ServiceContext.class
373                    };
374            private static final Class<?>[] _getRecordParameterTypes4 = new Class[] {
375                            long.class
376                    };
377            private static final Class<?>[] _revertRecordVersionParameterTypes5 = new Class[] {
378                            long.class, java.lang.String.class,
379                            com.liferay.portal.service.ServiceContext.class
380                    };
381            private static final Class<?>[] _updateRecordParameterTypes6 = new Class[] {
382                            long.class, boolean.class, int.class,
383                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
384                            boolean.class, com.liferay.portal.service.ServiceContext.class
385                    };
386            private static final Class<?>[] _updateRecordParameterTypes7 = new Class[] {
387                            long.class, int.class, java.util.Map.class, boolean.class,
388                            com.liferay.portal.service.ServiceContext.class
389                    };
390    }