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.DDLRecordVersionServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link com.liferay.portlet.dynamicdatalists.service.DDLRecordVersionServiceUtil} 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 DDLRecordVersionServiceSoap
052     * @see com.liferay.portal.security.auth.HttpPrincipal
053     * @see com.liferay.portlet.dynamicdatalists.service.DDLRecordVersionServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class DDLRecordVersionServiceHttp {
058            public static com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion getRecordVersion(
059                    HttpPrincipal httpPrincipal, long recordVersionId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(DDLRecordVersionServiceUtil.class,
063                                            "getRecordVersion", _getRecordVersionParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            recordVersionId);
067    
068                            Object returnObj = null;
069    
070                            try {
071                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072                            }
073                            catch (Exception e) {
074                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080    
081                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion)returnObj;
082                    }
083                    catch (com.liferay.portal.kernel.exception.SystemException se) {
084                            _log.error(se, se);
085    
086                            throw se;
087                    }
088            }
089    
090            public static com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion getRecordVersion(
091                    HttpPrincipal httpPrincipal, long recordId, java.lang.String version)
092                    throws com.liferay.portal.kernel.exception.PortalException {
093                    try {
094                            MethodKey methodKey = new MethodKey(DDLRecordVersionServiceUtil.class,
095                                            "getRecordVersion", _getRecordVersionParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey,
098                                            recordId, version);
099    
100                            Object returnObj = null;
101    
102                            try {
103                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
111                            }
112    
113                            return (com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion)returnObj;
114                    }
115                    catch (com.liferay.portal.kernel.exception.SystemException se) {
116                            _log.error(se, se);
117    
118                            throw se;
119                    }
120            }
121    
122            public static java.util.List<com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion> getRecordVersions(
123                    HttpPrincipal httpPrincipal, long recordId, int start, int end,
124                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion> orderByComparator)
125                    throws com.liferay.portal.kernel.exception.PortalException {
126                    try {
127                            MethodKey methodKey = new MethodKey(DDLRecordVersionServiceUtil.class,
128                                            "getRecordVersions", _getRecordVersionsParameterTypes2);
129    
130                            MethodHandler methodHandler = new MethodHandler(methodKey,
131                                            recordId, start, end, orderByComparator);
132    
133                            Object returnObj = null;
134    
135                            try {
136                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
137                            }
138                            catch (Exception e) {
139                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
140                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
141                                    }
142    
143                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
144                            }
145    
146                            return (java.util.List<com.liferay.portlet.dynamicdatalists.model.DDLRecordVersion>)returnObj;
147                    }
148                    catch (com.liferay.portal.kernel.exception.SystemException se) {
149                            _log.error(se, se);
150    
151                            throw se;
152                    }
153            }
154    
155            public static int getRecordVersionsCount(HttpPrincipal httpPrincipal,
156                    long recordId)
157                    throws com.liferay.portal.kernel.exception.PortalException {
158                    try {
159                            MethodKey methodKey = new MethodKey(DDLRecordVersionServiceUtil.class,
160                                            "getRecordVersionsCount",
161                                            _getRecordVersionsCountParameterTypes3);
162    
163                            MethodHandler methodHandler = new MethodHandler(methodKey, recordId);
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 ((Integer)returnObj).intValue();
179                    }
180                    catch (com.liferay.portal.kernel.exception.SystemException se) {
181                            _log.error(se, se);
182    
183                            throw se;
184                    }
185            }
186    
187            private static Log _log = LogFactoryUtil.getLog(DDLRecordVersionServiceHttp.class);
188            private static final Class<?>[] _getRecordVersionParameterTypes0 = new Class[] {
189                            long.class
190                    };
191            private static final Class<?>[] _getRecordVersionParameterTypes1 = new Class[] {
192                            long.class, java.lang.String.class
193                    };
194            private static final Class<?>[] _getRecordVersionsParameterTypes2 = new Class[] {
195                            long.class, int.class, int.class,
196                            com.liferay.portal.kernel.util.OrderByComparator.class
197                    };
198            private static final Class<?>[] _getRecordVersionsCountParameterTypes3 = new Class[] {
199                            long.class
200                    };
201    }