001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.wiki.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.LongWrapper;
020    import com.liferay.portal.kernel.util.MethodWrapper;
021    import com.liferay.portal.kernel.util.NullWrapper;
022    import com.liferay.portal.security.auth.HttpPrincipal;
023    import com.liferay.portal.service.http.TunnelUtil;
024    
025    import com.liferay.portlet.wiki.service.WikiNodeServiceUtil;
026    
027    /**
028     * <p>
029     * This class provides a HTTP utility for the
030     * {@link com.liferay.portlet.wiki.service.WikiNodeServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
034     * </p>
035     *
036     * <p>
037     * The benefits of using the HTTP utility is that it is fast and allows for
038     * tunneling without the cost of serializing to text. The drawback is that it
039     * only works with Java.
040     * </p>
041     *
042     * <p>
043     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
044     * configure security.
045     * </p>
046     *
047     * <p>
048     * The HTTP utility is only generated for remote services.
049     * </p>
050     *
051     * @author    Brian Wing Shun Chan
052     * @see       WikiNodeServiceSoap
053     * @see       com.liferay.portal.security.auth.HttpPrincipal
054     * @see       com.liferay.portlet.wiki.service.WikiNodeServiceUtil
055     * @generated
056     */
057    public class WikiNodeServiceHttp {
058            public static com.liferay.portlet.wiki.model.WikiNode addNode(
059                    HttpPrincipal httpPrincipal, java.lang.String name,
060                    java.lang.String description,
061                    com.liferay.portal.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            Object paramObj0 = name;
066    
067                            if (name == null) {
068                                    paramObj0 = new NullWrapper("java.lang.String");
069                            }
070    
071                            Object paramObj1 = description;
072    
073                            if (description == null) {
074                                    paramObj1 = new NullWrapper("java.lang.String");
075                            }
076    
077                            Object paramObj2 = serviceContext;
078    
079                            if (serviceContext == null) {
080                                    paramObj2 = new NullWrapper(
081                                                    "com.liferay.portal.service.ServiceContext");
082                            }
083    
084                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
085                                            "addNode", new Object[] { paramObj0, paramObj1, paramObj2 });
086    
087                            Object returnObj = null;
088    
089                            try {
090                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
091                            }
092                            catch (Exception e) {
093                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
094                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
095                                    }
096    
097                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
098                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
099                                    }
100    
101                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
102                            }
103    
104                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
105                    }
106                    catch (com.liferay.portal.kernel.exception.SystemException se) {
107                            _log.error(se, se);
108    
109                            throw se;
110                    }
111            }
112    
113            public static void deleteNode(HttpPrincipal httpPrincipal, long nodeId)
114                    throws com.liferay.portal.kernel.exception.PortalException,
115                            com.liferay.portal.kernel.exception.SystemException {
116                    try {
117                            Object paramObj0 = new LongWrapper(nodeId);
118    
119                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
120                                            "deleteNode", new Object[] { paramObj0 });
121    
122                            try {
123                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
124                            }
125                            catch (Exception e) {
126                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
127                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
128                                    }
129    
130                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
131                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
132                                    }
133    
134                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
135                            }
136                    }
137                    catch (com.liferay.portal.kernel.exception.SystemException se) {
138                            _log.error(se, se);
139    
140                            throw se;
141                    }
142            }
143    
144            public static com.liferay.portlet.wiki.model.WikiNode getNode(
145                    HttpPrincipal httpPrincipal, long nodeId)
146                    throws com.liferay.portal.kernel.exception.PortalException,
147                            com.liferay.portal.kernel.exception.SystemException {
148                    try {
149                            Object paramObj0 = new LongWrapper(nodeId);
150    
151                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
152                                            "getNode", new Object[] { paramObj0 });
153    
154                            Object returnObj = null;
155    
156                            try {
157                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
158                            }
159                            catch (Exception e) {
160                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
161                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
162                                    }
163    
164                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
165                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
166                                    }
167    
168                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
169                            }
170    
171                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
172                    }
173                    catch (com.liferay.portal.kernel.exception.SystemException se) {
174                            _log.error(se, se);
175    
176                            throw se;
177                    }
178            }
179    
180            public static com.liferay.portlet.wiki.model.WikiNode getNode(
181                    HttpPrincipal httpPrincipal, long groupId, java.lang.String name)
182                    throws com.liferay.portal.kernel.exception.PortalException,
183                            com.liferay.portal.kernel.exception.SystemException {
184                    try {
185                            Object paramObj0 = new LongWrapper(groupId);
186    
187                            Object paramObj1 = name;
188    
189                            if (name == null) {
190                                    paramObj1 = new NullWrapper("java.lang.String");
191                            }
192    
193                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
194                                            "getNode", new Object[] { paramObj0, paramObj1 });
195    
196                            Object returnObj = null;
197    
198                            try {
199                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
200                            }
201                            catch (Exception e) {
202                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
203                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
204                                    }
205    
206                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
207                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
208                                    }
209    
210                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
211                            }
212    
213                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
214                    }
215                    catch (com.liferay.portal.kernel.exception.SystemException se) {
216                            _log.error(se, se);
217    
218                            throw se;
219                    }
220            }
221    
222            public static void importPages(HttpPrincipal httpPrincipal, long nodeId,
223                    java.lang.String importer, java.io.File[] files,
224                    java.util.Map<java.lang.String, java.lang.String[]> options)
225                    throws com.liferay.portal.kernel.exception.PortalException,
226                            com.liferay.portal.kernel.exception.SystemException {
227                    try {
228                            Object paramObj0 = new LongWrapper(nodeId);
229    
230                            Object paramObj1 = importer;
231    
232                            if (importer == null) {
233                                    paramObj1 = new NullWrapper("java.lang.String");
234                            }
235    
236                            Object paramObj2 = files;
237    
238                            if (files == null) {
239                                    paramObj2 = new NullWrapper("[Ljava.io.File;");
240                            }
241    
242                            Object paramObj3 = options;
243    
244                            if (options == null) {
245                                    paramObj3 = new NullWrapper("java.util.Map");
246                            }
247    
248                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
249                                            "importPages",
250                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
251    
252                            try {
253                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
254                            }
255                            catch (Exception e) {
256                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
257                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
258                                    }
259    
260                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
261                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
262                                    }
263    
264                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
265                            }
266                    }
267                    catch (com.liferay.portal.kernel.exception.SystemException se) {
268                            _log.error(se, se);
269    
270                            throw se;
271                    }
272            }
273    
274            public static void subscribeNode(HttpPrincipal httpPrincipal, long nodeId)
275                    throws com.liferay.portal.kernel.exception.PortalException,
276                            com.liferay.portal.kernel.exception.SystemException {
277                    try {
278                            Object paramObj0 = new LongWrapper(nodeId);
279    
280                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
281                                            "subscribeNode", new Object[] { paramObj0 });
282    
283                            try {
284                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
285                            }
286                            catch (Exception e) {
287                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
288                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
289                                    }
290    
291                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
292                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
293                                    }
294    
295                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
296                            }
297                    }
298                    catch (com.liferay.portal.kernel.exception.SystemException se) {
299                            _log.error(se, se);
300    
301                            throw se;
302                    }
303            }
304    
305            public static void unsubscribeNode(HttpPrincipal httpPrincipal, long nodeId)
306                    throws com.liferay.portal.kernel.exception.PortalException,
307                            com.liferay.portal.kernel.exception.SystemException {
308                    try {
309                            Object paramObj0 = new LongWrapper(nodeId);
310    
311                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
312                                            "unsubscribeNode", new Object[] { paramObj0 });
313    
314                            try {
315                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
316                            }
317                            catch (Exception e) {
318                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
319                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
320                                    }
321    
322                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
323                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
324                                    }
325    
326                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
327                            }
328                    }
329                    catch (com.liferay.portal.kernel.exception.SystemException se) {
330                            _log.error(se, se);
331    
332                            throw se;
333                    }
334            }
335    
336            public static com.liferay.portlet.wiki.model.WikiNode updateNode(
337                    HttpPrincipal httpPrincipal, long nodeId, java.lang.String name,
338                    java.lang.String description,
339                    com.liferay.portal.service.ServiceContext serviceContext)
340                    throws com.liferay.portal.kernel.exception.PortalException,
341                            com.liferay.portal.kernel.exception.SystemException {
342                    try {
343                            Object paramObj0 = new LongWrapper(nodeId);
344    
345                            Object paramObj1 = name;
346    
347                            if (name == null) {
348                                    paramObj1 = new NullWrapper("java.lang.String");
349                            }
350    
351                            Object paramObj2 = description;
352    
353                            if (description == null) {
354                                    paramObj2 = new NullWrapper("java.lang.String");
355                            }
356    
357                            Object paramObj3 = serviceContext;
358    
359                            if (serviceContext == null) {
360                                    paramObj3 = new NullWrapper(
361                                                    "com.liferay.portal.service.ServiceContext");
362                            }
363    
364                            MethodWrapper methodWrapper = new MethodWrapper(WikiNodeServiceUtil.class.getName(),
365                                            "updateNode",
366                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
367    
368                            Object returnObj = null;
369    
370                            try {
371                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
372                            }
373                            catch (Exception e) {
374                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
375                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
376                                    }
377    
378                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
379                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
380                                    }
381    
382                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
383                            }
384    
385                            return (com.liferay.portlet.wiki.model.WikiNode)returnObj;
386                    }
387                    catch (com.liferay.portal.kernel.exception.SystemException se) {
388                            _log.error(se, se);
389    
390                            throw se;
391                    }
392            }
393    
394            private static Log _log = LogFactoryUtil.getLog(WikiNodeServiceHttp.class);
395    }