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.portal.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.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.WebsiteServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link WebsiteServiceUtil} 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 HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see WebsiteServiceSoap
051     * @see HttpPrincipal
052     * @see WebsiteServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class WebsiteServiceHttp {
057            public static com.liferay.portal.kernel.model.Website addWebsite(
058                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
059                    java.lang.String url, long typeId, boolean primary,
060                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException {
062                    try {
063                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
064                                            "addWebsite", _addWebsiteParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            className, classPK, url, typeId, primary, serviceContext);
068    
069                            Object returnObj = null;
070    
071                            try {
072                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
073                            }
074                            catch (Exception e) {
075                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
076                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
077                                    }
078    
079                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
080                            }
081    
082                            return (com.liferay.portal.kernel.model.Website)returnObj;
083                    }
084                    catch (com.liferay.portal.kernel.exception.SystemException se) {
085                            _log.error(se, se);
086    
087                            throw se;
088                    }
089            }
090    
091            public static void deleteWebsite(HttpPrincipal httpPrincipal, long websiteId)
092                    throws com.liferay.portal.kernel.exception.PortalException {
093                    try {
094                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
095                                            "deleteWebsite", _deleteWebsiteParameterTypes1);
096    
097                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
098    
099                            try {
100                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
111                            _log.error(se, se);
112    
113                            throw se;
114                    }
115            }
116    
117            public static com.liferay.portal.kernel.model.Website getWebsite(
118                    HttpPrincipal httpPrincipal, long websiteId)
119                    throws com.liferay.portal.kernel.exception.PortalException {
120                    try {
121                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
122                                            "getWebsite", _getWebsiteParameterTypes2);
123    
124                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
125    
126                            Object returnObj = null;
127    
128                            try {
129                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
130                            }
131                            catch (Exception e) {
132                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
133                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
134                                    }
135    
136                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
137                            }
138    
139                            return (com.liferay.portal.kernel.model.Website)returnObj;
140                    }
141                    catch (com.liferay.portal.kernel.exception.SystemException se) {
142                            _log.error(se, se);
143    
144                            throw se;
145                    }
146            }
147    
148            public static java.util.List<com.liferay.portal.kernel.model.Website> getWebsites(
149                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
150                    throws com.liferay.portal.kernel.exception.PortalException {
151                    try {
152                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
153                                            "getWebsites", _getWebsitesParameterTypes3);
154    
155                            MethodHandler methodHandler = new MethodHandler(methodKey,
156                                            className, classPK);
157    
158                            Object returnObj = null;
159    
160                            try {
161                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
162                            }
163                            catch (Exception e) {
164                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
165                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
166                                    }
167    
168                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
169                            }
170    
171                            return (java.util.List<com.liferay.portal.kernel.model.Website>)returnObj;
172                    }
173                    catch (com.liferay.portal.kernel.exception.SystemException se) {
174                            _log.error(se, se);
175    
176                            throw se;
177                    }
178            }
179    
180            public static com.liferay.portal.kernel.model.Website updateWebsite(
181                    HttpPrincipal httpPrincipal, long websiteId, java.lang.String url,
182                    long typeId, boolean primary)
183                    throws com.liferay.portal.kernel.exception.PortalException {
184                    try {
185                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
186                                            "updateWebsite", _updateWebsiteParameterTypes4);
187    
188                            MethodHandler methodHandler = new MethodHandler(methodKey,
189                                            websiteId, url, typeId, primary);
190    
191                            Object returnObj = null;
192    
193                            try {
194                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
195                            }
196                            catch (Exception e) {
197                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
198                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
199                                    }
200    
201                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
202                            }
203    
204                            return (com.liferay.portal.kernel.model.Website)returnObj;
205                    }
206                    catch (com.liferay.portal.kernel.exception.SystemException se) {
207                            _log.error(se, se);
208    
209                            throw se;
210                    }
211            }
212    
213            private static Log _log = LogFactoryUtil.getLog(WebsiteServiceHttp.class);
214            private static final Class<?>[] _addWebsiteParameterTypes0 = new Class[] {
215                            java.lang.String.class, long.class, java.lang.String.class,
216                            long.class, boolean.class,
217                            com.liferay.portal.kernel.service.ServiceContext.class
218                    };
219            private static final Class<?>[] _deleteWebsiteParameterTypes1 = new Class[] {
220                            long.class
221                    };
222            private static final Class<?>[] _getWebsiteParameterTypes2 = new Class[] {
223                            long.class
224                    };
225            private static final Class<?>[] _getWebsitesParameterTypes3 = new Class[] {
226                            java.lang.String.class, long.class
227                    };
228            private static final Class<?>[] _updateWebsiteParameterTypes4 = new Class[] {
229                            long.class, java.lang.String.class, long.class, boolean.class
230                    };
231    }