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.exportimport.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.exportimport.service.StagingServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link StagingServiceUtil} 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 StagingServiceSoap
052     * @see HttpPrincipal
053     * @see StagingServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class StagingServiceHttp {
058            public static void cleanUpStagingRequest(HttpPrincipal httpPrincipal,
059                    long stagingRequestId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
063                                            "cleanUpStagingRequest",
064                                            _cleanUpStagingRequestParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            stagingRequestId);
068    
069                            try {
070                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
078                            }
079                    }
080                    catch (com.liferay.portal.kernel.exception.SystemException se) {
081                            _log.error(se, se);
082    
083                            throw se;
084                    }
085            }
086    
087            public static long createStagingRequest(HttpPrincipal httpPrincipal,
088                    long groupId, java.lang.String checksum)
089                    throws com.liferay.portal.kernel.exception.PortalException {
090                    try {
091                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
092                                            "createStagingRequest", _createStagingRequestParameterTypes1);
093    
094                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
095                                            checksum);
096    
097                            Object returnObj = null;
098    
099                            try {
100                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
101                            }
102                            catch (Exception e) {
103                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
104                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
105                                    }
106    
107                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
108                            }
109    
110                            return ((Long)returnObj).longValue();
111                    }
112                    catch (com.liferay.portal.kernel.exception.SystemException se) {
113                            _log.error(se, se);
114    
115                            throw se;
116                    }
117            }
118    
119            public static com.liferay.portlet.exportimport.lar.MissingReferences publishStagingRequest(
120                    HttpPrincipal httpPrincipal, long stagingRequestId,
121                    boolean privateLayout,
122                    java.util.Map<java.lang.String, java.lang.String[]> parameterMap)
123                    throws com.liferay.portal.kernel.exception.PortalException {
124                    try {
125                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
126                                            "publishStagingRequest",
127                                            _publishStagingRequestParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey,
130                                            stagingRequestId, privateLayout, parameterMap);
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 (com.liferay.portlet.exportimport.lar.MissingReferences)returnObj;
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.exportimport.lar.MissingReferences publishStagingRequest(
155                    HttpPrincipal httpPrincipal, long stagingRequestId,
156                    com.liferay.portlet.exportimport.model.ExportImportConfiguration exportImportConfiguration)
157                    throws com.liferay.portal.kernel.exception.PortalException {
158                    try {
159                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
160                                            "publishStagingRequest",
161                                            _publishStagingRequestParameterTypes3);
162    
163                            MethodHandler methodHandler = new MethodHandler(methodKey,
164                                            stagingRequestId, exportImportConfiguration);
165    
166                            Object returnObj = null;
167    
168                            try {
169                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
170                            }
171                            catch (Exception e) {
172                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
173                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
174                                    }
175    
176                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
177                            }
178    
179                            return (com.liferay.portlet.exportimport.lar.MissingReferences)returnObj;
180                    }
181                    catch (com.liferay.portal.kernel.exception.SystemException se) {
182                            _log.error(se, se);
183    
184                            throw se;
185                    }
186            }
187    
188            public static void updateStagingRequest(HttpPrincipal httpPrincipal,
189                    long stagingRequestId, java.lang.String fileName, byte[] bytes)
190                    throws com.liferay.portal.kernel.exception.PortalException {
191                    try {
192                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
193                                            "updateStagingRequest", _updateStagingRequestParameterTypes4);
194    
195                            MethodHandler methodHandler = new MethodHandler(methodKey,
196                                            stagingRequestId, fileName, bytes);
197    
198                            try {
199                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
210                            _log.error(se, se);
211    
212                            throw se;
213                    }
214            }
215    
216            public static com.liferay.portlet.exportimport.lar.MissingReferences validateStagingRequest(
217                    HttpPrincipal httpPrincipal, long stagingRequestId,
218                    boolean privateLayout,
219                    java.util.Map<java.lang.String, java.lang.String[]> parameterMap)
220                    throws com.liferay.portal.kernel.exception.PortalException {
221                    try {
222                            MethodKey methodKey = new MethodKey(StagingServiceUtil.class,
223                                            "validateStagingRequest",
224                                            _validateStagingRequestParameterTypes5);
225    
226                            MethodHandler methodHandler = new MethodHandler(methodKey,
227                                            stagingRequestId, privateLayout, parameterMap);
228    
229                            Object returnObj = null;
230    
231                            try {
232                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
233                            }
234                            catch (Exception e) {
235                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
236                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
237                                    }
238    
239                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
240                            }
241    
242                            return (com.liferay.portlet.exportimport.lar.MissingReferences)returnObj;
243                    }
244                    catch (com.liferay.portal.kernel.exception.SystemException se) {
245                            _log.error(se, se);
246    
247                            throw se;
248                    }
249            }
250    
251            private static Log _log = LogFactoryUtil.getLog(StagingServiceHttp.class);
252            private static final Class<?>[] _cleanUpStagingRequestParameterTypes0 = new Class[] {
253                            long.class
254                    };
255            private static final Class<?>[] _createStagingRequestParameterTypes1 = new Class[] {
256                            long.class, java.lang.String.class
257                    };
258            private static final Class<?>[] _publishStagingRequestParameterTypes2 = new Class[] {
259                            long.class, boolean.class, java.util.Map.class
260                    };
261            private static final Class<?>[] _publishStagingRequestParameterTypes3 = new Class[] {
262                            long.class,
263                            com.liferay.portlet.exportimport.model.ExportImportConfiguration.class
264                    };
265            private static final Class<?>[] _updateStagingRequestParameterTypes4 = new Class[] {
266                            long.class, java.lang.String.class, byte[].class
267                    };
268            private static final Class<?>[] _validateStagingRequestParameterTypes5 = new Class[] {
269                            long.class, boolean.class, java.util.Map.class
270                    };
271    }