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.MBCategoryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.messageboards.service.MBCategoryServiceUtil} 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       MBCategoryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.messageboards.service.MBCategoryServiceUtil
054     * @generated
055     */
056    public class MBCategoryServiceHttp {
057            public static com.liferay.portlet.messageboards.model.MBCategory addCategory(
058                    HttpPrincipal httpPrincipal, long parentCategoryId,
059                    java.lang.String name, java.lang.String description,
060                    java.lang.String emailAddress, java.lang.String inProtocol,
061                    java.lang.String inServerName, int inServerPort, boolean inUseSSL,
062                    java.lang.String inUserName, java.lang.String inPassword,
063                    int inReadInterval, java.lang.String outEmailAddress,
064                    boolean outCustom, java.lang.String outServerName, int outServerPort,
065                    boolean outUseSSL, java.lang.String outUserName,
066                    java.lang.String outPassword, boolean mailingListActive,
067                    com.liferay.portal.service.ServiceContext serviceContext)
068                    throws com.liferay.portal.kernel.exception.PortalException,
069                            com.liferay.portal.kernel.exception.SystemException {
070                    try {
071                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
072                                            "addCategory", long.class, java.lang.String.class,
073                                            java.lang.String.class, java.lang.String.class,
074                                            java.lang.String.class, java.lang.String.class, int.class,
075                                            boolean.class, java.lang.String.class,
076                                            java.lang.String.class, int.class, java.lang.String.class,
077                                            boolean.class, java.lang.String.class, int.class,
078                                            boolean.class, java.lang.String.class,
079                                            java.lang.String.class, boolean.class,
080                                            com.liferay.portal.service.ServiceContext.class);
081    
082                            MethodHandler methodHandler = new MethodHandler(methodKey,
083                                            parentCategoryId, name, description, emailAddress,
084                                            inProtocol, inServerName, inServerPort, inUseSSL,
085                                            inUserName, inPassword, inReadInterval, outEmailAddress,
086                                            outCustom, outServerName, outServerPort, outUseSSL,
087                                            outUserName, outPassword, mailingListActive, serviceContext);
088    
089                            Object returnObj = null;
090    
091                            try {
092                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
093                            }
094                            catch (Exception e) {
095                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
096                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
097                                    }
098    
099                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
100                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
101                                    }
102    
103                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
104                            }
105    
106                            return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
107                    }
108                    catch (com.liferay.portal.kernel.exception.SystemException se) {
109                            _log.error(se, se);
110    
111                            throw se;
112                    }
113            }
114    
115            public static void deleteCategory(HttpPrincipal httpPrincipal,
116                    long groupId, long categoryId)
117                    throws com.liferay.portal.kernel.exception.PortalException,
118                            com.liferay.portal.kernel.exception.SystemException {
119                    try {
120                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
121                                            "deleteCategory", long.class, long.class);
122    
123                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
124                                            categoryId);
125    
126                            try {
127                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
128                            }
129                            catch (Exception e) {
130                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
131                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
132                                    }
133    
134                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
135                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
136                                    }
137    
138                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
139                            }
140                    }
141                    catch (com.liferay.portal.kernel.exception.SystemException se) {
142                            _log.error(se, se);
143    
144                            throw se;
145                    }
146            }
147    
148            public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getCategories(
149                    HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
150                    int start, int end)
151                    throws com.liferay.portal.kernel.exception.SystemException {
152                    try {
153                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
154                                            "getCategories", long.class, long.class, int.class,
155                                            int.class);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
158                                            parentCategoryId, start, end);
159    
160                            Object returnObj = null;
161    
162                            try {
163                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
164                            }
165                            catch (Exception e) {
166                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
167                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
168                                    }
169    
170                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
171                            }
172    
173                            return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
174                    }
175                    catch (com.liferay.portal.kernel.exception.SystemException se) {
176                            _log.error(se, se);
177    
178                            throw se;
179                    }
180            }
181    
182            public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getCategories(
183                    HttpPrincipal httpPrincipal, long groupId, long[] parentCategoryIds,
184                    int start, int end)
185                    throws com.liferay.portal.kernel.exception.SystemException {
186                    try {
187                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
188                                            "getCategories", long.class, long[].class, int.class,
189                                            int.class);
190    
191                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
192                                            parentCategoryIds, start, end);
193    
194                            Object returnObj = null;
195    
196                            try {
197                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
198                            }
199                            catch (Exception e) {
200                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
202                                    }
203    
204                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
205                            }
206    
207                            return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
208                    }
209                    catch (com.liferay.portal.kernel.exception.SystemException se) {
210                            _log.error(se, se);
211    
212                            throw se;
213                    }
214            }
215    
216            public static int getCategoriesCount(HttpPrincipal httpPrincipal,
217                    long groupId, long parentCategoryId)
218                    throws com.liferay.portal.kernel.exception.SystemException {
219                    try {
220                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
221                                            "getCategoriesCount", long.class, long.class);
222    
223                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
224                                            parentCategoryId);
225    
226                            Object returnObj = null;
227    
228                            try {
229                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
230                            }
231                            catch (Exception e) {
232                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
233                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
234                                    }
235    
236                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
237                            }
238    
239                            return ((Integer)returnObj).intValue();
240                    }
241                    catch (com.liferay.portal.kernel.exception.SystemException se) {
242                            _log.error(se, se);
243    
244                            throw se;
245                    }
246            }
247    
248            public static int getCategoriesCount(HttpPrincipal httpPrincipal,
249                    long groupId, long[] parentCategoryIds)
250                    throws com.liferay.portal.kernel.exception.SystemException {
251                    try {
252                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
253                                            "getCategoriesCount", long.class, long[].class);
254    
255                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
256                                            parentCategoryIds);
257    
258                            Object returnObj = null;
259    
260                            try {
261                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
262                            }
263                            catch (Exception e) {
264                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
265                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
266                                    }
267    
268                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
269                            }
270    
271                            return ((Integer)returnObj).intValue();
272                    }
273                    catch (com.liferay.portal.kernel.exception.SystemException se) {
274                            _log.error(se, se);
275    
276                            throw se;
277                    }
278            }
279    
280            public static com.liferay.portlet.messageboards.model.MBCategory getCategory(
281                    HttpPrincipal httpPrincipal, long categoryId)
282                    throws com.liferay.portal.kernel.exception.PortalException,
283                            com.liferay.portal.kernel.exception.SystemException {
284                    try {
285                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
286                                            "getCategory", long.class);
287    
288                            MethodHandler methodHandler = new MethodHandler(methodKey,
289                                            categoryId);
290    
291                            Object returnObj = null;
292    
293                            try {
294                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
295                            }
296                            catch (Exception e) {
297                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
298                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
299                                    }
300    
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 (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
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 long[] getCategoryIds(HttpPrincipal httpPrincipal,
318                    long groupId, long categoryId)
319                    throws com.liferay.portal.kernel.exception.SystemException {
320                    try {
321                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
322                                            "getCategoryIds", long.class, long.class);
323    
324                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
325                                            categoryId);
326    
327                            Object returnObj = null;
328    
329                            try {
330                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
331                            }
332                            catch (Exception e) {
333                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
334                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
335                                    }
336    
337                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
338                            }
339    
340                            return (long[])returnObj;
341                    }
342                    catch (com.liferay.portal.kernel.exception.SystemException se) {
343                            _log.error(se, se);
344    
345                            throw se;
346                    }
347            }
348    
349            public static java.util.List<java.lang.Long> getSubcategoryIds(
350                    HttpPrincipal httpPrincipal,
351                    java.util.List<java.lang.Long> categoryIds, long groupId,
352                    long categoryId)
353                    throws com.liferay.portal.kernel.exception.SystemException {
354                    try {
355                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
356                                            "getSubcategoryIds", java.util.List.class, long.class,
357                                            long.class);
358    
359                            MethodHandler methodHandler = new MethodHandler(methodKey,
360                                            categoryIds, groupId, categoryId);
361    
362                            Object returnObj = null;
363    
364                            try {
365                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
366                            }
367                            catch (Exception e) {
368                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
369                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
370                                    }
371    
372                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
373                            }
374    
375                            return (java.util.List<java.lang.Long>)returnObj;
376                    }
377                    catch (com.liferay.portal.kernel.exception.SystemException se) {
378                            _log.error(se, se);
379    
380                            throw se;
381                    }
382            }
383    
384            public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getSubscribedCategories(
385                    HttpPrincipal httpPrincipal, long groupId, long userId, int start,
386                    int end) throws com.liferay.portal.kernel.exception.SystemException {
387                    try {
388                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
389                                            "getSubscribedCategories", long.class, long.class,
390                                            int.class, int.class);
391    
392                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
393                                            userId, start, end);
394    
395                            Object returnObj = null;
396    
397                            try {
398                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
399                            }
400                            catch (Exception e) {
401                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
402                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
403                                    }
404    
405                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
406                            }
407    
408                            return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
409                    }
410                    catch (com.liferay.portal.kernel.exception.SystemException se) {
411                            _log.error(se, se);
412    
413                            throw se;
414                    }
415            }
416    
417            public static int getSubscribedCategoriesCount(
418                    HttpPrincipal httpPrincipal, long groupId, long userId)
419                    throws com.liferay.portal.kernel.exception.SystemException {
420                    try {
421                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
422                                            "getSubscribedCategoriesCount", long.class, long.class);
423    
424                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
425                                            userId);
426    
427                            Object returnObj = null;
428    
429                            try {
430                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
431                            }
432                            catch (Exception e) {
433                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
434                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
435                                    }
436    
437                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
438                            }
439    
440                            return ((Integer)returnObj).intValue();
441                    }
442                    catch (com.liferay.portal.kernel.exception.SystemException se) {
443                            _log.error(se, se);
444    
445                            throw se;
446                    }
447            }
448    
449            public static void subscribeCategory(HttpPrincipal httpPrincipal,
450                    long groupId, long categoryId)
451                    throws com.liferay.portal.kernel.exception.PortalException,
452                            com.liferay.portal.kernel.exception.SystemException {
453                    try {
454                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
455                                            "subscribeCategory", long.class, long.class);
456    
457                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
458                                            categoryId);
459    
460                            try {
461                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
462                            }
463                            catch (Exception e) {
464                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
465                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
466                                    }
467    
468                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
469                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
470                                    }
471    
472                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
473                            }
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 unsubscribeCategory(HttpPrincipal httpPrincipal,
483                    long groupId, long categoryId)
484                    throws com.liferay.portal.kernel.exception.PortalException,
485                            com.liferay.portal.kernel.exception.SystemException {
486                    try {
487                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
488                                            "unsubscribeCategory", long.class, long.class);
489    
490                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
491                                            categoryId);
492    
493                            try {
494                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
495                            }
496                            catch (Exception e) {
497                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
498                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
499                                    }
500    
501                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
502                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
503                                    }
504    
505                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
506                            }
507                    }
508                    catch (com.liferay.portal.kernel.exception.SystemException se) {
509                            _log.error(se, se);
510    
511                            throw se;
512                    }
513            }
514    
515            public static com.liferay.portlet.messageboards.model.MBCategory updateCategory(
516                    HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
517                    java.lang.String name, java.lang.String description,
518                    java.lang.String emailAddress, java.lang.String inProtocol,
519                    java.lang.String inServerName, int inServerPort, boolean inUseSSL,
520                    java.lang.String inUserName, java.lang.String inPassword,
521                    int inReadInterval, java.lang.String outEmailAddress,
522                    boolean outCustom, java.lang.String outServerName, int outServerPort,
523                    boolean outUseSSL, java.lang.String outUserName,
524                    java.lang.String outPassword, boolean mailingListActive,
525                    boolean mergeWithParentCategory,
526                    com.liferay.portal.service.ServiceContext serviceContext)
527                    throws com.liferay.portal.kernel.exception.PortalException,
528                            com.liferay.portal.kernel.exception.SystemException {
529                    try {
530                            MethodKey methodKey = new MethodKey(MBCategoryServiceUtil.class.getName(),
531                                            "updateCategory", long.class, long.class,
532                                            java.lang.String.class, java.lang.String.class,
533                                            java.lang.String.class, java.lang.String.class,
534                                            java.lang.String.class, int.class, boolean.class,
535                                            java.lang.String.class, java.lang.String.class, int.class,
536                                            java.lang.String.class, boolean.class,
537                                            java.lang.String.class, int.class, boolean.class,
538                                            java.lang.String.class, java.lang.String.class,
539                                            boolean.class, boolean.class,
540                                            com.liferay.portal.service.ServiceContext.class);
541    
542                            MethodHandler methodHandler = new MethodHandler(methodKey,
543                                            categoryId, parentCategoryId, name, description,
544                                            emailAddress, inProtocol, inServerName, inServerPort,
545                                            inUseSSL, inUserName, inPassword, inReadInterval,
546                                            outEmailAddress, outCustom, outServerName, outServerPort,
547                                            outUseSSL, outUserName, outPassword, mailingListActive,
548                                            mergeWithParentCategory, serviceContext);
549    
550                            Object returnObj = null;
551    
552                            try {
553                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
554                            }
555                            catch (Exception e) {
556                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
557                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
558                                    }
559    
560                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
561                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
562                                    }
563    
564                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
565                            }
566    
567                            return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
568                    }
569                    catch (com.liferay.portal.kernel.exception.SystemException se) {
570                            _log.error(se, se);
571    
572                            throw se;
573                    }
574            }
575    
576            private static Log _log = LogFactoryUtil.getLog(MBCategoryServiceHttp.class);
577    }