1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
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.PortalException,
79              com.liferay.portal.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.PortalException) {
187                     throw (com.liferay.portal.PortalException)e;
188                 }
189 
190                 if (e instanceof com.liferay.portal.SystemException) {
191                     throw (com.liferay.portal.SystemException)e;
192                 }
193 
194                 throw new com.liferay.portal.SystemException(e);
195             }
196 
197             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
198         }
199         catch (com.liferay.portal.SystemException se) {
200             _log.error(se, se);
201 
202             throw se;
203         }
204     }
205 
206     public static void deleteCategory(HttpPrincipal httpPrincipal,
207         long categoryId)
208         throws com.liferay.portal.PortalException,
209             com.liferay.portal.SystemException {
210         try {
211             Object paramObj0 = new LongWrapper(categoryId);
212 
213             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
214                     "deleteCategory", new Object[] { paramObj0 });
215 
216             try {
217                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
218             }
219             catch (Exception e) {
220                 if (e instanceof com.liferay.portal.PortalException) {
221                     throw (com.liferay.portal.PortalException)e;
222                 }
223 
224                 if (e instanceof com.liferay.portal.SystemException) {
225                     throw (com.liferay.portal.SystemException)e;
226                 }
227 
228                 throw new com.liferay.portal.SystemException(e);
229             }
230         }
231         catch (com.liferay.portal.SystemException se) {
232             _log.error(se, se);
233 
234             throw se;
235         }
236     }
237 
238     public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getCategories(
239         HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
240         int start, int end)
241         throws com.liferay.portal.PortalException,
242             com.liferay.portal.SystemException {
243         try {
244             Object paramObj0 = new LongWrapper(groupId);
245 
246             Object paramObj1 = new LongWrapper(parentCategoryId);
247 
248             Object paramObj2 = new IntegerWrapper(start);
249 
250             Object paramObj3 = new IntegerWrapper(end);
251 
252             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
253                     "getCategories",
254                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
255 
256             Object returnObj = null;
257 
258             try {
259                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
260             }
261             catch (Exception e) {
262                 if (e instanceof com.liferay.portal.PortalException) {
263                     throw (com.liferay.portal.PortalException)e;
264                 }
265 
266                 if (e instanceof com.liferay.portal.SystemException) {
267                     throw (com.liferay.portal.SystemException)e;
268                 }
269 
270                 throw new com.liferay.portal.SystemException(e);
271             }
272 
273             return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
274         }
275         catch (com.liferay.portal.SystemException se) {
276             _log.error(se, se);
277 
278             throw se;
279         }
280     }
281 
282     public static int getCategoriesCount(HttpPrincipal httpPrincipal,
283         long groupId, long parentCategoryId)
284         throws com.liferay.portal.SystemException {
285         try {
286             Object paramObj0 = new LongWrapper(groupId);
287 
288             Object paramObj1 = new LongWrapper(parentCategoryId);
289 
290             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
291                     "getCategoriesCount", new Object[] { paramObj0, paramObj1 });
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.SystemException) {
300                     throw (com.liferay.portal.SystemException)e;
301                 }
302 
303                 throw new com.liferay.portal.SystemException(e);
304             }
305 
306             return ((Integer)returnObj).intValue();
307         }
308         catch (com.liferay.portal.SystemException se) {
309             _log.error(se, se);
310 
311             throw se;
312         }
313     }
314 
315     public static com.liferay.portlet.messageboards.model.MBCategory getCategory(
316         HttpPrincipal httpPrincipal, long categoryId)
317         throws com.liferay.portal.PortalException,
318             com.liferay.portal.SystemException {
319         try {
320             Object paramObj0 = new LongWrapper(categoryId);
321 
322             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
323                     "getCategory", new Object[] { paramObj0 });
324 
325             Object returnObj = null;
326 
327             try {
328                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
329             }
330             catch (Exception e) {
331                 if (e instanceof com.liferay.portal.PortalException) {
332                     throw (com.liferay.portal.PortalException)e;
333                 }
334 
335                 if (e instanceof com.liferay.portal.SystemException) {
336                     throw (com.liferay.portal.SystemException)e;
337                 }
338 
339                 throw new com.liferay.portal.SystemException(e);
340             }
341 
342             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
343         }
344         catch (com.liferay.portal.SystemException se) {
345             _log.error(se, se);
346 
347             throw se;
348         }
349     }
350 
351     public static void subscribeCategory(HttpPrincipal httpPrincipal,
352         long categoryId)
353         throws com.liferay.portal.PortalException,
354             com.liferay.portal.SystemException {
355         try {
356             Object paramObj0 = new LongWrapper(categoryId);
357 
358             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
359                     "subscribeCategory", new Object[] { paramObj0 });
360 
361             try {
362                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
363             }
364             catch (Exception e) {
365                 if (e instanceof com.liferay.portal.PortalException) {
366                     throw (com.liferay.portal.PortalException)e;
367                 }
368 
369                 if (e instanceof com.liferay.portal.SystemException) {
370                     throw (com.liferay.portal.SystemException)e;
371                 }
372 
373                 throw new com.liferay.portal.SystemException(e);
374             }
375         }
376         catch (com.liferay.portal.SystemException se) {
377             _log.error(se, se);
378 
379             throw se;
380         }
381     }
382 
383     public static void unsubscribeCategory(HttpPrincipal httpPrincipal,
384         long categoryId)
385         throws com.liferay.portal.PortalException,
386             com.liferay.portal.SystemException {
387         try {
388             Object paramObj0 = new LongWrapper(categoryId);
389 
390             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
391                     "unsubscribeCategory", new Object[] { paramObj0 });
392 
393             try {
394                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
395             }
396             catch (Exception e) {
397                 if (e instanceof com.liferay.portal.PortalException) {
398                     throw (com.liferay.portal.PortalException)e;
399                 }
400 
401                 if (e instanceof com.liferay.portal.SystemException) {
402                     throw (com.liferay.portal.SystemException)e;
403                 }
404 
405                 throw new com.liferay.portal.SystemException(e);
406             }
407         }
408         catch (com.liferay.portal.SystemException se) {
409             _log.error(se, se);
410 
411             throw se;
412         }
413     }
414 
415     public static com.liferay.portlet.messageboards.model.MBCategory updateCategory(
416         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
417         java.lang.String name, java.lang.String description,
418         java.lang.String emailAddress, java.lang.String inProtocol,
419         java.lang.String inServerName, int inServerPort, boolean inUseSSL,
420         java.lang.String inUserName, java.lang.String inPassword,
421         int inReadInterval, java.lang.String outEmailAddress,
422         boolean outCustom, java.lang.String outServerName, int outServerPort,
423         boolean outUseSSL, java.lang.String outUserName,
424         java.lang.String outPassword, boolean mailingListActive,
425         boolean mergeWithParentCategory)
426         throws com.liferay.portal.PortalException,
427             com.liferay.portal.SystemException {
428         try {
429             Object paramObj0 = new LongWrapper(categoryId);
430 
431             Object paramObj1 = new LongWrapper(parentCategoryId);
432 
433             Object paramObj2 = name;
434 
435             if (name == null) {
436                 paramObj2 = new NullWrapper("java.lang.String");
437             }
438 
439             Object paramObj3 = description;
440 
441             if (description == null) {
442                 paramObj3 = new NullWrapper("java.lang.String");
443             }
444 
445             Object paramObj4 = emailAddress;
446 
447             if (emailAddress == null) {
448                 paramObj4 = new NullWrapper("java.lang.String");
449             }
450 
451             Object paramObj5 = inProtocol;
452 
453             if (inProtocol == null) {
454                 paramObj5 = new NullWrapper("java.lang.String");
455             }
456 
457             Object paramObj6 = inServerName;
458 
459             if (inServerName == null) {
460                 paramObj6 = new NullWrapper("java.lang.String");
461             }
462 
463             Object paramObj7 = new IntegerWrapper(inServerPort);
464 
465             Object paramObj8 = new BooleanWrapper(inUseSSL);
466 
467             Object paramObj9 = inUserName;
468 
469             if (inUserName == null) {
470                 paramObj9 = new NullWrapper("java.lang.String");
471             }
472 
473             Object paramObj10 = inPassword;
474 
475             if (inPassword == null) {
476                 paramObj10 = new NullWrapper("java.lang.String");
477             }
478 
479             Object paramObj11 = new IntegerWrapper(inReadInterval);
480 
481             Object paramObj12 = outEmailAddress;
482 
483             if (outEmailAddress == null) {
484                 paramObj12 = new NullWrapper("java.lang.String");
485             }
486 
487             Object paramObj13 = new BooleanWrapper(outCustom);
488 
489             Object paramObj14 = outServerName;
490 
491             if (outServerName == null) {
492                 paramObj14 = new NullWrapper("java.lang.String");
493             }
494 
495             Object paramObj15 = new IntegerWrapper(outServerPort);
496 
497             Object paramObj16 = new BooleanWrapper(outUseSSL);
498 
499             Object paramObj17 = outUserName;
500 
501             if (outUserName == null) {
502                 paramObj17 = new NullWrapper("java.lang.String");
503             }
504 
505             Object paramObj18 = outPassword;
506 
507             if (outPassword == null) {
508                 paramObj18 = new NullWrapper("java.lang.String");
509             }
510 
511             Object paramObj19 = new BooleanWrapper(mailingListActive);
512 
513             Object paramObj20 = new BooleanWrapper(mergeWithParentCategory);
514 
515             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
516                     "updateCategory",
517                     new Object[] {
518                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
519                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
520                         paramObj10, paramObj11, paramObj12, paramObj13,
521                         paramObj14, paramObj15, paramObj16, paramObj17,
522                         paramObj18, paramObj19, paramObj20
523                     });
524 
525             Object returnObj = null;
526 
527             try {
528                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
529             }
530             catch (Exception e) {
531                 if (e instanceof com.liferay.portal.PortalException) {
532                     throw (com.liferay.portal.PortalException)e;
533                 }
534 
535                 if (e instanceof com.liferay.portal.SystemException) {
536                     throw (com.liferay.portal.SystemException)e;
537                 }
538 
539                 throw new com.liferay.portal.SystemException(e);
540             }
541 
542             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
543         }
544         catch (com.liferay.portal.SystemException se) {
545             _log.error(se, se);
546 
547             throw se;
548         }
549     }
550 
551     private static Log _log = LogFactoryUtil.getLog(MBCategoryServiceHttp.class);
552 }