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