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.messageboards.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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.messageboards.service.MBThreadServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.messageboards.service.MBThreadServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       MBThreadServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.messageboards.service.MBThreadServiceUtil
054     * @generated
055     */
056    public class MBThreadServiceHttp {
057            public static void deleteThread(HttpPrincipal httpPrincipal, long threadId)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
062                                            "deleteThread", long.class);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey, threadId);
065    
066                            try {
067                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
068                            }
069                            catch (Exception e) {
070                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
071                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
072                                    }
073    
074                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
075                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080                    }
081                    catch (com.liferay.portal.kernel.exception.SystemException se) {
082                            _log.error(se, se);
083    
084                            throw se;
085                    }
086            }
087    
088            public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> getGroupThreads(
089                    HttpPrincipal httpPrincipal, long groupId, long userId, int status,
090                    boolean subscribed, boolean includeAnonymous, int start, int end)
091                    throws com.liferay.portal.kernel.exception.PortalException,
092                            com.liferay.portal.kernel.exception.SystemException {
093                    try {
094                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
095                                            "getGroupThreads", long.class, long.class, int.class,
096                                            boolean.class, boolean.class, int.class, int.class);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
099                                            userId, status, subscribed, includeAnonymous, start, end);
100    
101                            Object returnObj = null;
102    
103                            try {
104                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
105                            }
106                            catch (Exception e) {
107                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
108                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
109                                    }
110    
111                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
112                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
113                                    }
114    
115                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
116                            }
117    
118                            return (java.util.List<com.liferay.portlet.messageboards.model.MBThread>)returnObj;
119                    }
120                    catch (com.liferay.portal.kernel.exception.SystemException se) {
121                            _log.error(se, se);
122    
123                            throw se;
124                    }
125            }
126    
127            public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> getGroupThreads(
128                    HttpPrincipal httpPrincipal, long groupId, long userId, int status,
129                    boolean subscribed, int start, int end)
130                    throws com.liferay.portal.kernel.exception.PortalException,
131                            com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
134                                            "getGroupThreads", long.class, long.class, int.class,
135                                            boolean.class, int.class, int.class);
136    
137                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
138                                            userId, status, subscribed, start, end);
139    
140                            Object returnObj = null;
141    
142                            try {
143                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
144                            }
145                            catch (Exception e) {
146                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
148                                    }
149    
150                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
151                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
152                                    }
153    
154                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
155                            }
156    
157                            return (java.util.List<com.liferay.portlet.messageboards.model.MBThread>)returnObj;
158                    }
159                    catch (com.liferay.portal.kernel.exception.SystemException se) {
160                            _log.error(se, se);
161    
162                            throw se;
163                    }
164            }
165    
166            public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> getGroupThreads(
167                    HttpPrincipal httpPrincipal, long groupId, long userId, int status,
168                    int start, int end)
169                    throws com.liferay.portal.kernel.exception.PortalException,
170                            com.liferay.portal.kernel.exception.SystemException {
171                    try {
172                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
173                                            "getGroupThreads", long.class, long.class, int.class,
174                                            int.class, int.class);
175    
176                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
177                                            userId, status, start, end);
178    
179                            Object returnObj = null;
180    
181                            try {
182                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
183                            }
184                            catch (Exception e) {
185                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
186                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
187                                    }
188    
189                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
190                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
191                                    }
192    
193                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
194                            }
195    
196                            return (java.util.List<com.liferay.portlet.messageboards.model.MBThread>)returnObj;
197                    }
198                    catch (com.liferay.portal.kernel.exception.SystemException se) {
199                            _log.error(se, se);
200    
201                            throw se;
202                    }
203            }
204    
205            public static int getGroupThreadsCount(HttpPrincipal httpPrincipal,
206                    long groupId, long userId, int status)
207                    throws com.liferay.portal.kernel.exception.SystemException {
208                    try {
209                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
210                                            "getGroupThreadsCount", long.class, long.class, int.class);
211    
212                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
213                                            userId, status);
214    
215                            Object returnObj = null;
216    
217                            try {
218                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
219                            }
220                            catch (Exception e) {
221                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
222                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
223                                    }
224    
225                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
226                            }
227    
228                            return ((Integer)returnObj).intValue();
229                    }
230                    catch (com.liferay.portal.kernel.exception.SystemException se) {
231                            _log.error(se, se);
232    
233                            throw se;
234                    }
235            }
236    
237            public static int getGroupThreadsCount(HttpPrincipal httpPrincipal,
238                    long groupId, long userId, int status, boolean subscribed)
239                    throws com.liferay.portal.kernel.exception.SystemException {
240                    try {
241                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
242                                            "getGroupThreadsCount", long.class, long.class, int.class,
243                                            boolean.class);
244    
245                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
246                                            userId, status, subscribed);
247    
248                            Object returnObj = null;
249    
250                            try {
251                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
252                            }
253                            catch (Exception e) {
254                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
255                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
256                                    }
257    
258                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
259                            }
260    
261                            return ((Integer)returnObj).intValue();
262                    }
263                    catch (com.liferay.portal.kernel.exception.SystemException se) {
264                            _log.error(se, se);
265    
266                            throw se;
267                    }
268            }
269    
270            public static int getGroupThreadsCount(HttpPrincipal httpPrincipal,
271                    long groupId, long userId, int status, boolean subscribed,
272                    boolean includeAnonymous)
273                    throws com.liferay.portal.kernel.exception.SystemException {
274                    try {
275                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
276                                            "getGroupThreadsCount", long.class, long.class, int.class,
277                                            boolean.class, boolean.class);
278    
279                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
280                                            userId, status, subscribed, includeAnonymous);
281    
282                            Object returnObj = null;
283    
284                            try {
285                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
286                            }
287                            catch (Exception e) {
288                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
289                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
290                                    }
291    
292                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
293                            }
294    
295                            return ((Integer)returnObj).intValue();
296                    }
297                    catch (com.liferay.portal.kernel.exception.SystemException se) {
298                            _log.error(se, se);
299    
300                            throw se;
301                    }
302            }
303    
304            public static java.util.List<com.liferay.portlet.messageboards.model.MBThread> getThreads(
305                    HttpPrincipal httpPrincipal, long groupId, long categoryId, int status,
306                    int start, int end)
307                    throws com.liferay.portal.kernel.exception.SystemException {
308                    try {
309                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
310                                            "getThreads", long.class, long.class, int.class, int.class,
311                                            int.class);
312    
313                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
314                                            categoryId, status, start, end);
315    
316                            Object returnObj = null;
317    
318                            try {
319                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
320                            }
321                            catch (Exception e) {
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                            return (java.util.List<com.liferay.portlet.messageboards.model.MBThread>)returnObj;
330                    }
331                    catch (com.liferay.portal.kernel.exception.SystemException se) {
332                            _log.error(se, se);
333    
334                            throw se;
335                    }
336            }
337    
338            public static int getThreadsCount(HttpPrincipal httpPrincipal,
339                    long groupId, long categoryId, int status)
340                    throws com.liferay.portal.kernel.exception.SystemException {
341                    try {
342                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
343                                            "getThreadsCount", long.class, long.class, int.class);
344    
345                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
346                                            categoryId, status);
347    
348                            Object returnObj = null;
349    
350                            try {
351                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
352                            }
353                            catch (Exception e) {
354                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
355                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
356                                    }
357    
358                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
359                            }
360    
361                            return ((Integer)returnObj).intValue();
362                    }
363                    catch (com.liferay.portal.kernel.exception.SystemException se) {
364                            _log.error(se, se);
365    
366                            throw se;
367                    }
368            }
369    
370            public static com.liferay.portal.model.Lock lockThread(
371                    HttpPrincipal httpPrincipal, long threadId)
372                    throws com.liferay.portal.kernel.exception.PortalException,
373                            com.liferay.portal.kernel.exception.SystemException {
374                    try {
375                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
376                                            "lockThread", long.class);
377    
378                            MethodHandler methodHandler = new MethodHandler(methodKey, threadId);
379    
380                            Object returnObj = null;
381    
382                            try {
383                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
384                            }
385                            catch (Exception e) {
386                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
387                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
388                                    }
389    
390                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
391                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
392                                    }
393    
394                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
395                            }
396    
397                            return (com.liferay.portal.model.Lock)returnObj;
398                    }
399                    catch (com.liferay.portal.kernel.exception.SystemException se) {
400                            _log.error(se, se);
401    
402                            throw se;
403                    }
404            }
405    
406            public static com.liferay.portlet.messageboards.model.MBThread moveThread(
407                    HttpPrincipal httpPrincipal, long categoryId, long threadId)
408                    throws com.liferay.portal.kernel.exception.PortalException,
409                            com.liferay.portal.kernel.exception.SystemException {
410                    try {
411                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
412                                            "moveThread", long.class, long.class);
413    
414                            MethodHandler methodHandler = new MethodHandler(methodKey,
415                                            categoryId, threadId);
416    
417                            Object returnObj = null;
418    
419                            try {
420                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
421                            }
422                            catch (Exception e) {
423                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
424                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
425                                    }
426    
427                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
428                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
429                                    }
430    
431                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
432                            }
433    
434                            return (com.liferay.portlet.messageboards.model.MBThread)returnObj;
435                    }
436                    catch (com.liferay.portal.kernel.exception.SystemException se) {
437                            _log.error(se, se);
438    
439                            throw se;
440                    }
441            }
442    
443            public static com.liferay.portlet.messageboards.model.MBThread splitThread(
444                    HttpPrincipal httpPrincipal, long messageId,
445                    com.liferay.portal.service.ServiceContext serviceContext)
446                    throws com.liferay.portal.kernel.exception.PortalException,
447                            com.liferay.portal.kernel.exception.SystemException {
448                    try {
449                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
450                                            "splitThread", long.class,
451                                            com.liferay.portal.service.ServiceContext.class);
452    
453                            MethodHandler methodHandler = new MethodHandler(methodKey,
454                                            messageId, serviceContext);
455    
456                            Object returnObj = null;
457    
458                            try {
459                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
460                            }
461                            catch (Exception e) {
462                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
463                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
464                                    }
465    
466                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
467                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
468                                    }
469    
470                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
471                            }
472    
473                            return (com.liferay.portlet.messageboards.model.MBThread)returnObj;
474                    }
475                    catch (com.liferay.portal.kernel.exception.SystemException se) {
476                            _log.error(se, se);
477    
478                            throw se;
479                    }
480            }
481    
482            public static void unlockThread(HttpPrincipal httpPrincipal, long threadId)
483                    throws com.liferay.portal.kernel.exception.PortalException,
484                            com.liferay.portal.kernel.exception.SystemException {
485                    try {
486                            MethodKey methodKey = new MethodKey(MBThreadServiceUtil.class.getName(),
487                                            "unlockThread", long.class);
488    
489                            MethodHandler methodHandler = new MethodHandler(methodKey, threadId);
490    
491                            try {
492                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
493                            }
494                            catch (Exception e) {
495                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
496                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
497                                    }
498    
499                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
500                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
501                                    }
502    
503                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
504                            }
505                    }
506                    catch (com.liferay.portal.kernel.exception.SystemException se) {
507                            _log.error(se, se);
508    
509                            throw se;
510                    }
511            }
512    
513            private static Log _log = LogFactoryUtil.getLog(MBThreadServiceHttp.class);
514    }