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.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.WebsiteServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link WebsiteServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see WebsiteServiceSoap
050     * @see HttpPrincipal
051     * @see WebsiteServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class WebsiteServiceHttp {
056            public static com.liferay.portal.model.Website addWebsite(
057                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
058                    java.lang.String url, long typeId, boolean primary)
059                    throws com.liferay.portal.kernel.exception.PortalException {
060                    try {
061                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
062                                            "addWebsite", _addWebsiteParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey,
065                                            className, classPK, url, typeId, primary);
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = 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                            return (com.liferay.portal.model.Website)returnObj;
081                    }
082                    catch (com.liferay.portal.kernel.exception.SystemException se) {
083                            _log.error(se, se);
084    
085                            throw se;
086                    }
087            }
088    
089            public static com.liferay.portal.model.Website addWebsite(
090                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
091                    java.lang.String url, long typeId, boolean primary,
092                    com.liferay.portal.service.ServiceContext serviceContext)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
096                                            "addWebsite", _addWebsiteParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey,
099                                            className, classPK, url, typeId, primary, serviceContext);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
112                            }
113    
114                            return (com.liferay.portal.model.Website)returnObj;
115                    }
116                    catch (com.liferay.portal.kernel.exception.SystemException se) {
117                            _log.error(se, se);
118    
119                            throw se;
120                    }
121            }
122    
123            public static void deleteWebsite(HttpPrincipal httpPrincipal, long websiteId)
124                    throws com.liferay.portal.kernel.exception.PortalException {
125                    try {
126                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
127                                            "deleteWebsite", _deleteWebsiteParameterTypes2);
128    
129                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
130    
131                            try {
132                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
133                            }
134                            catch (Exception e) {
135                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
136                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
137                                    }
138    
139                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
140                            }
141                    }
142                    catch (com.liferay.portal.kernel.exception.SystemException se) {
143                            _log.error(se, se);
144    
145                            throw se;
146                    }
147            }
148    
149            public static com.liferay.portal.model.Website getWebsite(
150                    HttpPrincipal httpPrincipal, long websiteId)
151                    throws com.liferay.portal.kernel.exception.PortalException {
152                    try {
153                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
154                                            "getWebsite", _getWebsiteParameterTypes3);
155    
156                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
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 (com.liferay.portal.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 java.util.List<com.liferay.portal.model.Website> getWebsites(
181                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
182                    throws com.liferay.portal.kernel.exception.PortalException {
183                    try {
184                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
185                                            "getWebsites", _getWebsitesParameterTypes4);
186    
187                            MethodHandler methodHandler = new MethodHandler(methodKey,
188                                            className, classPK);
189    
190                            Object returnObj = null;
191    
192                            try {
193                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
194                            }
195                            catch (Exception e) {
196                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
197                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
198                                    }
199    
200                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
201                            }
202    
203                            return (java.util.List<com.liferay.portal.model.Website>)returnObj;
204                    }
205                    catch (com.liferay.portal.kernel.exception.SystemException se) {
206                            _log.error(se, se);
207    
208                            throw se;
209                    }
210            }
211    
212            public static com.liferay.portal.model.Website updateWebsite(
213                    HttpPrincipal httpPrincipal, long websiteId, java.lang.String url,
214                    long typeId, boolean primary)
215                    throws com.liferay.portal.kernel.exception.PortalException {
216                    try {
217                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
218                                            "updateWebsite", _updateWebsiteParameterTypes5);
219    
220                            MethodHandler methodHandler = new MethodHandler(methodKey,
221                                            websiteId, url, typeId, primary);
222    
223                            Object returnObj = null;
224    
225                            try {
226                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
227                            }
228                            catch (Exception e) {
229                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
230                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
231                                    }
232    
233                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
234                            }
235    
236                            return (com.liferay.portal.model.Website)returnObj;
237                    }
238                    catch (com.liferay.portal.kernel.exception.SystemException se) {
239                            _log.error(se, se);
240    
241                            throw se;
242                    }
243            }
244    
245            private static Log _log = LogFactoryUtil.getLog(WebsiteServiceHttp.class);
246            private static final Class<?>[] _addWebsiteParameterTypes0 = new Class[] {
247                            java.lang.String.class, long.class, java.lang.String.class,
248                            long.class, boolean.class
249                    };
250            private static final Class<?>[] _addWebsiteParameterTypes1 = new Class[] {
251                            java.lang.String.class, long.class, java.lang.String.class,
252                            long.class, boolean.class,
253                            com.liferay.portal.service.ServiceContext.class
254                    };
255            private static final Class<?>[] _deleteWebsiteParameterTypes2 = new Class[] {
256                            long.class
257                    };
258            private static final Class<?>[] _getWebsiteParameterTypes3 = new Class[] {
259                            long.class
260                    };
261            private static final Class<?>[] _getWebsitesParameterTypes4 = new Class[] {
262                            java.lang.String.class, long.class
263                    };
264            private static final Class<?>[] _updateWebsiteParameterTypes5 = new Class[] {
265                            long.class, java.lang.String.class, long.class, boolean.class
266                    };
267    }