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.documentlibrary.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.documentlibrary.service.DLFileVersionServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link DLFileVersionServiceUtil} 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 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 DLFileVersionServiceSoap
052     * @see HttpPrincipal
053     * @see DLFileVersionServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class DLFileVersionServiceHttp {
058            public static com.liferay.portlet.documentlibrary.model.DLFileVersion getFileVersion(
059                    HttpPrincipal httpPrincipal, long fileVersionId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(DLFileVersionServiceUtil.class,
063                                            "getFileVersion", _getFileVersionParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            fileVersionId);
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.documentlibrary.model.DLFileVersion)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 java.util.List<com.liferay.portlet.documentlibrary.model.DLFileVersion> getFileVersions(
091                    HttpPrincipal httpPrincipal, long fileEntryId, int status)
092                    throws com.liferay.portal.kernel.exception.PortalException {
093                    try {
094                            MethodKey methodKey = new MethodKey(DLFileVersionServiceUtil.class,
095                                            "getFileVersions", _getFileVersionsParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey,
098                                            fileEntryId, status);
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 (java.util.List<com.liferay.portlet.documentlibrary.model.DLFileVersion>)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 int getFileVersionsCount(HttpPrincipal httpPrincipal,
123                    long fileEntryId, int status)
124                    throws com.liferay.portal.kernel.exception.PortalException {
125                    try {
126                            MethodKey methodKey = new MethodKey(DLFileVersionServiceUtil.class,
127                                            "getFileVersionsCount", _getFileVersionsCountParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey,
130                                            fileEntryId, status);
131    
132                            Object returnObj = null;
133    
134                            try {
135                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
136                            }
137                            catch (Exception e) {
138                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
139                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
140                                    }
141    
142                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
143                            }
144    
145                            return ((Integer)returnObj).intValue();
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.documentlibrary.model.DLFileVersion getLatestFileVersion(
155                    HttpPrincipal httpPrincipal, long fileEntryId)
156                    throws com.liferay.portal.kernel.exception.PortalException {
157                    try {
158                            MethodKey methodKey = new MethodKey(DLFileVersionServiceUtil.class,
159                                            "getLatestFileVersion", _getLatestFileVersionParameterTypes3);
160    
161                            MethodHandler methodHandler = new MethodHandler(methodKey,
162                                            fileEntryId);
163    
164                            Object returnObj = null;
165    
166                            try {
167                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
168                            }
169                            catch (Exception e) {
170                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
172                                    }
173    
174                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
175                            }
176    
177                            return (com.liferay.portlet.documentlibrary.model.DLFileVersion)returnObj;
178                    }
179                    catch (com.liferay.portal.kernel.exception.SystemException se) {
180                            _log.error(se, se);
181    
182                            throw se;
183                    }
184            }
185    
186            public static com.liferay.portlet.documentlibrary.model.DLFileVersion getLatestFileVersion(
187                    HttpPrincipal httpPrincipal, long fileEntryId,
188                    boolean excludeWorkingCopy)
189                    throws com.liferay.portal.kernel.exception.PortalException {
190                    try {
191                            MethodKey methodKey = new MethodKey(DLFileVersionServiceUtil.class,
192                                            "getLatestFileVersion", _getLatestFileVersionParameterTypes4);
193    
194                            MethodHandler methodHandler = new MethodHandler(methodKey,
195                                            fileEntryId, excludeWorkingCopy);
196    
197                            Object returnObj = null;
198    
199                            try {
200                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
201                            }
202                            catch (Exception e) {
203                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
204                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
205                                    }
206    
207                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
208                            }
209    
210                            return (com.liferay.portlet.documentlibrary.model.DLFileVersion)returnObj;
211                    }
212                    catch (com.liferay.portal.kernel.exception.SystemException se) {
213                            _log.error(se, se);
214    
215                            throw se;
216                    }
217            }
218    
219            private static Log _log = LogFactoryUtil.getLog(DLFileVersionServiceHttp.class);
220            private static final Class<?>[] _getFileVersionParameterTypes0 = new Class[] {
221                            long.class
222                    };
223            private static final Class<?>[] _getFileVersionsParameterTypes1 = new Class[] {
224                            long.class, int.class
225                    };
226            private static final Class<?>[] _getFileVersionsCountParameterTypes2 = new Class[] {
227                            long.class, int.class
228                    };
229            private static final Class<?>[] _getLatestFileVersionParameterTypes3 = new Class[] {
230                            long.class
231                    };
232            private static final Class<?>[] _getLatestFileVersionParameterTypes4 = new Class[] {
233                            long.class, boolean.class
234                    };
235    }