001    /**
002     * Copyright (c) 2000-2010 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.portlet.wiki.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.http.TunnelUtil;
023    
024    import com.liferay.portlet.wiki.service.WikiNodeServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.wiki.service.WikiNodeServiceUtil} 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 com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       WikiNodeServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.wiki.service.WikiNodeServiceUtil
054     * @generated
055     */
056    public class WikiNodeServiceHttp {
057            public static com.liferay.portlet.wiki.model.WikiNode addNode(
058                    HttpPrincipal httpPrincipal, java.lang.String name,
059                    java.lang.String description,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
065                                            "addNode", java.lang.String.class, java.lang.String.class,
066                                            com.liferay.portal.service.ServiceContext.class);
067    
068                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
069                                            description, serviceContext);
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
082                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
083                                    }
084    
085                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
086                            }
087    
088                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static void deleteNode(HttpPrincipal httpPrincipal, long nodeId)
098                    throws com.liferay.portal.kernel.exception.PortalException,
099                            com.liferay.portal.kernel.exception.SystemException {
100                    try {
101                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
102                                            "deleteNode", long.class);
103    
104                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
105    
106                            try {
107                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
122                            _log.error(se, se);
123    
124                            throw se;
125                    }
126            }
127    
128            public static com.liferay.portlet.wiki.model.WikiNode getNode(
129                    HttpPrincipal httpPrincipal, long nodeId)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
134                                            "getNode", long.class);
135    
136                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
137    
138                            Object returnObj = null;
139    
140                            try {
141                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
142                            }
143                            catch (Exception e) {
144                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
145                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
146                                    }
147    
148                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
149                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
150                                    }
151    
152                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
153                            }
154    
155                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
156                    }
157                    catch (com.liferay.portal.kernel.exception.SystemException se) {
158                            _log.error(se, se);
159    
160                            throw se;
161                    }
162            }
163    
164            public static com.liferay.portlet.wiki.model.WikiNode getNode(
165                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
166                    throws com.liferay.portal.kernel.exception.PortalException,
167                            com.liferay.portal.kernel.exception.SystemException {
168                    try {
169                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
170                                            "getNode", long.class, java.lang.String.class);
171    
172                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
173                                            name);
174    
175                            Object returnObj = null;
176    
177                            try {
178                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
179                            }
180                            catch (Exception e) {
181                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
183                                    }
184    
185                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
187                                    }
188    
189                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
190                            }
191    
192                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
193                    }
194                    catch (com.liferay.portal.kernel.exception.SystemException se) {
195                            _log.error(se, se);
196    
197                            throw se;
198                    }
199            }
200    
201            public static void importPages(HttpPrincipal httpPrincipal, long nodeId,
202                    java.lang.String importer, java.io.File[] files,
203                    java.util.Map<java.lang.String, java.lang.String[]> options)
204                    throws com.liferay.portal.kernel.exception.PortalException,
205                            com.liferay.portal.kernel.exception.SystemException {
206                    try {
207                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
208                                            "importPages", long.class, java.lang.String.class,
209                                            java.io.File[].class, java.util.Map.class);
210    
211                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
212                                            importer, files, options);
213    
214                            try {
215                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
216                            }
217                            catch (Exception e) {
218                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
219                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
220                                    }
221    
222                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
223                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
224                                    }
225    
226                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
227                            }
228                    }
229                    catch (com.liferay.portal.kernel.exception.SystemException se) {
230                            _log.error(se, se);
231    
232                            throw se;
233                    }
234            }
235    
236            public static void subscribeNode(HttpPrincipal httpPrincipal, long nodeId)
237                    throws com.liferay.portal.kernel.exception.PortalException,
238                            com.liferay.portal.kernel.exception.SystemException {
239                    try {
240                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
241                                            "subscribeNode", long.class);
242    
243                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
244    
245                            try {
246                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
247                            }
248                            catch (Exception e) {
249                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
250                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
251                                    }
252    
253                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
254                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
255                                    }
256    
257                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
258                            }
259                    }
260                    catch (com.liferay.portal.kernel.exception.SystemException se) {
261                            _log.error(se, se);
262    
263                            throw se;
264                    }
265            }
266    
267            public static void unsubscribeNode(HttpPrincipal httpPrincipal, long nodeId)
268                    throws com.liferay.portal.kernel.exception.PortalException,
269                            com.liferay.portal.kernel.exception.SystemException {
270                    try {
271                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
272                                            "unsubscribeNode", long.class);
273    
274                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
275    
276                            try {
277                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
278                            }
279                            catch (Exception e) {
280                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
281                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
282                                    }
283    
284                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
285                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
286                                    }
287    
288                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
289                            }
290                    }
291                    catch (com.liferay.portal.kernel.exception.SystemException se) {
292                            _log.error(se, se);
293    
294                            throw se;
295                    }
296            }
297    
298            public static com.liferay.portlet.wiki.model.WikiNode updateNode(
299                    HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
300                    java.lang.String description,
301                    com.liferay.portal.service.ServiceContext serviceContext)
302                    throws com.liferay.portal.kernel.exception.PortalException,
303                            com.liferay.portal.kernel.exception.SystemException {
304                    try {
305                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
306                                            "updateNode", long.class, java.lang.String.class,
307                                            java.lang.String.class,
308                                            com.liferay.portal.service.ServiceContext.class);
309    
310                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
311                                            name, description, serviceContext);
312    
313                            Object returnObj = null;
314    
315                            try {
316                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
317                            }
318                            catch (Exception e) {
319                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
320                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
321                                    }
322    
323                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
324                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
325                                    }
326    
327                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
328                            }
329    
330                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
331                    }
332                    catch (com.liferay.portal.kernel.exception.SystemException se) {
333                            _log.error(se, se);
334    
335                            throw se;
336                    }
337            }
338    
339            private static Log _log = LogFactoryUtil.getLog(WikiNodeServiceHttp.class);
340    }