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