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.dynamicdatalists.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.dynamicdatalists.service.DDLRecordServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link com.liferay.portlet.dynamicdatalists.service.DDLRecordServiceUtil} 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 com.liferay.portal.security.auth.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 DDLRecordServiceSoap
052     * @see com.liferay.portal.security.auth.HttpPrincipal
053     * @see com.liferay.portlet.dynamicdatalists.service.DDLRecordServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class DDLRecordServiceHttp {
058            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord addRecord(
059                    HttpPrincipal httpPrincipal, long groupId, long recordSetId,
060                    int displayIndex,
061                    com.liferay.portlet.dynamicdatamapping.storage.Fields fields,
062                    com.liferay.portal.service.ServiceContext serviceContext)
063                    throws com.liferay.portal.kernel.exception.PortalException {
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord addRecord(
094                    HttpPrincipal httpPrincipal, long groupId, long recordSetId,
095                    int displayIndex,
096                    java.util.Map<java.lang.String, java.io.Serializable> fieldsMap,
097                    com.liferay.portal.service.ServiceContext serviceContext)
098                    throws com.liferay.portal.kernel.exception.PortalException {
099                    try {
100                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
101                                            "addRecord", _addRecordParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
104                                            recordSetId, displayIndex, fieldsMap, serviceContext);
105    
106                            Object returnObj = null;
107    
108                            try {
109                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
113                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118    
119                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
120                    }
121                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static void deleteRecord(HttpPrincipal httpPrincipal, long recordId)
129                    throws com.liferay.portal.kernel.exception.PortalException {
130                    try {
131                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
132                                            "deleteRecord", _deleteRecordParameterTypes2);
133    
134                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
135    
136                            try {
137                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
145                            }
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord deleteRecordLocale(
155                    HttpPrincipal httpPrincipal, long recordId, java.util.Locale locale,
156                    com.liferay.portal.service.ServiceContext serviceContext)
157                    throws com.liferay.portal.kernel.exception.PortalException {
158                    try {
159                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
160                                            "deleteRecordLocale", _deleteRecordLocaleParameterTypes3);
161    
162                            MethodHandler methodHandler = new MethodHandler(methodKey,
163                                            recordId, locale, serviceContext);
164    
165                            Object returnObj = null;
166    
167                            try {
168                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
169                            }
170                            catch (Exception e) {
171                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
172                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
173                                    }
174    
175                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
176                            }
177    
178                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
179                    }
180                    catch (com.liferay.portal.kernel.exception.SystemException se) {
181                            _log.error(se, se);
182    
183                            throw se;
184                    }
185            }
186    
187            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord getRecord(
188                    HttpPrincipal httpPrincipal, long recordId)
189                    throws com.liferay.portal.kernel.exception.PortalException {
190                    try {
191                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
192                                            "getRecord", _getRecordParameterTypes4);
193    
194                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
195    
196                            Object returnObj = null;
197    
198                            try {
199                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
200                            }
201                            catch (Exception e) {
202                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
203                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
204                                    }
205    
206                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
207                            }
208    
209                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
210                    }
211                    catch (com.liferay.portal.kernel.exception.SystemException se) {
212                            _log.error(se, se);
213    
214                            throw se;
215                    }
216            }
217    
218            public static void revertRecord(HttpPrincipal httpPrincipal, long recordId,
219                    java.lang.String version,
220                    com.liferay.portal.service.ServiceContext serviceContext)
221                    throws com.liferay.portal.kernel.exception.PortalException {
222                    try {
223                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
224                                            "revertRecord", _revertRecordParameterTypes5);
225    
226                            MethodHandler methodHandler = new MethodHandler(methodKey,
227                                            recordId, version, serviceContext);
228    
229                            try {
230                                    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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
238                            }
239                    }
240                    catch (com.liferay.portal.kernel.exception.SystemException se) {
241                            _log.error(se, se);
242    
243                            throw se;
244                    }
245            }
246    
247            public static void revertRecordVersion(HttpPrincipal httpPrincipal,
248                    long recordId, java.lang.String version,
249                    com.liferay.portal.service.ServiceContext serviceContext)
250                    throws com.liferay.portal.kernel.exception.PortalException {
251                    try {
252                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
253                                            "revertRecordVersion", _revertRecordVersionParameterTypes6);
254    
255                            MethodHandler methodHandler = new MethodHandler(methodKey,
256                                            recordId, version, serviceContext);
257    
258                            try {
259                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
260                            }
261                            catch (Exception e) {
262                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
263                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
264                                    }
265    
266                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
267                            }
268                    }
269                    catch (com.liferay.portal.kernel.exception.SystemException se) {
270                            _log.error(se, se);
271    
272                            throw se;
273                    }
274            }
275    
276            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
277                    HttpPrincipal httpPrincipal, long recordId, boolean majorVersion,
278                    int displayIndex,
279                    com.liferay.portlet.dynamicdatamapping.storage.Fields fields,
280                    boolean mergeFields,
281                    com.liferay.portal.service.ServiceContext serviceContext)
282                    throws com.liferay.portal.kernel.exception.PortalException {
283                    try {
284                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
285                                            "updateRecord", _updateRecordParameterTypes7);
286    
287                            MethodHandler methodHandler = new MethodHandler(methodKey,
288                                            recordId, majorVersion, displayIndex, fields, mergeFields,
289                                            serviceContext);
290    
291                            Object returnObj = null;
292    
293                            try {
294                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
295                            }
296                            catch (Exception e) {
297                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
298                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
299                                    }
300    
301                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
302                            }
303    
304                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
305                    }
306                    catch (com.liferay.portal.kernel.exception.SystemException se) {
307                            _log.error(se, se);
308    
309                            throw se;
310                    }
311            }
312    
313            public static com.liferay.portlet.dynamicdatalists.model.DDLRecord updateRecord(
314                    HttpPrincipal httpPrincipal, long recordId, int displayIndex,
315                    java.util.Map<java.lang.String, java.io.Serializable> fieldsMap,
316                    boolean mergeFields,
317                    com.liferay.portal.service.ServiceContext serviceContext)
318                    throws com.liferay.portal.kernel.exception.PortalException {
319                    try {
320                            MethodKey methodKey = new MethodKey(DDLRecordServiceUtil.class,
321                                            "updateRecord", _updateRecordParameterTypes8);
322    
323                            MethodHandler methodHandler = new MethodHandler(methodKey,
324                                            recordId, displayIndex, fieldsMap, mergeFields,
325                                            serviceContext);
326    
327                            Object returnObj = null;
328    
329                            try {
330                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
331                            }
332                            catch (Exception e) {
333                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
334                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
335                                    }
336    
337                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
338                            }
339    
340                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecord)returnObj;
341                    }
342                    catch (com.liferay.portal.kernel.exception.SystemException se) {
343                            _log.error(se, se);
344    
345                            throw se;
346                    }
347            }
348    
349            private static Log _log = LogFactoryUtil.getLog(DDLRecordServiceHttp.class);
350            private static final Class<?>[] _addRecordParameterTypes0 = new Class[] {
351                            long.class, long.class, int.class,
352                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
353                            com.liferay.portal.service.ServiceContext.class
354                    };
355            private static final Class<?>[] _addRecordParameterTypes1 = new Class[] {
356                            long.class, long.class, int.class, java.util.Map.class,
357                            com.liferay.portal.service.ServiceContext.class
358                    };
359            private static final Class<?>[] _deleteRecordParameterTypes2 = new Class[] {
360                            long.class
361                    };
362            private static final Class<?>[] _deleteRecordLocaleParameterTypes3 = new Class[] {
363                            long.class, java.util.Locale.class,
364                            com.liferay.portal.service.ServiceContext.class
365                    };
366            private static final Class<?>[] _getRecordParameterTypes4 = new Class[] {
367                            long.class
368                    };
369            private static final Class<?>[] _revertRecordParameterTypes5 = new Class[] {
370                            long.class, java.lang.String.class,
371                            com.liferay.portal.service.ServiceContext.class
372                    };
373            private static final Class<?>[] _revertRecordVersionParameterTypes6 = new Class[] {
374                            long.class, java.lang.String.class,
375                            com.liferay.portal.service.ServiceContext.class
376                    };
377            private static final Class<?>[] _updateRecordParameterTypes7 = new Class[] {
378                            long.class, boolean.class, int.class,
379                            com.liferay.portlet.dynamicdatamapping.storage.Fields.class,
380                            boolean.class, com.liferay.portal.service.ServiceContext.class
381                    };
382            private static final Class<?>[] _updateRecordParameterTypes8 = new Class[] {
383                            long.class, int.class, java.util.Map.class, boolean.class,
384                            com.liferay.portal.service.ServiceContext.class
385                    };
386    }