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.ExportImportConfigurationServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link ExportImportConfigurationServiceUtil} 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 ExportImportConfigurationServiceSoap
052     * @see HttpPrincipal
053     * @see ExportImportConfigurationServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class ExportImportConfigurationServiceHttp {
058            public static void deleteExportImportConfiguration(
059                    HttpPrincipal httpPrincipal, long exportImportConfigurationId)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(ExportImportConfigurationServiceUtil.class,
063                                            "deleteExportImportConfiguration",
064                                            _deleteExportImportConfigurationParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            exportImportConfigurationId);
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 com.liferay.portlet.exportimport.model.ExportImportConfiguration moveExportImportConfigurationToTrash(
088                    HttpPrincipal httpPrincipal, long exportImportConfigurationId)
089                    throws com.liferay.portal.kernel.exception.PortalException {
090                    try {
091                            MethodKey methodKey = new MethodKey(ExportImportConfigurationServiceUtil.class,
092                                            "moveExportImportConfigurationToTrash",
093                                            _moveExportImportConfigurationToTrashParameterTypes1);
094    
095                            MethodHandler methodHandler = new MethodHandler(methodKey,
096                                            exportImportConfigurationId);
097    
098                            Object returnObj = null;
099    
100                            try {
101                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
106                                    }
107    
108                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
109                            }
110    
111                            return (com.liferay.portlet.exportimport.model.ExportImportConfiguration)returnObj;
112                    }
113                    catch (com.liferay.portal.kernel.exception.SystemException se) {
114                            _log.error(se, se);
115    
116                            throw se;
117                    }
118            }
119    
120            public static com.liferay.portlet.exportimport.model.ExportImportConfiguration restoreExportImportConfigurationFromTrash(
121                    HttpPrincipal httpPrincipal, long exportImportConfigurationId)
122                    throws com.liferay.portal.kernel.exception.PortalException {
123                    try {
124                            MethodKey methodKey = new MethodKey(ExportImportConfigurationServiceUtil.class,
125                                            "restoreExportImportConfigurationFromTrash",
126                                            _restoreExportImportConfigurationFromTrashParameterTypes2);
127    
128                            MethodHandler methodHandler = new MethodHandler(methodKey,
129                                            exportImportConfigurationId);
130    
131                            Object returnObj = null;
132    
133                            try {
134                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
135                            }
136                            catch (Exception e) {
137                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
138                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
139                                    }
140    
141                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
142                            }
143    
144                            return (com.liferay.portlet.exportimport.model.ExportImportConfiguration)returnObj;
145                    }
146                    catch (com.liferay.portal.kernel.exception.SystemException se) {
147                            _log.error(se, se);
148    
149                            throw se;
150                    }
151            }
152    
153            private static Log _log = LogFactoryUtil.getLog(ExportImportConfigurationServiceHttp.class);
154            private static final Class<?>[] _deleteExportImportConfigurationParameterTypes0 =
155                    new Class[] { long.class };
156            private static final Class<?>[] _moveExportImportConfigurationToTrashParameterTypes1 =
157                    new Class[] { long.class };
158            private static final Class<?>[] _restoreExportImportConfigurationFromTrashParameterTypes2 =
159                    new Class[] { long.class };
160    }