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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.wiki.service.WikiNodeServiceUtil;
27  
28  /**
29   * <a href="WikiNodeServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.wiki.service.WikiNodeServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       WikiNodeServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.wiki.service.WikiNodeServiceUtil
63   * @generated
64   */
65  public class WikiNodeServiceHttp {
66      public static com.liferay.portlet.wiki.model.WikiNode addNode(
67          HttpPrincipal httpPrincipal, long plid, java.lang.String name,
68          java.lang.String description, boolean addCommunityPermissions,
69          boolean addGuestPermissions)
70          throws com.liferay.portal.PortalException,
71              com.liferay.portal.SystemException {
72          try {
73              Object paramObj0 = new LongWrapper(plid);
74  
75              Object paramObj1 = name;
76  
77              if (name == null) {
78                  paramObj1 = new NullWrapper("java.lang.String");
79              }
80  
81              Object paramObj2 = description;
82  
83              if (description == null) {
84                  paramObj2 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj3 = new BooleanWrapper(addCommunityPermissions);
88  
89              Object paramObj4 = new BooleanWrapper(addGuestPermissions);
90  
91              MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
92                      "addNode",
93                      new Object[] {
94                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
95                      });
96  
97              Object returnObj = null;
98  
99              try {
100                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
101             }
102             catch (Exception e) {
103                 if (e instanceof com.liferay.portal.PortalException) {
104                     throw (com.liferay.portal.PortalException)e;
105                 }
106 
107                 if (e instanceof com.liferay.portal.SystemException) {
108                     throw (com.liferay.portal.SystemException)e;
109                 }
110 
111                 throw new com.liferay.portal.SystemException(e);
112             }
113 
114             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
115         }
116         catch (com.liferay.portal.SystemException se) {
117             _log.error(se, se);
118 
119             throw se;
120         }
121     }
122 
123     public static com.liferay.portlet.wiki.model.WikiNode addNode(
124         HttpPrincipal httpPrincipal, long plid, java.lang.String name,
125         java.lang.String description, java.lang.String[] communityPermissions,
126         java.lang.String[] guestPermissions)
127         throws com.liferay.portal.PortalException,
128             com.liferay.portal.SystemException {
129         try {
130             Object paramObj0 = new LongWrapper(plid);
131 
132             Object paramObj1 = name;
133 
134             if (name == null) {
135                 paramObj1 = new NullWrapper("java.lang.String");
136             }
137 
138             Object paramObj2 = description;
139 
140             if (description == null) {
141                 paramObj2 = new NullWrapper("java.lang.String");
142             }
143 
144             Object paramObj3 = communityPermissions;
145 
146             if (communityPermissions == null) {
147                 paramObj3 = new NullWrapper("[Ljava.lang.String;");
148             }
149 
150             Object paramObj4 = guestPermissions;
151 
152             if (guestPermissions == null) {
153                 paramObj4 = new NullWrapper("[Ljava.lang.String;");
154             }
155 
156             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
157                     "addNode",
158                     new Object[] {
159                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
160                     });
161 
162             Object returnObj = null;
163 
164             try {
165                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
166             }
167             catch (Exception e) {
168                 if (e instanceof com.liferay.portal.PortalException) {
169                     throw (com.liferay.portal.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.SystemException) {
173                     throw (com.liferay.portal.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.SystemException(e);
177             }
178 
179             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
180         }
181         catch (com.liferay.portal.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     public static void deleteNode(HttpPrincipal httpPrincipal, long nodeId)
189         throws com.liferay.portal.PortalException,
190             com.liferay.portal.SystemException {
191         try {
192             Object paramObj0 = new LongWrapper(nodeId);
193 
194             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
195                     "deleteNode", new Object[] { paramObj0 });
196 
197             try {
198                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
199             }
200             catch (Exception e) {
201                 if (e instanceof com.liferay.portal.PortalException) {
202                     throw (com.liferay.portal.PortalException)e;
203                 }
204 
205                 if (e instanceof com.liferay.portal.SystemException) {
206                     throw (com.liferay.portal.SystemException)e;
207                 }
208 
209                 throw new com.liferay.portal.SystemException(e);
210             }
211         }
212         catch (com.liferay.portal.SystemException se) {
213             _log.error(se, se);
214 
215             throw se;
216         }
217     }
218 
219     public static com.liferay.portlet.wiki.model.WikiNode getNode(
220         HttpPrincipal httpPrincipal, long nodeId)
221         throws com.liferay.portal.PortalException,
222             com.liferay.portal.SystemException {
223         try {
224             Object paramObj0 = new LongWrapper(nodeId);
225 
226             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
227                     "getNode", new Object[] { paramObj0 });
228 
229             Object returnObj = null;
230 
231             try {
232                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
233             }
234             catch (Exception e) {
235                 if (e instanceof com.liferay.portal.PortalException) {
236                     throw (com.liferay.portal.PortalException)e;
237                 }
238 
239                 if (e instanceof com.liferay.portal.SystemException) {
240                     throw (com.liferay.portal.SystemException)e;
241                 }
242 
243                 throw new com.liferay.portal.SystemException(e);
244             }
245 
246             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
247         }
248         catch (com.liferay.portal.SystemException se) {
249             _log.error(se, se);
250 
251             throw se;
252         }
253     }
254 
255     public static com.liferay.portlet.wiki.model.WikiNode getNode(
256         HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
257         throws com.liferay.portal.PortalException,
258             com.liferay.portal.SystemException {
259         try {
260             Object paramObj0 = new LongWrapper(groupId);
261 
262             Object paramObj1 = name;
263 
264             if (name == null) {
265                 paramObj1 = new NullWrapper("java.lang.String");
266             }
267 
268             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
269                     "getNode", new Object[] { paramObj0, paramObj1 });
270 
271             Object returnObj = null;
272 
273             try {
274                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
275             }
276             catch (Exception e) {
277                 if (e instanceof com.liferay.portal.PortalException) {
278                     throw (com.liferay.portal.PortalException)e;
279                 }
280 
281                 if (e instanceof com.liferay.portal.SystemException) {
282                     throw (com.liferay.portal.SystemException)e;
283                 }
284 
285                 throw new com.liferay.portal.SystemException(e);
286             }
287 
288             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
289         }
290         catch (com.liferay.portal.SystemException se) {
291             _log.error(se, se);
292 
293             throw se;
294         }
295     }
296 
297     public static void importPages(HttpPrincipal httpPrincipal, long nodeId,
298         java.lang.String importer, java.io.File[] files,
299         java.util.Map<String, String[]> options)
300         throws com.liferay.portal.PortalException,
301             com.liferay.portal.SystemException {
302         try {
303             Object paramObj0 = new LongWrapper(nodeId);
304 
305             Object paramObj1 = importer;
306 
307             if (importer == null) {
308                 paramObj1 = new NullWrapper("java.lang.String");
309             }
310 
311             Object paramObj2 = files;
312 
313             if (files == null) {
314                 paramObj2 = new NullWrapper("[Ljava.io.File;");
315             }
316 
317             Object paramObj3 = options;
318 
319             if (options == null) {
320                 paramObj3 = new NullWrapper("java.util.Map");
321             }
322 
323             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
324                     "importPages",
325                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
326 
327             try {
328                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
329             }
330             catch (Exception e) {
331                 if (e instanceof com.liferay.portal.PortalException) {
332                     throw (com.liferay.portal.PortalException)e;
333                 }
334 
335                 if (e instanceof com.liferay.portal.SystemException) {
336                     throw (com.liferay.portal.SystemException)e;
337                 }
338 
339                 throw new com.liferay.portal.SystemException(e);
340             }
341         }
342         catch (com.liferay.portal.SystemException se) {
343             _log.error(se, se);
344 
345             throw se;
346         }
347     }
348 
349     public static void subscribeNode(HttpPrincipal httpPrincipal, long nodeId)
350         throws com.liferay.portal.PortalException,
351             com.liferay.portal.SystemException {
352         try {
353             Object paramObj0 = new LongWrapper(nodeId);
354 
355             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
356                     "subscribeNode", new Object[] { paramObj0 });
357 
358             try {
359                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
360             }
361             catch (Exception e) {
362                 if (e instanceof com.liferay.portal.PortalException) {
363                     throw (com.liferay.portal.PortalException)e;
364                 }
365 
366                 if (e instanceof com.liferay.portal.SystemException) {
367                     throw (com.liferay.portal.SystemException)e;
368                 }
369 
370                 throw new com.liferay.portal.SystemException(e);
371             }
372         }
373         catch (com.liferay.portal.SystemException se) {
374             _log.error(se, se);
375 
376             throw se;
377         }
378     }
379 
380     public static void unsubscribeNode(HttpPrincipal httpPrincipal, long nodeId)
381         throws com.liferay.portal.PortalException,
382             com.liferay.portal.SystemException {
383         try {
384             Object paramObj0 = new LongWrapper(nodeId);
385 
386             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
387                     "unsubscribeNode", new Object[] { paramObj0 });
388 
389             try {
390                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
391             }
392             catch (Exception e) {
393                 if (e instanceof com.liferay.portal.PortalException) {
394                     throw (com.liferay.portal.PortalException)e;
395                 }
396 
397                 if (e instanceof com.liferay.portal.SystemException) {
398                     throw (com.liferay.portal.SystemException)e;
399                 }
400 
401                 throw new com.liferay.portal.SystemException(e);
402             }
403         }
404         catch (com.liferay.portal.SystemException se) {
405             _log.error(se, se);
406 
407             throw se;
408         }
409     }
410 
411     public static com.liferay.portlet.wiki.model.WikiNode updateNode(
412         HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
413         java.lang.String description)
414         throws com.liferay.portal.PortalException,
415             com.liferay.portal.SystemException {
416         try {
417             Object paramObj0 = new LongWrapper(nodeId);
418 
419             Object paramObj1 = name;
420 
421             if (name == null) {
422                 paramObj1 = new NullWrapper("java.lang.String");
423             }
424 
425             Object paramObj2 = description;
426 
427             if (description == null) {
428                 paramObj2 = new NullWrapper("java.lang.String");
429             }
430 
431             MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
432                     "updateNode",
433                     new Object[] { paramObj0, paramObj1, paramObj2 });
434 
435             Object returnObj = null;
436 
437             try {
438                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
439             }
440             catch (Exception e) {
441                 if (e instanceof com.liferay.portal.PortalException) {
442                     throw (com.liferay.portal.PortalException)e;
443                 }
444 
445                 if (e instanceof com.liferay.portal.SystemException) {
446                     throw (com.liferay.portal.SystemException)e;
447                 }
448 
449                 throw new com.liferay.portal.SystemException(e);
450             }
451 
452             return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
453         }
454         catch (com.liferay.portal.SystemException se) {
455             _log.error(se, se);
456 
457             throw se;
458         }
459     }
460 
461     private static Log _log = LogFactoryUtil.getLog(WikiNodeServiceHttp.class);
462 }