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