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.PortalException,
280             com.liferay.portal.kernel.exception.SystemException {
281         try {
282             Object paramObj0 = new LongWrapper(groupId);
283 
284             Object paramObj1 = new LongWrapper(parentCategoryId);
285 
286             Object paramObj2 = new IntegerWrapper(start);
287 
288             Object paramObj3 = new IntegerWrapper(end);
289 
290             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
291                     "getCategories",
292                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
293 
294             Object returnObj = null;
295 
296             try {
297                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
298             }
299             catch (Exception e) {
300                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
301                     throw (com.liferay.portal.kernel.exception.PortalException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
305                     throw (com.liferay.portal.kernel.exception.SystemException)e;
306                 }
307 
308                 throw new com.liferay.portal.kernel.exception.SystemException(e);
309             }
310 
311             return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
312         }
313         catch (com.liferay.portal.kernel.exception.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     public static int getCategoriesCount(HttpPrincipal httpPrincipal,
321         long groupId, long parentCategoryId)
322         throws com.liferay.portal.kernel.exception.SystemException {
323         try {
324             Object paramObj0 = new LongWrapper(groupId);
325 
326             Object paramObj1 = new LongWrapper(parentCategoryId);
327 
328             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
329                     "getCategoriesCount", new Object[] { paramObj0, paramObj1 });
330 
331             Object returnObj = null;
332 
333             try {
334                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
335             }
336             catch (Exception e) {
337                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
338                     throw (com.liferay.portal.kernel.exception.SystemException)e;
339                 }
340 
341                 throw new com.liferay.portal.kernel.exception.SystemException(e);
342             }
343 
344             return ((Integer)returnObj).intValue();
345         }
346         catch (com.liferay.portal.kernel.exception.SystemException se) {
347             _log.error(se, se);
348 
349             throw se;
350         }
351     }
352 
353     public static void subscribeCategory(HttpPrincipal httpPrincipal,
354         long groupId, long categoryId)
355         throws com.liferay.portal.kernel.exception.PortalException,
356             com.liferay.portal.kernel.exception.SystemException {
357         try {
358             Object paramObj0 = new LongWrapper(groupId);
359 
360             Object paramObj1 = new LongWrapper(categoryId);
361 
362             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
363                     "subscribeCategory", new Object[] { paramObj0, paramObj1 });
364 
365             try {
366                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
367             }
368             catch (Exception e) {
369                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
370                     throw (com.liferay.portal.kernel.exception.PortalException)e;
371                 }
372 
373                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
374                     throw (com.liferay.portal.kernel.exception.SystemException)e;
375                 }
376 
377                 throw new com.liferay.portal.kernel.exception.SystemException(e);
378             }
379         }
380         catch (com.liferay.portal.kernel.exception.SystemException se) {
381             _log.error(se, se);
382 
383             throw se;
384         }
385     }
386 
387     public static void unsubscribeCategory(HttpPrincipal httpPrincipal,
388         long groupId, long categoryId)
389         throws com.liferay.portal.kernel.exception.PortalException,
390             com.liferay.portal.kernel.exception.SystemException {
391         try {
392             Object paramObj0 = new LongWrapper(groupId);
393 
394             Object paramObj1 = new LongWrapper(categoryId);
395 
396             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
397                     "unsubscribeCategory", new Object[] { paramObj0, paramObj1 });
398 
399             try {
400                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
401             }
402             catch (Exception e) {
403                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
404                     throw (com.liferay.portal.kernel.exception.PortalException)e;
405                 }
406 
407                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
408                     throw (com.liferay.portal.kernel.exception.SystemException)e;
409                 }
410 
411                 throw new com.liferay.portal.kernel.exception.SystemException(e);
412             }
413         }
414         catch (com.liferay.portal.kernel.exception.SystemException se) {
415             _log.error(se, se);
416 
417             throw se;
418         }
419     }
420 
421     public static com.liferay.portlet.messageboards.model.MBCategory updateCategory(
422         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
423         java.lang.String name, java.lang.String description,
424         java.lang.String emailAddress, java.lang.String inProtocol,
425         java.lang.String inServerName, int inServerPort, boolean inUseSSL,
426         java.lang.String inUserName, java.lang.String inPassword,
427         int inReadInterval, java.lang.String outEmailAddress,
428         boolean outCustom, java.lang.String outServerName, int outServerPort,
429         boolean outUseSSL, java.lang.String outUserName,
430         java.lang.String outPassword, boolean mailingListActive,
431         boolean mergeWithParentCategory,
432         com.liferay.portal.service.ServiceContext serviceContext)
433         throws com.liferay.portal.kernel.exception.PortalException,
434             com.liferay.portal.kernel.exception.SystemException {
435         try {
436             Object paramObj0 = new LongWrapper(categoryId);
437 
438             Object paramObj1 = new LongWrapper(parentCategoryId);
439 
440             Object paramObj2 = name;
441 
442             if (name == null) {
443                 paramObj2 = new NullWrapper("java.lang.String");
444             }
445 
446             Object paramObj3 = description;
447 
448             if (description == null) {
449                 paramObj3 = new NullWrapper("java.lang.String");
450             }
451 
452             Object paramObj4 = emailAddress;
453 
454             if (emailAddress == null) {
455                 paramObj4 = new NullWrapper("java.lang.String");
456             }
457 
458             Object paramObj5 = inProtocol;
459 
460             if (inProtocol == null) {
461                 paramObj5 = new NullWrapper("java.lang.String");
462             }
463 
464             Object paramObj6 = inServerName;
465 
466             if (inServerName == null) {
467                 paramObj6 = new NullWrapper("java.lang.String");
468             }
469 
470             Object paramObj7 = new IntegerWrapper(inServerPort);
471 
472             Object paramObj8 = new BooleanWrapper(inUseSSL);
473 
474             Object paramObj9 = inUserName;
475 
476             if (inUserName == null) {
477                 paramObj9 = new NullWrapper("java.lang.String");
478             }
479 
480             Object paramObj10 = inPassword;
481 
482             if (inPassword == null) {
483                 paramObj10 = new NullWrapper("java.lang.String");
484             }
485 
486             Object paramObj11 = new IntegerWrapper(inReadInterval);
487 
488             Object paramObj12 = outEmailAddress;
489 
490             if (outEmailAddress == null) {
491                 paramObj12 = new NullWrapper("java.lang.String");
492             }
493 
494             Object paramObj13 = new BooleanWrapper(outCustom);
495 
496             Object paramObj14 = outServerName;
497 
498             if (outServerName == null) {
499                 paramObj14 = new NullWrapper("java.lang.String");
500             }
501 
502             Object paramObj15 = new IntegerWrapper(outServerPort);
503 
504             Object paramObj16 = new BooleanWrapper(outUseSSL);
505 
506             Object paramObj17 = outUserName;
507 
508             if (outUserName == null) {
509                 paramObj17 = new NullWrapper("java.lang.String");
510             }
511 
512             Object paramObj18 = outPassword;
513 
514             if (outPassword == null) {
515                 paramObj18 = new NullWrapper("java.lang.String");
516             }
517 
518             Object paramObj19 = new BooleanWrapper(mailingListActive);
519 
520             Object paramObj20 = new BooleanWrapper(mergeWithParentCategory);
521 
522             Object paramObj21 = serviceContext;
523 
524             if (serviceContext == null) {
525                 paramObj21 = new NullWrapper(
526                         "com.liferay.portal.service.ServiceContext");
527             }
528 
529             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
530                     "updateCategory",
531                     new Object[] {
532                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
533                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
534                         paramObj10, paramObj11, paramObj12, paramObj13,
535                         paramObj14, paramObj15, paramObj16, paramObj17,
536                         paramObj18, paramObj19, paramObj20, paramObj21
537                     });
538 
539             Object returnObj = null;
540 
541             try {
542                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
543             }
544             catch (Exception e) {
545                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
546                     throw (com.liferay.portal.kernel.exception.PortalException)e;
547                 }
548 
549                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
550                     throw (com.liferay.portal.kernel.exception.SystemException)e;
551                 }
552 
553                 throw new com.liferay.portal.kernel.exception.SystemException(e);
554             }
555 
556             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
557         }
558         catch (com.liferay.portal.kernel.exception.SystemException se) {
559             _log.error(se, se);
560 
561             throw se;
562         }
563     }
564 
565     private static Log _log = LogFactoryUtil.getLog(MBCategoryServiceHttp.class);
566 }