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.util.MethodHandler;
023    import com.liferay.portal.kernel.util.MethodKey;
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                    com.liferay.portal.service.ServiceContext serviceContext)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
063                                            "addWebsite", _addWebsiteParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            className, classPK, url, typeId, primary, serviceContext);
067    
068                            Object returnObj = null;
069    
070                            try {
071                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072                            }
073                            catch (Exception e) {
074                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080    
081                            return (com.liferay.portal.model.Website)returnObj;
082                    }
083                    catch (com.liferay.portal.kernel.exception.SystemException se) {
084                            _log.error(se, se);
085    
086                            throw se;
087                    }
088            }
089    
090            public static void deleteWebsite(HttpPrincipal httpPrincipal, long websiteId)
091                    throws com.liferay.portal.kernel.exception.PortalException {
092                    try {
093                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
094                                            "deleteWebsite", _deleteWebsiteParameterTypes1);
095    
096                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
097    
098                            try {
099                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
100                            }
101                            catch (Exception e) {
102                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
103                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
104                                    }
105    
106                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
107                            }
108                    }
109                    catch (com.liferay.portal.kernel.exception.SystemException se) {
110                            _log.error(se, se);
111    
112                            throw se;
113                    }
114            }
115    
116            public static com.liferay.portal.model.Website getWebsite(
117                    HttpPrincipal httpPrincipal, long websiteId)
118                    throws com.liferay.portal.kernel.exception.PortalException {
119                    try {
120                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
121                                            "getWebsite", _getWebsiteParameterTypes2);
122    
123                            MethodHandler methodHandler = new MethodHandler(methodKey, websiteId);
124    
125                            Object returnObj = null;
126    
127                            try {
128                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
129                            }
130                            catch (Exception e) {
131                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
132                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
133                                    }
134    
135                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
136                            }
137    
138                            return (com.liferay.portal.model.Website)returnObj;
139                    }
140                    catch (com.liferay.portal.kernel.exception.SystemException se) {
141                            _log.error(se, se);
142    
143                            throw se;
144                    }
145            }
146    
147            public static java.util.List<com.liferay.portal.model.Website> getWebsites(
148                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
149                    throws com.liferay.portal.kernel.exception.PortalException {
150                    try {
151                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
152                                            "getWebsites", _getWebsitesParameterTypes3);
153    
154                            MethodHandler methodHandler = new MethodHandler(methodKey,
155                                            className, classPK);
156    
157                            Object returnObj = null;
158    
159                            try {
160                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
161                            }
162                            catch (Exception e) {
163                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
164                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
165                                    }
166    
167                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
168                            }
169    
170                            return (java.util.List<com.liferay.portal.model.Website>)returnObj;
171                    }
172                    catch (com.liferay.portal.kernel.exception.SystemException se) {
173                            _log.error(se, se);
174    
175                            throw se;
176                    }
177            }
178    
179            public static com.liferay.portal.model.Website updateWebsite(
180                    HttpPrincipal httpPrincipal, long websiteId, java.lang.String url,
181                    long typeId, boolean primary)
182                    throws com.liferay.portal.kernel.exception.PortalException {
183                    try {
184                            MethodKey methodKey = new MethodKey(WebsiteServiceUtil.class,
185                                            "updateWebsite", _updateWebsiteParameterTypes4);
186    
187                            MethodHandler methodHandler = new MethodHandler(methodKey,
188                                            websiteId, url, typeId, primary);
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 (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            private static Log _log = LogFactoryUtil.getLog(WebsiteServiceHttp.class);
213            private static final Class<?>[] _addWebsiteParameterTypes0 = new Class[] {
214                            java.lang.String.class, long.class, java.lang.String.class,
215                            long.class, boolean.class,
216                            com.liferay.portal.service.ServiceContext.class
217                    };
218            private static final Class<?>[] _deleteWebsiteParameterTypes1 = new Class[] {
219                            long.class
220                    };
221            private static final Class<?>[] _getWebsiteParameterTypes2 = new Class[] {
222                            long.class
223                    };
224            private static final Class<?>[] _getWebsitesParameterTypes3 = new Class[] {
225                            java.lang.String.class, long.class
226                    };
227            private static final Class<?>[] _updateWebsiteParameterTypes4 = new Class[] {
228                            long.class, java.lang.String.class, long.class, boolean.class
229                    };
230    }