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