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.calendar.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.calendar.service.CalEventServiceUtil;
28  
29  /**
30   * <a href="CalEventServiceHttp.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.calendar.service.CalEventServiceUtil} 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       CalEventServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.calendar.service.CalEventServiceUtil
64   * @generated
65   */
66  public class CalEventServiceHttp {
67      public static com.liferay.portlet.calendar.model.CalEvent addEvent(
68          HttpPrincipal httpPrincipal, long plid, java.lang.String title,
69          java.lang.String description, int startDateMonth, int startDateDay,
70          int startDateYear, int startDateHour, int startDateMinute,
71          int endDateMonth, int endDateDay, int endDateYear, int durationHour,
72          int durationMinute, boolean allDay, boolean timeZoneSensitive,
73          java.lang.String type, boolean repeating,
74          com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
75          int firstReminder, int secondReminder, boolean addCommunityPermissions,
76          boolean addGuestPermissions)
77          throws com.liferay.portal.PortalException,
78              com.liferay.portal.SystemException {
79          try {
80              Object paramObj0 = new LongWrapper(plid);
81  
82              Object paramObj1 = title;
83  
84              if (title == null) {
85                  paramObj1 = new NullWrapper("java.lang.String");
86              }
87  
88              Object paramObj2 = description;
89  
90              if (description == null) {
91                  paramObj2 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj3 = new IntegerWrapper(startDateMonth);
95  
96              Object paramObj4 = new IntegerWrapper(startDateDay);
97  
98              Object paramObj5 = new IntegerWrapper(startDateYear);
99  
100             Object paramObj6 = new IntegerWrapper(startDateHour);
101 
102             Object paramObj7 = new IntegerWrapper(startDateMinute);
103 
104             Object paramObj8 = new IntegerWrapper(endDateMonth);
105 
106             Object paramObj9 = new IntegerWrapper(endDateDay);
107 
108             Object paramObj10 = new IntegerWrapper(endDateYear);
109 
110             Object paramObj11 = new IntegerWrapper(durationHour);
111 
112             Object paramObj12 = new IntegerWrapper(durationMinute);
113 
114             Object paramObj13 = new BooleanWrapper(allDay);
115 
116             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
117 
118             Object paramObj15 = type;
119 
120             if (type == null) {
121                 paramObj15 = new NullWrapper("java.lang.String");
122             }
123 
124             Object paramObj16 = new BooleanWrapper(repeating);
125 
126             Object paramObj17 = recurrence;
127 
128             if (recurrence == null) {
129                 paramObj17 = new NullWrapper(
130                         "com.liferay.portal.kernel.cal.TZSRecurrence");
131             }
132 
133             Object paramObj18 = new IntegerWrapper(remindBy);
134 
135             Object paramObj19 = new IntegerWrapper(firstReminder);
136 
137             Object paramObj20 = new IntegerWrapper(secondReminder);
138 
139             Object paramObj21 = new BooleanWrapper(addCommunityPermissions);
140 
141             Object paramObj22 = new BooleanWrapper(addGuestPermissions);
142 
143             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
144                     "addEvent",
145                     new Object[] {
146                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
147                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
148                         paramObj10, paramObj11, paramObj12, paramObj13,
149                         paramObj14, paramObj15, paramObj16, paramObj17,
150                         paramObj18, paramObj19, paramObj20, paramObj21,
151                         paramObj22
152                     });
153 
154             Object returnObj = null;
155 
156             try {
157                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
158             }
159             catch (Exception e) {
160                 if (e instanceof com.liferay.portal.PortalException) {
161                     throw (com.liferay.portal.PortalException)e;
162                 }
163 
164                 if (e instanceof com.liferay.portal.SystemException) {
165                     throw (com.liferay.portal.SystemException)e;
166                 }
167 
168                 throw new com.liferay.portal.SystemException(e);
169             }
170 
171             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
172         }
173         catch (com.liferay.portal.SystemException se) {
174             _log.error(se, se);
175 
176             throw se;
177         }
178     }
179 
180     public static com.liferay.portlet.calendar.model.CalEvent addEvent(
181         HttpPrincipal httpPrincipal, long plid, java.lang.String title,
182         java.lang.String description, int startDateMonth, int startDateDay,
183         int startDateYear, int startDateHour, int startDateMinute,
184         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
185         int durationMinute, boolean allDay, boolean timeZoneSensitive,
186         java.lang.String type, boolean repeating,
187         com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
188         int firstReminder, int secondReminder,
189         java.lang.String[] communityPermissions,
190         java.lang.String[] guestPermissions)
191         throws com.liferay.portal.PortalException,
192             com.liferay.portal.SystemException {
193         try {
194             Object paramObj0 = new LongWrapper(plid);
195 
196             Object paramObj1 = title;
197 
198             if (title == null) {
199                 paramObj1 = new NullWrapper("java.lang.String");
200             }
201 
202             Object paramObj2 = description;
203 
204             if (description == null) {
205                 paramObj2 = new NullWrapper("java.lang.String");
206             }
207 
208             Object paramObj3 = new IntegerWrapper(startDateMonth);
209 
210             Object paramObj4 = new IntegerWrapper(startDateDay);
211 
212             Object paramObj5 = new IntegerWrapper(startDateYear);
213 
214             Object paramObj6 = new IntegerWrapper(startDateHour);
215 
216             Object paramObj7 = new IntegerWrapper(startDateMinute);
217 
218             Object paramObj8 = new IntegerWrapper(endDateMonth);
219 
220             Object paramObj9 = new IntegerWrapper(endDateDay);
221 
222             Object paramObj10 = new IntegerWrapper(endDateYear);
223 
224             Object paramObj11 = new IntegerWrapper(durationHour);
225 
226             Object paramObj12 = new IntegerWrapper(durationMinute);
227 
228             Object paramObj13 = new BooleanWrapper(allDay);
229 
230             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
231 
232             Object paramObj15 = type;
233 
234             if (type == null) {
235                 paramObj15 = new NullWrapper("java.lang.String");
236             }
237 
238             Object paramObj16 = new BooleanWrapper(repeating);
239 
240             Object paramObj17 = recurrence;
241 
242             if (recurrence == null) {
243                 paramObj17 = new NullWrapper(
244                         "com.liferay.portal.kernel.cal.TZSRecurrence");
245             }
246 
247             Object paramObj18 = new IntegerWrapper(remindBy);
248 
249             Object paramObj19 = new IntegerWrapper(firstReminder);
250 
251             Object paramObj20 = new IntegerWrapper(secondReminder);
252 
253             Object paramObj21 = communityPermissions;
254 
255             if (communityPermissions == null) {
256                 paramObj21 = new NullWrapper("[Ljava.lang.String;");
257             }
258 
259             Object paramObj22 = guestPermissions;
260 
261             if (guestPermissions == null) {
262                 paramObj22 = new NullWrapper("[Ljava.lang.String;");
263             }
264 
265             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
266                     "addEvent",
267                     new Object[] {
268                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
269                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
270                         paramObj10, paramObj11, paramObj12, paramObj13,
271                         paramObj14, paramObj15, paramObj16, paramObj17,
272                         paramObj18, paramObj19, paramObj20, paramObj21,
273                         paramObj22
274                     });
275 
276             Object returnObj = null;
277 
278             try {
279                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
280             }
281             catch (Exception e) {
282                 if (e instanceof com.liferay.portal.PortalException) {
283                     throw (com.liferay.portal.PortalException)e;
284                 }
285 
286                 if (e instanceof com.liferay.portal.SystemException) {
287                     throw (com.liferay.portal.SystemException)e;
288                 }
289 
290                 throw new com.liferay.portal.SystemException(e);
291             }
292 
293             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
294         }
295         catch (com.liferay.portal.SystemException se) {
296             _log.error(se, se);
297 
298             throw se;
299         }
300     }
301 
302     public static void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
303         throws com.liferay.portal.PortalException,
304             com.liferay.portal.SystemException {
305         try {
306             Object paramObj0 = new LongWrapper(eventId);
307 
308             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
309                     "deleteEvent", new Object[] { paramObj0 });
310 
311             try {
312                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
313             }
314             catch (Exception e) {
315                 if (e instanceof com.liferay.portal.PortalException) {
316                     throw (com.liferay.portal.PortalException)e;
317                 }
318 
319                 if (e instanceof com.liferay.portal.SystemException) {
320                     throw (com.liferay.portal.SystemException)e;
321                 }
322 
323                 throw new com.liferay.portal.SystemException(e);
324             }
325         }
326         catch (com.liferay.portal.SystemException se) {
327             _log.error(se, se);
328 
329             throw se;
330         }
331     }
332 
333     public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
334         long eventId)
335         throws com.liferay.portal.PortalException,
336             com.liferay.portal.SystemException {
337         try {
338             Object paramObj0 = new LongWrapper(eventId);
339 
340             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
341                     "exportEvent", new Object[] { paramObj0 });
342 
343             Object returnObj = null;
344 
345             try {
346                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
347             }
348             catch (Exception e) {
349                 if (e instanceof com.liferay.portal.PortalException) {
350                     throw (com.liferay.portal.PortalException)e;
351                 }
352 
353                 if (e instanceof com.liferay.portal.SystemException) {
354                     throw (com.liferay.portal.SystemException)e;
355                 }
356 
357                 throw new com.liferay.portal.SystemException(e);
358             }
359 
360             return (java.io.File)returnObj;
361         }
362         catch (com.liferay.portal.SystemException se) {
363             _log.error(se, se);
364 
365             throw se;
366         }
367     }
368 
369     public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
370         long plid, java.lang.String fileName)
371         throws com.liferay.portal.PortalException,
372             com.liferay.portal.SystemException {
373         try {
374             Object paramObj0 = new LongWrapper(plid);
375 
376             Object paramObj1 = fileName;
377 
378             if (fileName == null) {
379                 paramObj1 = new NullWrapper("java.lang.String");
380             }
381 
382             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
383                     "exportGroupEvents", new Object[] { paramObj0, paramObj1 });
384 
385             Object returnObj = null;
386 
387             try {
388                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
389             }
390             catch (Exception e) {
391                 if (e instanceof com.liferay.portal.PortalException) {
392                     throw (com.liferay.portal.PortalException)e;
393                 }
394 
395                 if (e instanceof com.liferay.portal.SystemException) {
396                     throw (com.liferay.portal.SystemException)e;
397                 }
398 
399                 throw new com.liferay.portal.SystemException(e);
400             }
401 
402             return (java.io.File)returnObj;
403         }
404         catch (com.liferay.portal.SystemException se) {
405             _log.error(se, se);
406 
407             throw se;
408         }
409     }
410 
411     public static com.liferay.portlet.calendar.model.CalEvent getEvent(
412         HttpPrincipal httpPrincipal, long eventId)
413         throws com.liferay.portal.PortalException,
414             com.liferay.portal.SystemException {
415         try {
416             Object paramObj0 = new LongWrapper(eventId);
417 
418             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
419                     "getEvent", new Object[] { paramObj0 });
420 
421             Object returnObj = null;
422 
423             try {
424                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
425             }
426             catch (Exception e) {
427                 if (e instanceof com.liferay.portal.PortalException) {
428                     throw (com.liferay.portal.PortalException)e;
429                 }
430 
431                 if (e instanceof com.liferay.portal.SystemException) {
432                     throw (com.liferay.portal.SystemException)e;
433                 }
434 
435                 throw new com.liferay.portal.SystemException(e);
436             }
437 
438             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
439         }
440         catch (com.liferay.portal.SystemException se) {
441             _log.error(se, se);
442 
443             throw se;
444         }
445     }
446 
447     public static void importICal4j(HttpPrincipal httpPrincipal, long plid,
448         java.io.File file)
449         throws com.liferay.portal.PortalException,
450             com.liferay.portal.SystemException {
451         try {
452             Object paramObj0 = new LongWrapper(plid);
453 
454             Object paramObj1 = file;
455 
456             if (file == null) {
457                 paramObj1 = new NullWrapper("java.io.File");
458             }
459 
460             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
461                     "importICal4j", new Object[] { paramObj0, paramObj1 });
462 
463             try {
464                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
465             }
466             catch (Exception e) {
467                 if (e instanceof com.liferay.portal.PortalException) {
468                     throw (com.liferay.portal.PortalException)e;
469                 }
470 
471                 if (e instanceof com.liferay.portal.SystemException) {
472                     throw (com.liferay.portal.SystemException)e;
473                 }
474 
475                 throw new com.liferay.portal.SystemException(e);
476             }
477         }
478         catch (com.liferay.portal.SystemException se) {
479             _log.error(se, se);
480 
481             throw se;
482         }
483     }
484 
485     public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
486         HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
487         java.lang.String description, int startDateMonth, int startDateDay,
488         int startDateYear, int startDateHour, int startDateMinute,
489         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
490         int durationMinute, boolean allDay, boolean timeZoneSensitive,
491         java.lang.String type, boolean repeating,
492         com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
493         int firstReminder, int secondReminder)
494         throws com.liferay.portal.PortalException,
495             com.liferay.portal.SystemException {
496         try {
497             Object paramObj0 = new LongWrapper(eventId);
498 
499             Object paramObj1 = title;
500 
501             if (title == null) {
502                 paramObj1 = new NullWrapper("java.lang.String");
503             }
504 
505             Object paramObj2 = description;
506 
507             if (description == null) {
508                 paramObj2 = new NullWrapper("java.lang.String");
509             }
510 
511             Object paramObj3 = new IntegerWrapper(startDateMonth);
512 
513             Object paramObj4 = new IntegerWrapper(startDateDay);
514 
515             Object paramObj5 = new IntegerWrapper(startDateYear);
516 
517             Object paramObj6 = new IntegerWrapper(startDateHour);
518 
519             Object paramObj7 = new IntegerWrapper(startDateMinute);
520 
521             Object paramObj8 = new IntegerWrapper(endDateMonth);
522 
523             Object paramObj9 = new IntegerWrapper(endDateDay);
524 
525             Object paramObj10 = new IntegerWrapper(endDateYear);
526 
527             Object paramObj11 = new IntegerWrapper(durationHour);
528 
529             Object paramObj12 = new IntegerWrapper(durationMinute);
530 
531             Object paramObj13 = new BooleanWrapper(allDay);
532 
533             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
534 
535             Object paramObj15 = type;
536 
537             if (type == null) {
538                 paramObj15 = new NullWrapper("java.lang.String");
539             }
540 
541             Object paramObj16 = new BooleanWrapper(repeating);
542 
543             Object paramObj17 = recurrence;
544 
545             if (recurrence == null) {
546                 paramObj17 = new NullWrapper(
547                         "com.liferay.portal.kernel.cal.TZSRecurrence");
548             }
549 
550             Object paramObj18 = new IntegerWrapper(remindBy);
551 
552             Object paramObj19 = new IntegerWrapper(firstReminder);
553 
554             Object paramObj20 = new IntegerWrapper(secondReminder);
555 
556             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
557                     "updateEvent",
558                     new Object[] {
559                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
560                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
561                         paramObj10, paramObj11, paramObj12, paramObj13,
562                         paramObj14, paramObj15, paramObj16, paramObj17,
563                         paramObj18, paramObj19, paramObj20
564                     });
565 
566             Object returnObj = null;
567 
568             try {
569                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
570             }
571             catch (Exception e) {
572                 if (e instanceof com.liferay.portal.PortalException) {
573                     throw (com.liferay.portal.PortalException)e;
574                 }
575 
576                 if (e instanceof com.liferay.portal.SystemException) {
577                     throw (com.liferay.portal.SystemException)e;
578                 }
579 
580                 throw new com.liferay.portal.SystemException(e);
581             }
582 
583             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
584         }
585         catch (com.liferay.portal.SystemException se) {
586             _log.error(se, se);
587 
588             throw se;
589         }
590     }
591 
592     private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
593 }