001    /**
002     * Copyright (c) 2000-2012 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 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.documentlibrary.service.DLSyncServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.documentlibrary.service.DLSyncServiceUtil} 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       DLSyncServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.documentlibrary.service.DLSyncServiceUtil
054     * @generated
055     */
056    public class DLSyncServiceHttp {
057            public static com.liferay.portlet.documentlibrary.model.DLSyncUpdate getDLSyncUpdate(
058                    HttpPrincipal httpPrincipal, long companyId, long repositoryId,
059                    java.util.Date lastAccessDate)
060                    throws com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            MethodKey methodKey = new MethodKey(DLSyncServiceUtil.class.getName(),
063                                            "getDLSyncUpdate", _getDLSyncUpdateParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            companyId, repositoryId, lastAccessDate);
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.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080    
081                            return (com.liferay.portlet.documentlibrary.model.DLSyncUpdate)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.io.InputStream getFileDeltaAsStream(
091                    HttpPrincipal httpPrincipal, long fileEntryId,
092                    java.lang.String sourceVersion, java.lang.String destinationVersion)
093                    throws com.liferay.portal.kernel.exception.PortalException,
094                            com.liferay.portal.kernel.exception.SystemException {
095                    try {
096                            MethodKey methodKey = new MethodKey(DLSyncServiceUtil.class.getName(),
097                                            "getFileDeltaAsStream", _getFileDeltaAsStreamParameterTypes1);
098    
099                            MethodHandler methodHandler = new MethodHandler(methodKey,
100                                            fileEntryId, sourceVersion, destinationVersion);
101    
102                            Object returnObj = null;
103    
104                            try {
105                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
109                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
110                                    }
111    
112                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
113                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118    
119                            return (java.io.InputStream)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 com.liferay.portal.kernel.repository.model.FileEntry updateFileEntry(
129                    HttpPrincipal httpPrincipal, long fileEntryId,
130                    java.lang.String sourceFileName, java.lang.String mimeType,
131                    java.lang.String title, java.lang.String description,
132                    java.lang.String changeLog, boolean majorVersion,
133                    java.io.InputStream deltaInputStream, long size,
134                    com.liferay.portal.service.ServiceContext serviceContext)
135                    throws com.liferay.portal.kernel.exception.PortalException,
136                            com.liferay.portal.kernel.exception.SystemException {
137                    try {
138                            MethodKey methodKey = new MethodKey(DLSyncServiceUtil.class.getName(),
139                                            "updateFileEntry", _updateFileEntryParameterTypes2);
140    
141                            MethodHandler methodHandler = new MethodHandler(methodKey,
142                                            fileEntryId, sourceFileName, mimeType, title, description,
143                                            changeLog, majorVersion, deltaInputStream, size,
144                                            serviceContext);
145    
146                            Object returnObj = null;
147    
148                            try {
149                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
150                            }
151                            catch (Exception e) {
152                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
153                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
154                                    }
155    
156                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
157                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
158                                    }
159    
160                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
161                            }
162    
163                            return (com.liferay.portal.kernel.repository.model.FileEntry)returnObj;
164                    }
165                    catch (com.liferay.portal.kernel.exception.SystemException se) {
166                            _log.error(se, se);
167    
168                            throw se;
169                    }
170            }
171    
172            private static Log _log = LogFactoryUtil.getLog(DLSyncServiceHttp.class);
173            private static final Class<?>[] _getDLSyncUpdateParameterTypes0 = new Class[] {
174                            long.class, long.class, java.util.Date.class
175                    };
176            private static final Class<?>[] _getFileDeltaAsStreamParameterTypes1 = new Class[] {
177                            long.class, java.lang.String.class, java.lang.String.class
178                    };
179            private static final Class<?>[] _updateFileEntryParameterTypes2 = new Class[] {
180                            long.class, java.lang.String.class, java.lang.String.class,
181                            java.lang.String.class, java.lang.String.class,
182                            java.lang.String.class, boolean.class, java.io.InputStream.class,
183                            long.class, com.liferay.portal.service.ServiceContext.class
184                    };
185    }