1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.messageboards.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.http.TunnelUtil;
26  
27  import com.liferay.portlet.messageboards.service.MBCategoryServiceUtil;
28  
29  /**
30   * <a href="MBCategoryServiceHttp.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a HTTP utility for the
39   * {@link com.liferay.portlet.messageboards.service.MBCategoryServiceUtil} service utility. The
40   * static methods of this class calls the same methods of the service utility.
41   * However, the signatures are different because it requires an additional
42   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
43   * </p>
44   *
45   * <p>
46   * The benefits of using the HTTP utility is that it is fast and allows for
47   * tunneling without the cost of serializing to text. The drawback is that it
48   * only works with Java.
49   * </p>
50   *
51   * <p>
52   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
53   * configure security.
54   * </p>
55   *
56   * <p>
57   * The HTTP utility is only generated for remote services.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       MBCategoryServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.messageboards.service.MBCategoryServiceUtil
64   * @generated
65   */
66  public class MBCategoryServiceHttp {
67      public static com.liferay.portlet.messageboards.model.MBCategory addCategory(
68          HttpPrincipal httpPrincipal, long parentCategoryId,
69          java.lang.String name, java.lang.String description,
70          java.lang.String emailAddress, java.lang.String inProtocol,
71          java.lang.String inServerName, int inServerPort, boolean inUseSSL,
72          java.lang.String inUserName, java.lang.String inPassword,
73          int inReadInterval, java.lang.String outEmailAddress,
74          boolean outCustom, java.lang.String outServerName, int outServerPort,
75          boolean outUseSSL, java.lang.String outUserName,
76          java.lang.String outPassword, boolean mailingListActive,
77          com.liferay.portal.service.ServiceContext serviceContext)
78          throws com.liferay.portal.kernel.exception.PortalException,
79              com.liferay.portal.kernel.exception.SystemException {
80          try {
81              Object paramObj0 = new LongWrapper(parentCategoryId);
82  
83              Object paramObj1 = name;
84  
85              if (name == null) {
86                  paramObj1 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj2 = description;
90  
91              if (description == null) {
92                  paramObj2 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj3 = emailAddress;
96  
97              if (emailAddress == null) {
98                  paramObj3 = new NullWrapper("java.lang.String");
99              }
100 
101             Object paramObj4 = inProtocol;
102 
103             if (inProtocol == null) {
104                 paramObj4 = new NullWrapper("java.lang.String");
105             }
106 
107             Object paramObj5 = inServerName;
108 
109             if (inServerName == null) {
110                 paramObj5 = new NullWrapper("java.lang.String");
111             }
112 
113             Object paramObj6 = new IntegerWrapper(inServerPort);
114 
115             Object paramObj7 = new BooleanWrapper(inUseSSL);
116 
117             Object paramObj8 = inUserName;
118 
119             if (inUserName == null) {
120                 paramObj8 = new NullWrapper("java.lang.String");
121             }
122 
123             Object paramObj9 = inPassword;
124 
125             if (inPassword == null) {
126                 paramObj9 = new NullWrapper("java.lang.String");
127             }
128 
129             Object paramObj10 = new IntegerWrapper(inReadInterval);
130 
131             Object paramObj11 = outEmailAddress;
132 
133             if (outEmailAddress == null) {
134                 paramObj11 = new NullWrapper("java.lang.String");
135             }
136 
137             Object paramObj12 = new BooleanWrapper(outCustom);
138 
139             Object paramObj13 = outServerName;
140 
141             if (outServerName == null) {
142                 paramObj13 = new NullWrapper("java.lang.String");
143             }
144 
145             Object paramObj14 = new IntegerWrapper(outServerPort);
146 
147             Object paramObj15 = new BooleanWrapper(outUseSSL);
148 
149             Object paramObj16 = outUserName;
150 
151             if (outUserName == null) {
152                 paramObj16 = new NullWrapper("java.lang.String");
153             }
154 
155             Object paramObj17 = outPassword;
156 
157             if (outPassword == null) {
158                 paramObj17 = new NullWrapper("java.lang.String");
159             }
160 
161             Object paramObj18 = new BooleanWrapper(mailingListActive);
162 
163             Object paramObj19 = serviceContext;
164 
165             if (serviceContext == null) {
166                 paramObj19 = new NullWrapper(
167                         "com.liferay.portal.service.ServiceContext");
168             }
169 
170             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
171                     "addCategory",
172                     new Object[] {
173                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
174                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
175                         paramObj10, paramObj11, paramObj12, paramObj13,
176                         paramObj14, paramObj15, paramObj16, paramObj17,
177                         paramObj18, paramObj19
178                     });
179 
180             Object returnObj = null;
181 
182             try {
183                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
184             }
185             catch (Exception e) {
186                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
187                     throw (com.liferay.portal.kernel.exception.PortalException)e;
188                 }
189 
190                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
191                     throw (com.liferay.portal.kernel.exception.SystemException)e;
192                 }
193 
194                 throw new com.liferay.portal.kernel.exception.SystemException(e);
195             }
196 
197             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
198         }
199         catch (com.liferay.portal.kernel.exception.SystemException se) {
200             _log.error(se, se);
201 
202             throw se;
203         }
204     }
205 
206     public static void deleteCategory(HttpPrincipal httpPrincipal,
207         long groupId, long categoryId)
208         throws com.liferay.portal.kernel.exception.PortalException,
209             com.liferay.portal.kernel.exception.SystemException {
210         try {
211             Object paramObj0 = new LongWrapper(groupId);
212 
213             Object paramObj1 = new LongWrapper(categoryId);
214 
215             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
216                     "deleteCategory", new Object[] { paramObj0, paramObj1 });
217 
218             try {
219                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
220             }
221             catch (Exception e) {
222                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
223                     throw (com.liferay.portal.kernel.exception.PortalException)e;
224                 }
225 
226                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                     throw (com.liferay.portal.kernel.exception.SystemException)e;
228                 }
229 
230                 throw new com.liferay.portal.kernel.exception.SystemException(e);
231             }
232         }
233         catch (com.liferay.portal.kernel.exception.SystemException se) {
234             _log.error(se, se);
235 
236             throw se;
237         }
238     }
239 
240     public static com.liferay.portlet.messageboards.model.MBCategory getCategory(
241         HttpPrincipal httpPrincipal, long categoryId)
242         throws com.liferay.portal.kernel.exception.PortalException,
243             com.liferay.portal.kernel.exception.SystemException {
244         try {
245             Object paramObj0 = new LongWrapper(categoryId);
246 
247             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
248                     "getCategory", new Object[] { paramObj0 });
249 
250             Object returnObj = null;
251 
252             try {
253                 returnObj = 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             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
268         }
269         catch (com.liferay.portal.kernel.exception.SystemException se) {
270             _log.error(se, se);
271 
272             throw se;
273         }
274     }
275 
276     public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getCategories(
277         HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
278         int start, int end)
279         throws com.liferay.portal.kernel.exception.SystemException {
280         try {
281             Object paramObj0 = new LongWrapper(groupId);
282 
283             Object paramObj1 = new LongWrapper(parentCategoryId);
284 
285             Object paramObj2 = new IntegerWrapper(start);
286 
287             Object paramObj3 = new IntegerWrapper(end);
288 
289             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
290                     "getCategories",
291                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
292 
293             Object returnObj = null;
294 
295             try {
296                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
297             }
298             catch (Exception e) {
299                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
300                     throw (com.liferay.portal.kernel.exception.SystemException)e;
301                 }
302 
303                 throw new com.liferay.portal.kernel.exception.SystemException(e);
304             }
305 
306             return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
307         }
308         catch (com.liferay.portal.kernel.exception.SystemException se) {
309             _log.error(se, se);
310 
311             throw se;
312         }
313     }
314 
315     public static int getCategoriesCount(HttpPrincipal httpPrincipal,
316         long groupId, long parentCategoryId)
317         throws com.liferay.portal.kernel.exception.SystemException {
318         try {
319             Object paramObj0 = new LongWrapper(groupId);
320 
321             Object paramObj1 = new LongWrapper(parentCategoryId);
322 
323             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
324                     "getCategoriesCount", new Object[] { paramObj0, paramObj1 });
325 
326             Object returnObj = null;
327 
328             try {
329                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
330             }
331             catch (Exception e) {
332                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
333                     throw (com.liferay.portal.kernel.exception.SystemException)e;
334                 }
335 
336                 throw new com.liferay.portal.kernel.exception.SystemException(e);
337             }
338 
339             return ((Integer)returnObj).intValue();
340         }
341         catch (com.liferay.portal.kernel.exception.SystemException se) {
342             _log.error(se, se);
343 
344             throw se;
345         }
346     }
347 
348     public static java.util.List<java.lang.Long> getSubcategoryIds(
349         HttpPrincipal httpPrincipal,
350         java.util.List<java.lang.Long> categoryIds, long groupId,
351         long categoryId)
352         throws com.liferay.portal.kernel.exception.SystemException {
353         try {
354             Object paramObj0 = categoryIds;
355 
356             if (categoryIds == null) {
357                 paramObj0 = new NullWrapper("java.util.List");
358             }
359 
360             Object paramObj1 = new LongWrapper(groupId);
361 
362             Object paramObj2 = new LongWrapper(categoryId);
363 
364             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
365                     "getSubcategoryIds",
366                     new Object[] { paramObj0, paramObj1, paramObj2 });
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.SystemException) {
375                     throw (com.liferay.portal.kernel.exception.SystemException)e;
376                 }
377 
378                 throw new com.liferay.portal.kernel.exception.SystemException(e);
379             }
380 
381             return (java.util.List<java.lang.Long>)returnObj;
382         }
383         catch (com.liferay.portal.kernel.exception.SystemException se) {
384             _log.error(se, se);
385 
386             throw se;
387         }
388     }
389 
390     public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getSubscribedCategories(
391         HttpPrincipal httpPrincipal, long groupId, long userId, int start,
392         int end) throws com.liferay.portal.kernel.exception.SystemException {
393         try {
394             Object paramObj0 = new LongWrapper(groupId);
395 
396             Object paramObj1 = new LongWrapper(userId);
397 
398             Object paramObj2 = new IntegerWrapper(start);
399 
400             Object paramObj3 = new IntegerWrapper(end);
401 
402             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
403                     "getSubscribedCategories",
404                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
405 
406             Object returnObj = null;
407 
408             try {
409                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
410             }
411             catch (Exception e) {
412                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
413                     throw (com.liferay.portal.kernel.exception.SystemException)e;
414                 }
415 
416                 throw new com.liferay.portal.kernel.exception.SystemException(e);
417             }
418 
419             return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
420         }
421         catch (com.liferay.portal.kernel.exception.SystemException se) {
422             _log.error(se, se);
423 
424             throw se;
425         }
426     }
427 
428     public static int getSubscribedCategoriesCount(
429         HttpPrincipal httpPrincipal, long groupId, long userId)
430         throws com.liferay.portal.kernel.exception.SystemException {
431         try {
432             Object paramObj0 = new LongWrapper(groupId);
433 
434             Object paramObj1 = new LongWrapper(userId);
435 
436             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
437                     "getSubscribedCategoriesCount",
438                     new Object[] { paramObj0, paramObj1 });
439 
440             Object returnObj = null;
441 
442             try {
443                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
444             }
445             catch (Exception e) {
446                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
447                     throw (com.liferay.portal.kernel.exception.SystemException)e;
448                 }
449 
450                 throw new com.liferay.portal.kernel.exception.SystemException(e);
451             }
452 
453             return ((Integer)returnObj).intValue();
454         }
455         catch (com.liferay.portal.kernel.exception.SystemException se) {
456             _log.error(se, se);
457 
458             throw se;
459         }
460     }
461 
462     public static void subscribeCategory(HttpPrincipal httpPrincipal,
463         long groupId, long categoryId)
464         throws com.liferay.portal.kernel.exception.PortalException,
465             com.liferay.portal.kernel.exception.SystemException {
466         try {
467             Object paramObj0 = new LongWrapper(groupId);
468 
469             Object paramObj1 = new LongWrapper(categoryId);
470 
471             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
472                     "subscribeCategory", new Object[] { paramObj0, paramObj1 });
473 
474             try {
475                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
476             }
477             catch (Exception e) {
478                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
479                     throw (com.liferay.portal.kernel.exception.PortalException)e;
480                 }
481 
482                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
483                     throw (com.liferay.portal.kernel.exception.SystemException)e;
484                 }
485 
486                 throw new com.liferay.portal.kernel.exception.SystemException(e);
487             }
488         }
489         catch (com.liferay.portal.kernel.exception.SystemException se) {
490             _log.error(se, se);
491 
492             throw se;
493         }
494     }
495 
496     public static void unsubscribeCategory(HttpPrincipal httpPrincipal,
497         long groupId, long categoryId)
498         throws com.liferay.portal.kernel.exception.PortalException,
499             com.liferay.portal.kernel.exception.SystemException {
500         try {
501             Object paramObj0 = new LongWrapper(groupId);
502 
503             Object paramObj1 = new LongWrapper(categoryId);
504 
505             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
506                     "unsubscribeCategory", new Object[] { paramObj0, paramObj1 });
507 
508             try {
509                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
510             }
511             catch (Exception e) {
512                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
513                     throw (com.liferay.portal.kernel.exception.PortalException)e;
514                 }
515 
516                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
517                     throw (com.liferay.portal.kernel.exception.SystemException)e;
518                 }
519 
520                 throw new com.liferay.portal.kernel.exception.SystemException(e);
521             }
522         }
523         catch (com.liferay.portal.kernel.exception.SystemException se) {
524             _log.error(se, se);
525 
526             throw se;
527         }
528     }
529 
530     public static com.liferay.portlet.messageboards.model.MBCategory updateCategory(
531         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
532         java.lang.String name, java.lang.String description,
533         java.lang.String emailAddress, java.lang.String inProtocol,
534         java.lang.String inServerName, int inServerPort, boolean inUseSSL,
535         java.lang.String inUserName, java.lang.String inPassword,
536         int inReadInterval, java.lang.String outEmailAddress,
537         boolean outCustom, java.lang.String outServerName, int outServerPort,
538         boolean outUseSSL, java.lang.String outUserName,
539         java.lang.String outPassword, boolean mailingListActive,
540         boolean mergeWithParentCategory,
541         com.liferay.portal.service.ServiceContext serviceContext)
542         throws com.liferay.portal.kernel.exception.PortalException,
543             com.liferay.portal.kernel.exception.SystemException {
544         try {
545             Object paramObj0 = new LongWrapper(categoryId);
546 
547             Object paramObj1 = new LongWrapper(parentCategoryId);
548 
549             Object paramObj2 = name;
550 
551             if (name == null) {
552                 paramObj2 = new NullWrapper("java.lang.String");
553             }
554 
555             Object paramObj3 = description;
556 
557             if (description == null) {
558                 paramObj3 = new NullWrapper("java.lang.String");
559             }
560 
561             Object paramObj4 = emailAddress;
562 
563             if (emailAddress == null) {
564                 paramObj4 = new NullWrapper("java.lang.String");
565             }
566 
567             Object paramObj5 = inProtocol;
568 
569             if (inProtocol == null) {
570                 paramObj5 = new NullWrapper("java.lang.String");
571             }
572 
573             Object paramObj6 = inServerName;
574 
575             if (inServerName == null) {
576                 paramObj6 = new NullWrapper("java.lang.String");
577             }
578 
579             Object paramObj7 = new IntegerWrapper(inServerPort);
580 
581             Object paramObj8 = new BooleanWrapper(inUseSSL);
582 
583             Object paramObj9 = inUserName;
584 
585             if (inUserName == null) {
586                 paramObj9 = new NullWrapper("java.lang.String");
587             }
588 
589             Object paramObj10 = inPassword;
590 
591             if (inPassword == null) {
592                 paramObj10 = new NullWrapper("java.lang.String");
593             }
594 
595             Object paramObj11 = new IntegerWrapper(inReadInterval);
596 
597             Object paramObj12 = outEmailAddress;
598 
599             if (outEmailAddress == null) {
600                 paramObj12 = new NullWrapper("java.lang.String");
601             }
602 
603             Object paramObj13 = new BooleanWrapper(outCustom);
604 
605             Object paramObj14 = outServerName;
606 
607             if (outServerName == null) {
608                 paramObj14 = new NullWrapper("java.lang.String");
609             }
610 
611             Object paramObj15 = new IntegerWrapper(outServerPort);
612 
613             Object paramObj16 = new BooleanWrapper(outUseSSL);
614 
615             Object paramObj17 = outUserName;
616 
617             if (outUserName == null) {
618                 paramObj17 = new NullWrapper("java.lang.String");
619             }
620 
621             Object paramObj18 = outPassword;
622 
623             if (outPassword == null) {
624                 paramObj18 = new NullWrapper("java.lang.String");
625             }
626 
627             Object paramObj19 = new BooleanWrapper(mailingListActive);
628 
629             Object paramObj20 = new BooleanWrapper(mergeWithParentCategory);
630 
631             Object paramObj21 = serviceContext;
632 
633             if (serviceContext == null) {
634                 paramObj21 = new NullWrapper(
635                         "com.liferay.portal.service.ServiceContext");
636             }
637 
638             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
639                     "updateCategory",
640                     new Object[] {
641                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
642                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
643                         paramObj10, paramObj11, paramObj12, paramObj13,
644                         paramObj14, paramObj15, paramObj16, paramObj17,
645                         paramObj18, paramObj19, paramObj20, paramObj21
646                     });
647 
648             Object returnObj = null;
649 
650             try {
651                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
652             }
653             catch (Exception e) {
654                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
655                     throw (com.liferay.portal.kernel.exception.PortalException)e;
656                 }
657 
658                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
659                     throw (com.liferay.portal.kernel.exception.SystemException)e;
660                 }
661 
662                 throw new com.liferay.portal.kernel.exception.SystemException(e);
663             }
664 
665             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
666         }
667         catch (com.liferay.portal.kernel.exception.SystemException se) {
668             _log.error(se, se);
669 
670             throw se;
671         }
672     }
673 
674     private static Log _log = LogFactoryUtil.getLog(MBCategoryServiceHttp.class);
675 }