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