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     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.WebsiteServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
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       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.WebsiteServiceUtil
052     * @generated
053     */
054    public class WebsiteServiceHttp {
055            public static com.liferay.portal.model.Website addWebsite(
056                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
057                    java.lang.String url, int typeId, boolean primary)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portal.model.Website)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static void deleteWebsite(HttpPrincipal httpPrincipal, long websiteId)
094                    throws com.liferay.portal.kernel.exception.PortalException,
095                            com.liferay.portal.kernel.exception.SystemException {
096                    try {
097                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
098                                            "deleteWebsite", _deleteWebsiteParameterTypes1);
099    
100                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
101    
102                            try {
103                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
104                            }
105                            catch (Exception e) {
106                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
107                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
108                                    }
109    
110                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
111                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
112                                    }
113    
114                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
115                            }
116                    }
117                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static com.liferay.portal.model.Website getWebsite(
125                    HttpPrincipal httpPrincipal, long websiteId)
126                    throws com.liferay.portal.kernel.exception.PortalException,
127                            com.liferay.portal.kernel.exception.SystemException {
128                    try {
129                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
130                                            "getWebsite", _getWebsiteParameterTypes2);
131    
132                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
133    
134                            Object returnObj = null;
135    
136                            try {
137                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
145                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
146                                    }
147    
148                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
149                            }
150    
151                            return (com.liferay.portal.model.Website)returnObj;
152                    }
153                    catch (com.liferay.portal.kernel.exception.SystemException se) {
154                            _log.error(se, se);
155    
156                            throw se;
157                    }
158            }
159    
160            public static java.util.List<com.liferay.portal.model.Website> getWebsites(
161                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
166                                            "getWebsites", _getWebsitesParameterTypes3);
167    
168                            MethodHandler methodHandler = new MethodHandler(methodKey,
169                                            className, classPK);
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 (java.util.List<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 com.liferay.portal.model.Website updateWebsite(
198                    HttpPrincipal httpPrincipal, long websiteId, java.lang.String url,
199                    int typeId, boolean primary)
200                    throws com.liferay.portal.kernel.exception.PortalException,
201                            com.liferay.portal.kernel.exception.SystemException {
202                    try {
203                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class.getName(),
204                                            "updateWebsite", _updateWebsiteParameterTypes4);
205    
206                            MethodHandler methodHandler = new MethodHandler(methodKey,
207                                            websiteId, url, typeId, primary);
208    
209                            Object returnObj = null;
210    
211                            try {
212                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
213                            }
214                            catch (Exception e) {
215                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
216                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
217                                    }
218    
219                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
220                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
221                                    }
222    
223                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
224                            }
225    
226                            return (com.liferay.portal.model.Website)returnObj;
227                    }
228                    catch (com.liferay.portal.kernel.exception.SystemException se) {
229                            _log.error(se, se);
230    
231                            throw se;
232                    }
233            }
234    
235            private static Log _log = LogFactoryUtil.getLog(WebsiteServiceHttp.class);
236            private static final Class<?>[] _addWebsiteParameterTypes0 = new Class[] {
237                            java.lang.String.class, long.class, java.lang.String.class,
238                            int.class, boolean.class
239                    };
240            private static final Class<?>[] _deleteWebsiteParameterTypes1 = new Class[] {
241                            long.class
242                    };
243            private static final Class<?>[] _getWebsiteParameterTypes2 = new Class[] {
244                            long.class
245                    };
246            private static final Class<?>[] _getWebsitesParameterTypes3 = new Class[] {
247                            java.lang.String.class, long.class
248                    };
249            private static final Class<?>[] _updateWebsiteParameterTypes4 = new Class[] {
250                            long.class, java.lang.String.class, int.class, boolean.class
251                    };
252    }