1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.wiki.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.wiki.service.WikiNodeServiceUtil;
25  
26  /**
27   * <a href="WikiNodeServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.wiki.service.WikiNodeServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       WikiNodeServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.wiki.service.WikiNodeServiceUtil
61   * @generated
62   */
63  public class WikiNodeServiceHttp {
64      public static com.liferay.portlet.wiki.model.WikiNode addNode(
65          HttpPrincipal httpPrincipal, java.lang.String name,
66          java.lang.String description,
67          com.liferay.portal.service.ServiceContext serviceContext)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
72                      "addNode", _addNodeParameterTypes0);
73  
74              MethodHandler methodHandler = new MethodHandler(methodKey, name,
75                      description, serviceContext);
76  
77              Object returnObj = null;
78  
79              try {
80                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
81              }
82              catch (Exception e) {
83                  if (e instanceof com.liferay.portal.PortalException) {
84                      throw (com.liferay.portal.PortalException)e;
85                  }
86  
87                  if (e instanceof com.liferay.portal.SystemException) {
88                      throw (com.liferay.portal.SystemException)e;
89                  }
90  
91                  throw new com.liferay.portal.SystemException(e);
92              }
93  
94              return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
95          }
96          catch (com.liferay.portal.SystemException se) {
97              _log.error(se, se);
98  
99              throw se;
100         }
101     }
102 
103     public static void deleteNode(HttpPrincipal httpPrincipal, long nodeId)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException {
106         try {
107             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
108                     "deleteNode", _deleteNodeParameterTypes1);
109 
110             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
111 
112             try {
113                 TunnelUtil.invoke(httpPrincipal, methodHandler);
114             }
115             catch (Exception e) {
116                 if (e instanceof com.liferay.portal.PortalException) {
117                     throw (com.liferay.portal.PortalException)e;
118                 }
119 
120                 if (e instanceof com.liferay.portal.SystemException) {
121                     throw (com.liferay.portal.SystemException)e;
122                 }
123 
124                 throw new com.liferay.portal.SystemException(e);
125             }
126         }
127         catch (com.liferay.portal.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static com.liferay.portlet.wiki.model.WikiNode getNode(
135         HttpPrincipal httpPrincipal, long nodeId)
136         throws com.liferay.portal.PortalException,
137             com.liferay.portal.SystemException {
138         try {
139             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
140                     "getNode", _getNodeParameterTypes2);
141 
142             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
143 
144             Object returnObj = null;
145 
146             try {
147                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148             }
149             catch (Exception e) {
150                 if (e instanceof com.liferay.portal.PortalException) {
151                     throw (com.liferay.portal.PortalException)e;
152                 }
153 
154                 if (e instanceof com.liferay.portal.SystemException) {
155                     throw (com.liferay.portal.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.SystemException(e);
159             }
160 
161             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static com.liferay.portlet.wiki.model.WikiNode getNode(
171         HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
172         throws com.liferay.portal.PortalException,
173             com.liferay.portal.SystemException {
174         try {
175             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
176                     "getNode", _getNodeParameterTypes3);
177 
178             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
179                     name);
180 
181             Object returnObj = null;
182 
183             try {
184                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
185             }
186             catch (Exception e) {
187                 if (e instanceof com.liferay.portal.PortalException) {
188                     throw (com.liferay.portal.PortalException)e;
189                 }
190 
191                 if (e instanceof com.liferay.portal.SystemException) {
192                     throw (com.liferay.portal.SystemException)e;
193                 }
194 
195                 throw new com.liferay.portal.SystemException(e);
196             }
197 
198             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
199         }
200         catch (com.liferay.portal.SystemException se) {
201             _log.error(se, se);
202 
203             throw se;
204         }
205     }
206 
207     public static void importPages(HttpPrincipal httpPrincipal, long nodeId,
208         java.lang.String importer, java.io.File[] files,
209         java.util.Map<java.lang.String, java.lang.String[]> options)
210         throws com.liferay.portal.PortalException,
211             com.liferay.portal.SystemException {
212         try {
213             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
214                     "importPages", _importPagesParameterTypes4);
215 
216             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
217                     importer, files, options);
218 
219             try {
220                 TunnelUtil.invoke(httpPrincipal, methodHandler);
221             }
222             catch (Exception e) {
223                 if (e instanceof com.liferay.portal.PortalException) {
224                     throw (com.liferay.portal.PortalException)e;
225                 }
226 
227                 if (e instanceof com.liferay.portal.SystemException) {
228                     throw (com.liferay.portal.SystemException)e;
229                 }
230 
231                 throw new com.liferay.portal.SystemException(e);
232             }
233         }
234         catch (com.liferay.portal.SystemException se) {
235             _log.error(se, se);
236 
237             throw se;
238         }
239     }
240 
241     public static void subscribeNode(HttpPrincipal httpPrincipal, long nodeId)
242         throws com.liferay.portal.PortalException,
243             com.liferay.portal.SystemException {
244         try {
245             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
246                     "subscribeNode", _subscribeNodeParameterTypes5);
247 
248             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
249 
250             try {
251                 TunnelUtil.invoke(httpPrincipal, methodHandler);
252             }
253             catch (Exception e) {
254                 if (e instanceof com.liferay.portal.PortalException) {
255                     throw (com.liferay.portal.PortalException)e;
256                 }
257 
258                 if (e instanceof com.liferay.portal.SystemException) {
259                     throw (com.liferay.portal.SystemException)e;
260                 }
261 
262                 throw new com.liferay.portal.SystemException(e);
263             }
264         }
265         catch (com.liferay.portal.SystemException se) {
266             _log.error(se, se);
267 
268             throw se;
269         }
270     }
271 
272     public static void unsubscribeNode(HttpPrincipal httpPrincipal, long nodeId)
273         throws com.liferay.portal.PortalException,
274             com.liferay.portal.SystemException {
275         try {
276             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
277                     "unsubscribeNode", _unsubscribeNodeParameterTypes6);
278 
279             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId);
280 
281             try {
282                 TunnelUtil.invoke(httpPrincipal, methodHandler);
283             }
284             catch (Exception e) {
285                 if (e instanceof com.liferay.portal.PortalException) {
286                     throw (com.liferay.portal.PortalException)e;
287                 }
288 
289                 if (e instanceof com.liferay.portal.SystemException) {
290                     throw (com.liferay.portal.SystemException)e;
291                 }
292 
293                 throw new com.liferay.portal.SystemException(e);
294             }
295         }
296         catch (com.liferay.portal.SystemException se) {
297             _log.error(se, se);
298 
299             throw se;
300         }
301     }
302 
303     public static com.liferay.portlet.wiki.model.WikiNode updateNode(
304         HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
305         java.lang.String description)
306         throws com.liferay.portal.PortalException,
307             com.liferay.portal.SystemException {
308         try {
309             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
310                     "updateNode", _updateNodeParameterTypes7);
311 
312             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
313                     name, description);
314 
315             Object returnObj = null;
316 
317             try {
318                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
319             }
320             catch (Exception e) {
321                 if (e instanceof com.liferay.portal.PortalException) {
322                     throw (com.liferay.portal.PortalException)e;
323                 }
324 
325                 if (e instanceof com.liferay.portal.SystemException) {
326                     throw (com.liferay.portal.SystemException)e;
327                 }
328 
329                 throw new com.liferay.portal.SystemException(e);
330             }
331 
332             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
333         }
334         catch (com.liferay.portal.SystemException se) {
335             _log.error(se, se);
336 
337             throw se;
338         }
339     }
340 
341     public static com.liferay.portlet.wiki.model.WikiNode updateNode(
342         HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
343         java.lang.String description,
344         com.liferay.portal.service.ServiceContext serviceContext)
345         throws com.liferay.portal.PortalException,
346             com.liferay.portal.SystemException {
347         try {
348             MethodKey methodKey = new MethodKey(WikiNodeServiceUtil.class.getName(),
349                     "updateNode", _updateNodeParameterTypes8);
350 
351             MethodHandler methodHandler = new MethodHandler(methodKey, nodeId,
352                     name, description, serviceContext);
353 
354             Object returnObj = null;
355 
356             try {
357                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
358             }
359             catch (Exception e) {
360                 if (e instanceof com.liferay.portal.PortalException) {
361                     throw (com.liferay.portal.PortalException)e;
362                 }
363 
364                 if (e instanceof com.liferay.portal.SystemException) {
365                     throw (com.liferay.portal.SystemException)e;
366                 }
367 
368                 throw new com.liferay.portal.SystemException(e);
369             }
370 
371             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
372         }
373         catch (com.liferay.portal.SystemException se) {
374             _log.error(se, se);
375 
376             throw se;
377         }
378     }
379 
380     private static Log _log = LogFactoryUtil.getLog(WikiNodeServiceHttp.class);
381     private static final Class<?>[] _addNodeParameterTypes0 = new Class[] {
382             java.lang.String.class, java.lang.String.class,
383             com.liferay.portal.service.ServiceContext.class
384         };
385     private static final Class<?>[] _deleteNodeParameterTypes1 = new Class[] {
386             long.class
387         };
388     private static final Class<?>[] _getNodeParameterTypes2 = new Class[] {
389             long.class
390         };
391     private static final Class<?>[] _getNodeParameterTypes3 = new Class[] {
392             long.class, java.lang.String.class
393         };
394     private static final Class<?>[] _importPagesParameterTypes4 = new Class[] {
395             long.class, java.lang.String.class, java.io.File[].class,
396             java.util.Map.class
397         };
398     private static final Class<?>[] _subscribeNodeParameterTypes5 = new Class[] {
399             long.class
400         };
401     private static final Class<?>[] _unsubscribeNodeParameterTypes6 = new Class[] {
402             long.class
403         };
404     private static final Class<?>[] _updateNodeParameterTypes7 = new Class[] {
405             long.class, java.lang.String.class, java.lang.String.class
406         };
407     private static final Class<?>[] _updateNodeParameterTypes8 = new Class[] {
408             long.class, java.lang.String.class, java.lang.String.class,
409             com.liferay.portal.service.ServiceContext.class
410         };
411 }