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