1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.messageboards.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.IntegerWrapper;
29  import com.liferay.portal.kernel.util.LongWrapper;
30  import com.liferay.portal.kernel.util.MethodWrapper;
31  import com.liferay.portal.kernel.util.NullWrapper;
32  import com.liferay.portal.security.auth.HttpPrincipal;
33  import com.liferay.portal.service.http.TunnelUtil;
34  
35  import com.liferay.portlet.messageboards.service.MBCategoryServiceUtil;
36  
37  /**
38   * <a href="MBCategoryServiceHttp.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class provides a HTTP utility for the
47   * {@link com.liferay.portlet.messageboards.service.MBCategoryServiceUtil} service utility. The
48   * static methods of this class calls the same methods of the service utility.
49   * However, the signatures are different because it requires an additional
50   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
61   * configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author    Brian Wing Shun Chan
69   * @see       MBCategoryServiceSoap
70   * @see       com.liferay.portal.security.auth.HttpPrincipal
71   * @see       com.liferay.portlet.messageboards.service.MBCategoryServiceUtil
72   * @generated
73   */
74  public class MBCategoryServiceHttp {
75      public static com.liferay.portlet.messageboards.model.MBCategory addCategory(
76          HttpPrincipal httpPrincipal, long parentCategoryId,
77          java.lang.String name, java.lang.String description,
78          java.lang.String emailAddress, java.lang.String inProtocol,
79          java.lang.String inServerName, int inServerPort, boolean inUseSSL,
80          java.lang.String inUserName, java.lang.String inPassword,
81          int inReadInterval, java.lang.String outEmailAddress,
82          boolean outCustom, java.lang.String outServerName, int outServerPort,
83          boolean outUseSSL, java.lang.String outUserName,
84          java.lang.String outPassword, boolean mailingListActive,
85          com.liferay.portal.service.ServiceContext serviceContext)
86          throws com.liferay.portal.PortalException,
87              com.liferay.portal.SystemException {
88          try {
89              Object paramObj0 = new LongWrapper(parentCategoryId);
90  
91              Object paramObj1 = name;
92  
93              if (name == null) {
94                  paramObj1 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj2 = description;
98  
99              if (description == null) {
100                 paramObj2 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj3 = emailAddress;
104 
105             if (emailAddress == null) {
106                 paramObj3 = new NullWrapper("java.lang.String");
107             }
108 
109             Object paramObj4 = inProtocol;
110 
111             if (inProtocol == null) {
112                 paramObj4 = new NullWrapper("java.lang.String");
113             }
114 
115             Object paramObj5 = inServerName;
116 
117             if (inServerName == null) {
118                 paramObj5 = new NullWrapper("java.lang.String");
119             }
120 
121             Object paramObj6 = new IntegerWrapper(inServerPort);
122 
123             Object paramObj7 = new BooleanWrapper(inUseSSL);
124 
125             Object paramObj8 = inUserName;
126 
127             if (inUserName == null) {
128                 paramObj8 = new NullWrapper("java.lang.String");
129             }
130 
131             Object paramObj9 = inPassword;
132 
133             if (inPassword == null) {
134                 paramObj9 = new NullWrapper("java.lang.String");
135             }
136 
137             Object paramObj10 = new IntegerWrapper(inReadInterval);
138 
139             Object paramObj11 = outEmailAddress;
140 
141             if (outEmailAddress == null) {
142                 paramObj11 = new NullWrapper("java.lang.String");
143             }
144 
145             Object paramObj12 = new BooleanWrapper(outCustom);
146 
147             Object paramObj13 = outServerName;
148 
149             if (outServerName == null) {
150                 paramObj13 = new NullWrapper("java.lang.String");
151             }
152 
153             Object paramObj14 = new IntegerWrapper(outServerPort);
154 
155             Object paramObj15 = new BooleanWrapper(outUseSSL);
156 
157             Object paramObj16 = outUserName;
158 
159             if (outUserName == null) {
160                 paramObj16 = new NullWrapper("java.lang.String");
161             }
162 
163             Object paramObj17 = outPassword;
164 
165             if (outPassword == null) {
166                 paramObj17 = new NullWrapper("java.lang.String");
167             }
168 
169             Object paramObj18 = new BooleanWrapper(mailingListActive);
170 
171             Object paramObj19 = serviceContext;
172 
173             if (serviceContext == null) {
174                 paramObj19 = new NullWrapper(
175                         "com.liferay.portal.service.ServiceContext");
176             }
177 
178             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
179                     "addCategory",
180                     new Object[] {
181                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
182                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
183                         paramObj10, paramObj11, paramObj12, paramObj13,
184                         paramObj14, paramObj15, paramObj16, paramObj17,
185                         paramObj18, paramObj19
186                     });
187 
188             Object returnObj = null;
189 
190             try {
191                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
192             }
193             catch (Exception e) {
194                 if (e instanceof com.liferay.portal.PortalException) {
195                     throw (com.liferay.portal.PortalException)e;
196                 }
197 
198                 if (e instanceof com.liferay.portal.SystemException) {
199                     throw (com.liferay.portal.SystemException)e;
200                 }
201 
202                 throw new com.liferay.portal.SystemException(e);
203             }
204 
205             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
206         }
207         catch (com.liferay.portal.SystemException se) {
208             _log.error(se, se);
209 
210             throw se;
211         }
212     }
213 
214     public static void deleteCategory(HttpPrincipal httpPrincipal,
215         long categoryId)
216         throws com.liferay.portal.PortalException,
217             com.liferay.portal.SystemException {
218         try {
219             Object paramObj0 = new LongWrapper(categoryId);
220 
221             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
222                     "deleteCategory", new Object[] { paramObj0 });
223 
224             try {
225                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
226             }
227             catch (Exception e) {
228                 if (e instanceof com.liferay.portal.PortalException) {
229                     throw (com.liferay.portal.PortalException)e;
230                 }
231 
232                 if (e instanceof com.liferay.portal.SystemException) {
233                     throw (com.liferay.portal.SystemException)e;
234                 }
235 
236                 throw new com.liferay.portal.SystemException(e);
237             }
238         }
239         catch (com.liferay.portal.SystemException se) {
240             _log.error(se, se);
241 
242             throw se;
243         }
244     }
245 
246     public static java.util.List<com.liferay.portlet.messageboards.model.MBCategory> getCategories(
247         HttpPrincipal httpPrincipal, long groupId, long parentCategoryId,
248         int start, int end)
249         throws com.liferay.portal.PortalException,
250             com.liferay.portal.SystemException {
251         try {
252             Object paramObj0 = new LongWrapper(groupId);
253 
254             Object paramObj1 = new LongWrapper(parentCategoryId);
255 
256             Object paramObj2 = new IntegerWrapper(start);
257 
258             Object paramObj3 = new IntegerWrapper(end);
259 
260             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
261                     "getCategories",
262                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
263 
264             Object returnObj = null;
265 
266             try {
267                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
268             }
269             catch (Exception e) {
270                 if (e instanceof com.liferay.portal.PortalException) {
271                     throw (com.liferay.portal.PortalException)e;
272                 }
273 
274                 if (e instanceof com.liferay.portal.SystemException) {
275                     throw (com.liferay.portal.SystemException)e;
276                 }
277 
278                 throw new com.liferay.portal.SystemException(e);
279             }
280 
281             return (java.util.List<com.liferay.portlet.messageboards.model.MBCategory>)returnObj;
282         }
283         catch (com.liferay.portal.SystemException se) {
284             _log.error(se, se);
285 
286             throw se;
287         }
288     }
289 
290     public static int getCategoriesCount(HttpPrincipal httpPrincipal,
291         long groupId, long parentCategoryId)
292         throws com.liferay.portal.SystemException {
293         try {
294             Object paramObj0 = new LongWrapper(groupId);
295 
296             Object paramObj1 = new LongWrapper(parentCategoryId);
297 
298             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
299                     "getCategoriesCount", new Object[] { paramObj0, paramObj1 });
300 
301             Object returnObj = null;
302 
303             try {
304                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
305             }
306             catch (Exception e) {
307                 if (e instanceof com.liferay.portal.SystemException) {
308                     throw (com.liferay.portal.SystemException)e;
309                 }
310 
311                 throw new com.liferay.portal.SystemException(e);
312             }
313 
314             return ((Integer)returnObj).intValue();
315         }
316         catch (com.liferay.portal.SystemException se) {
317             _log.error(se, se);
318 
319             throw se;
320         }
321     }
322 
323     public static com.liferay.portlet.messageboards.model.MBCategory getCategory(
324         HttpPrincipal httpPrincipal, long categoryId)
325         throws com.liferay.portal.PortalException,
326             com.liferay.portal.SystemException {
327         try {
328             Object paramObj0 = new LongWrapper(categoryId);
329 
330             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
331                     "getCategory", new Object[] { paramObj0 });
332 
333             Object returnObj = null;
334 
335             try {
336                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
337             }
338             catch (Exception e) {
339                 if (e instanceof com.liferay.portal.PortalException) {
340                     throw (com.liferay.portal.PortalException)e;
341                 }
342 
343                 if (e instanceof com.liferay.portal.SystemException) {
344                     throw (com.liferay.portal.SystemException)e;
345                 }
346 
347                 throw new com.liferay.portal.SystemException(e);
348             }
349 
350             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
351         }
352         catch (com.liferay.portal.SystemException se) {
353             _log.error(se, se);
354 
355             throw se;
356         }
357     }
358 
359     public static void subscribeCategory(HttpPrincipal httpPrincipal,
360         long categoryId)
361         throws com.liferay.portal.PortalException,
362             com.liferay.portal.SystemException {
363         try {
364             Object paramObj0 = new LongWrapper(categoryId);
365 
366             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
367                     "subscribeCategory", new Object[] { paramObj0 });
368 
369             try {
370                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
371             }
372             catch (Exception e) {
373                 if (e instanceof com.liferay.portal.PortalException) {
374                     throw (com.liferay.portal.PortalException)e;
375                 }
376 
377                 if (e instanceof com.liferay.portal.SystemException) {
378                     throw (com.liferay.portal.SystemException)e;
379                 }
380 
381                 throw new com.liferay.portal.SystemException(e);
382             }
383         }
384         catch (com.liferay.portal.SystemException se) {
385             _log.error(se, se);
386 
387             throw se;
388         }
389     }
390 
391     public static void unsubscribeCategory(HttpPrincipal httpPrincipal,
392         long categoryId)
393         throws com.liferay.portal.PortalException,
394             com.liferay.portal.SystemException {
395         try {
396             Object paramObj0 = new LongWrapper(categoryId);
397 
398             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
399                     "unsubscribeCategory", new Object[] { paramObj0 });
400 
401             try {
402                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
403             }
404             catch (Exception e) {
405                 if (e instanceof com.liferay.portal.PortalException) {
406                     throw (com.liferay.portal.PortalException)e;
407                 }
408 
409                 if (e instanceof com.liferay.portal.SystemException) {
410                     throw (com.liferay.portal.SystemException)e;
411                 }
412 
413                 throw new com.liferay.portal.SystemException(e);
414             }
415         }
416         catch (com.liferay.portal.SystemException se) {
417             _log.error(se, se);
418 
419             throw se;
420         }
421     }
422 
423     public static com.liferay.portlet.messageboards.model.MBCategory updateCategory(
424         HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
425         java.lang.String name, java.lang.String description,
426         java.lang.String emailAddress, java.lang.String inProtocol,
427         java.lang.String inServerName, int inServerPort, boolean inUseSSL,
428         java.lang.String inUserName, java.lang.String inPassword,
429         int inReadInterval, java.lang.String outEmailAddress,
430         boolean outCustom, java.lang.String outServerName, int outServerPort,
431         boolean outUseSSL, java.lang.String outUserName,
432         java.lang.String outPassword, boolean mailingListActive,
433         boolean mergeWithParentCategory)
434         throws com.liferay.portal.PortalException,
435             com.liferay.portal.SystemException {
436         try {
437             Object paramObj0 = new LongWrapper(categoryId);
438 
439             Object paramObj1 = new LongWrapper(parentCategoryId);
440 
441             Object paramObj2 = name;
442 
443             if (name == null) {
444                 paramObj2 = new NullWrapper("java.lang.String");
445             }
446 
447             Object paramObj3 = description;
448 
449             if (description == null) {
450                 paramObj3 = new NullWrapper("java.lang.String");
451             }
452 
453             Object paramObj4 = emailAddress;
454 
455             if (emailAddress == null) {
456                 paramObj4 = new NullWrapper("java.lang.String");
457             }
458 
459             Object paramObj5 = inProtocol;
460 
461             if (inProtocol == null) {
462                 paramObj5 = new NullWrapper("java.lang.String");
463             }
464 
465             Object paramObj6 = inServerName;
466 
467             if (inServerName == null) {
468                 paramObj6 = new NullWrapper("java.lang.String");
469             }
470 
471             Object paramObj7 = new IntegerWrapper(inServerPort);
472 
473             Object paramObj8 = new BooleanWrapper(inUseSSL);
474 
475             Object paramObj9 = inUserName;
476 
477             if (inUserName == null) {
478                 paramObj9 = new NullWrapper("java.lang.String");
479             }
480 
481             Object paramObj10 = inPassword;
482 
483             if (inPassword == null) {
484                 paramObj10 = new NullWrapper("java.lang.String");
485             }
486 
487             Object paramObj11 = new IntegerWrapper(inReadInterval);
488 
489             Object paramObj12 = outEmailAddress;
490 
491             if (outEmailAddress == null) {
492                 paramObj12 = new NullWrapper("java.lang.String");
493             }
494 
495             Object paramObj13 = new BooleanWrapper(outCustom);
496 
497             Object paramObj14 = outServerName;
498 
499             if (outServerName == null) {
500                 paramObj14 = new NullWrapper("java.lang.String");
501             }
502 
503             Object paramObj15 = new IntegerWrapper(outServerPort);
504 
505             Object paramObj16 = new BooleanWrapper(outUseSSL);
506 
507             Object paramObj17 = outUserName;
508 
509             if (outUserName == null) {
510                 paramObj17 = new NullWrapper("java.lang.String");
511             }
512 
513             Object paramObj18 = outPassword;
514 
515             if (outPassword == null) {
516                 paramObj18 = new NullWrapper("java.lang.String");
517             }
518 
519             Object paramObj19 = new BooleanWrapper(mailingListActive);
520 
521             Object paramObj20 = new BooleanWrapper(mergeWithParentCategory);
522 
523             MethodWrapper methodWrapper = new MethodWrapper(MBCategoryServiceUtil.class.getName(),
524                     "updateCategory",
525                     new Object[] {
526                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
527                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
528                         paramObj10, paramObj11, paramObj12, paramObj13,
529                         paramObj14, paramObj15, paramObj16, paramObj17,
530                         paramObj18, paramObj19, paramObj20
531                     });
532 
533             Object returnObj = null;
534 
535             try {
536                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
537             }
538             catch (Exception e) {
539                 if (e instanceof com.liferay.portal.PortalException) {
540                     throw (com.liferay.portal.PortalException)e;
541                 }
542 
543                 if (e instanceof com.liferay.portal.SystemException) {
544                     throw (com.liferay.portal.SystemException)e;
545                 }
546 
547                 throw new com.liferay.portal.SystemException(e);
548             }
549 
550             return (com.liferay.portlet.messageboards.model.MBCategory)returnObj;
551         }
552         catch (com.liferay.portal.SystemException se) {
553             _log.error(se, se);
554 
555             throw se;
556         }
557     }
558 
559     private static Log _log = LogFactoryUtil.getLog(MBCategoryServiceHttp.class);
560 }