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     * <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 void subscribeNode(HttpPrincipal httpPrincipal, long nodeId)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    try {
238                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
239                                            "subscribeNode", _subscribeNodeParameterTypes5);
240    
241                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
242    
243                            try {
244                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
245                            }
246                            catch (Exception e) {
247                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
248                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
249                                    }
250    
251                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
252                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
253                                    }
254    
255                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
256                            }
257                    }
258                    catch (com.liferay.portal.kernel.exception.SystemException se) {
259                            _log.error(se, se);
260    
261                            throw se;
262                    }
263            }
264    
265            public static void unsubscribeNode(HttpPrincipal httpPrincipal, long nodeId)
266                    throws com.liferay.portal.kernel.exception.PortalException,
267                            com.liferay.portal.kernel.exception.SystemException {
268                    try {
269                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
270                                            "unsubscribeNode", _unsubscribeNodeParameterTypes6);
271    
272                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
273    
274                            try {
275                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
276                            }
277                            catch (Exception e) {
278                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
279                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
280                                    }
281    
282                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
283                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
284                                    }
285    
286                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
287                            }
288                    }
289                    catch (com.liferay.portal.kernel.exception.SystemException se) {
290                            _log.error(se, se);
291    
292                            throw se;
293                    }
294            }
295    
296            public static com.liferay.portlet.wiki.model.WikiNode updateNode(
297                    HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
298                    java.lang.String description,
299                    com.liferay.portal.service.ServiceContext serviceContext)
300                    throws com.liferay.portal.kernel.exception.PortalException,
301                            com.liferay.portal.kernel.exception.SystemException {
302                    try {
303                            MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
304                                            "updateNode", _updateNodeParameterTypes7);
305    
306                            MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
307                                            name, description, serviceContext);
308    
309                            Object returnObj = null;
310    
311                            try {
312                                    returnObj = 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                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
327                    }
328                    catch (com.liferay.portal.kernel.exception.SystemException se) {
329                            _log.error(se, se);
330    
331                            throw se;
332                    }
333            }
334    
335            private static Log _log = LogFactoryUtil.getLog(WikiNodeServiceHttp.class);
336            private static final Class<?>[] _addNodeParameterTypes0 = new Class[] {
337                            java.lang.String.class, java.lang.String.class,
338                            com.liferay.portal.service.ServiceContext.class
339                    };
340            private static final Class<?>[] _deleteNodeParameterTypes1 = new Class[] {
341                            long.class
342                    };
343            private static final Class<?>[] _getNodeParameterTypes2 = new Class[] {
344                            long.class
345                    };
346            private static final Class<?>[] _getNodeParameterTypes3 = new Class[] {
347                            long.class, java.lang.String.class
348                    };
349            private static final Class<?>[] _importPagesParameterTypes4 = new Class[] {
350                            long.class, java.lang.String.class, java.io.InputStream[].class,
351                            java.util.Map.class
352                    };
353            private static final Class<?>[] _subscribeNodeParameterTypes5 = new Class[] {
354                            long.class
355                    };
356            private static final Class<?>[] _unsubscribeNodeParameterTypes6 = new Class[] {
357                            long.class
358                    };
359            private static final Class<?>[] _updateNodeParameterTypes7 = new Class[] {
360                            long.class, java.lang.String.class, java.lang.String.class,
361                            com.liferay.portal.service.ServiceContext.class
362                    };
363    }