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.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     * Provides the HTTP utility for the
028     * {@link com.liferay.portlet.wiki.service.WikiNodeServiceUtil} 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 com.liferay.portal.security.auth.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 WikiNodeServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portlet.wiki.service.WikiNodeServiceUtil
052     * @generated
053     */
054    public class WikiNodeServiceHttp {
055            public static com.liferay.portlet.wiki.model.WikiNode addNode(
056                    HttpPrincipal httpPrincipal, java.lang.String name,
057                    java.lang.String description,
058                    com.liferay.portal.service.ServiceContext serviceContext)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
063                                            "addNode", _addNodeParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
066                                            description, 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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
079                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
080                                    }
081    
082                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
083                            }
084    
085                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
086                    }
087                    catch (com.liferay.portal.kernel.exception.SystemException se) {
088                            _log.error(se, se);
089    
090                            throw se;
091                    }
092            }
093    
094            public static void deleteNode(HttpPrincipal httpPrincipal, long nodeId)
095                    throws com.liferay.portal.kernel.exception.PortalException,
096                            com.liferay.portal.kernel.exception.SystemException {
097                    try {
098                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
099                                            "deleteNode", _deleteNodeParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
102    
103                            try {
104                                    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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
112                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
113                                    }
114    
115                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
116                            }
117                    }
118                    catch (com.liferay.portal.kernel.exception.SystemException se) {
119                            _log.error(se, se);
120    
121                            throw se;
122                    }
123            }
124    
125            public static com.liferay.portlet.wiki.model.WikiNode getNode(
126                    HttpPrincipal httpPrincipal, long nodeId)
127                    throws com.liferay.portal.kernel.exception.PortalException,
128                            com.liferay.portal.kernel.exception.SystemException {
129                    try {
130                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
131                                            "getNode", _getNodeParameterTypes2);
132    
133                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
134    
135                            Object returnObj = null;
136    
137                            try {
138                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
139                            }
140                            catch (Exception e) {
141                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
143                                    }
144    
145                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
146                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
147                                    }
148    
149                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
150                            }
151    
152                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
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.portlet.wiki.model.WikiNode getNode(
162                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
163                    throws com.liferay.portal.kernel.exception.PortalException,
164                            com.liferay.portal.kernel.exception.SystemException {
165                    try {
166                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
167                                            "getNode", _getNodeParameterTypes3);
168    
169                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
170                                            name);
171    
172                            Object returnObj = null;
173    
174                            try {
175                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
176                            }
177                            catch (Exception e) {
178                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
179                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
180                                    }
181    
182                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
183                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
184                                    }
185    
186                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
187                            }
188    
189                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
190                    }
191                    catch (com.liferay.portal.kernel.exception.SystemException se) {
192                            _log.error(se, se);
193    
194                            throw se;
195                    }
196            }
197    
198            public static void importPages(HttpPrincipal httpPrincipal, long nodeId,
199                    java.lang.String importer, java.io.InputStream[] inputStreams,
200                    java.util.Map<java.lang.String, java.lang.String[]> options)
201                    throws com.liferay.portal.kernel.exception.PortalException,
202                            com.liferay.portal.kernel.exception.SystemException {
203                    try {
204                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
205                                            "importPages", _importPagesParameterTypes4);
206    
207                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
208                                            importer, inputStreams, options);
209    
210                            try {
211                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
226                            _log.error(se, se);
227    
228                            throw se;
229                    }
230            }
231    
232            public static com.liferay.portlet.wiki.model.WikiNode moveNodeToTrash(
233                    HttpPrincipal httpPrincipal, long nodeId)
234                    throws com.liferay.portal.kernel.exception.PortalException,
235                            com.liferay.portal.kernel.exception.SystemException {
236                    try {
237                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
238                                            "moveNodeToTrash", _moveNodeToTrashParameterTypes5);
239    
240                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
241    
242                            Object returnObj = null;
243    
244                            try {
245                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
246                            }
247                            catch (Exception e) {
248                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
249                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
250                                    }
251    
252                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
253                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
254                                    }
255    
256                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
257                            }
258    
259                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
260                    }
261                    catch (com.liferay.portal.kernel.exception.SystemException se) {
262                            _log.error(se, se);
263    
264                            throw se;
265                    }
266            }
267    
268            public static void restoreNodeFromTrash(HttpPrincipal httpPrincipal,
269                    long nodeId)
270                    throws com.liferay.portal.kernel.exception.PortalException,
271                            com.liferay.portal.kernel.exception.SystemException {
272                    try {
273                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
274                                            "restoreNodeFromTrash", _restoreNodeFromTrashParameterTypes6);
275    
276                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
277    
278                            try {
279                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
280                            }
281                            catch (Exception e) {
282                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
283                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
284                                    }
285    
286                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
287                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
288                                    }
289    
290                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
291                            }
292                    }
293                    catch (com.liferay.portal.kernel.exception.SystemException se) {
294                            _log.error(se, se);
295    
296                            throw se;
297                    }
298            }
299    
300            public static void subscribeNode(HttpPrincipal httpPrincipal, long nodeId)
301                    throws com.liferay.portal.kernel.exception.PortalException,
302                            com.liferay.portal.kernel.exception.SystemException {
303                    try {
304                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
305                                            "subscribeNode", _subscribeNodeParameterTypes7);
306    
307                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
308    
309                            try {
310                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
311                            }
312                            catch (Exception e) {
313                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
314                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
315                                    }
316    
317                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
318                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
319                                    }
320    
321                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
322                            }
323                    }
324                    catch (com.liferay.portal.kernel.exception.SystemException se) {
325                            _log.error(se, se);
326    
327                            throw se;
328                    }
329            }
330    
331            public static void unsubscribeNode(HttpPrincipal httpPrincipal, long nodeId)
332                    throws com.liferay.portal.kernel.exception.PortalException,
333                            com.liferay.portal.kernel.exception.SystemException {
334                    try {
335                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
336                                            "unsubscribeNode", _unsubscribeNodeParameterTypes8);
337    
338                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
339    
340                            try {
341                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
342                            }
343                            catch (Exception e) {
344                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
345                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
346                                    }
347    
348                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
349                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
350                                    }
351    
352                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
353                            }
354                    }
355                    catch (com.liferay.portal.kernel.exception.SystemException se) {
356                            _log.error(se, se);
357    
358                            throw se;
359                    }
360            }
361    
362            public static com.liferay.portlet.wiki.model.WikiNode updateNode(
363                    HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
364                    java.lang.String description,
365                    com.liferay.portal.service.ServiceContext serviceContext)
366                    throws com.liferay.portal.kernel.exception.PortalException,
367                            com.liferay.portal.kernel.exception.SystemException {
368                    try {
369                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class,
370                                            "updateNode", _updateNodeParameterTypes9);
371    
372                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
373                                            name, description, serviceContext);
374    
375                            Object returnObj = null;
376    
377                            try {
378                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
379                            }
380                            catch (Exception e) {
381                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
382                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
383                                    }
384    
385                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
386                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
387                                    }
388    
389                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
390                            }
391    
392                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
393                    }
394                    catch (com.liferay.portal.kernel.exception.SystemException se) {
395                            _log.error(se, se);
396    
397                            throw se;
398                    }
399            }
400    
401            private static Log _log = LogFactoryUtil.getLog(WikiNodeServiceHttp.class);
402            private static final Class<?>[] _addNodeParameterTypes0 = new Class[] {
403                            java.lang.String.class, java.lang.String.class,
404                            com.liferay.portal.service.ServiceContext.class
405                    };
406            private static final Class<?>[] _deleteNodeParameterTypes1 = new Class[] {
407                            long.class
408                    };
409            private static final Class<?>[] _getNodeParameterTypes2 = new Class[] {
410                            long.class
411                    };
412            private static final Class<?>[] _getNodeParameterTypes3 = new Class[] {
413                            long.class, java.lang.String.class
414                    };
415            private static final Class<?>[] _importPagesParameterTypes4 = new Class[] {
416                            long.class, java.lang.String.class, java.io.InputStream[].class,
417                            java.util.Map.class
418                    };
419            private static final Class<?>[] _moveNodeToTrashParameterTypes5 = new Class[] {
420                            long.class
421                    };
422            private static final Class<?>[] _restoreNodeFromTrashParameterTypes6 = new Class[] {
423                            long.class
424                    };
425            private static final Class<?>[] _subscribeNodeParameterTypes7 = new Class[] {
426                            long.class
427                    };
428            private static final Class<?>[] _unsubscribeNodeParameterTypes8 = new Class[] {
429                            long.class
430                    };
431            private static final Class<?>[] _updateNodeParameterTypes9 = new Class[] {
432                            long.class, java.lang.String.class, java.lang.String.class,
433                            com.liferay.portal.service.ServiceContext.class
434                    };
435    }