1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.calendar.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.calendar.service.CalEventServiceUtil;
36  
37  /**
38   * <a href="CalEventServiceHttp.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   * <code>com.liferay.portlet.calendar.service.CalEventServiceUtil</code> service
48   * utility. The static methods of this class calls the same methods of the
49   * service utility. However, the signatures are different because it requires an
50   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
51   * parameter.
52   * </p>
53   *
54   * <p>
55   * The benefits of using the HTTP utility is that it is fast and allows for
56   * tunneling without the cost of serializing to text. The drawback is that it
57   * only works with Java.
58   * </p>
59   *
60   * <p>
61   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
62   * portal.properties to configure security.
63   * </p>
64   *
65   * <p>
66   * The HTTP utility is only generated for remote services.
67   * </p>
68   *
69   * @author Brian Wing Shun Chan
70   *
71   * @see com.liferay.portal.security.auth.HttpPrincipal
72   * @see com.liferay.portlet.calendar.service.CalEventServiceUtil
73   * @see com.liferay.portlet.calendar.service.http.CalEventServiceSoap
74   *
75   */
76  public class CalEventServiceHttp {
77      public static com.liferay.portlet.calendar.model.CalEvent addEvent(
78          HttpPrincipal httpPrincipal, long plid, java.lang.String title,
79          java.lang.String description, int startDateMonth, int startDateDay,
80          int startDateYear, int startDateHour, int startDateMinute,
81          int endDateMonth, int endDateDay, int endDateYear, int durationHour,
82          int durationMinute, boolean allDay, boolean timeZoneSensitive,
83          java.lang.String type, boolean repeating,
84          com.liferay.portal.kernel.cal.Recurrence recurrence,
85          java.lang.String remindBy, int firstReminder, int secondReminder,
86          boolean addCommunityPermissions, boolean addGuestPermissions)
87          throws com.liferay.portal.SystemException,
88              com.liferay.portal.PortalException {
89          try {
90              Object paramObj0 = new LongWrapper(plid);
91  
92              Object paramObj1 = title;
93  
94              if (title == null) {
95                  paramObj1 = new NullWrapper("java.lang.String");
96              }
97  
98              Object paramObj2 = description;
99  
100             if (description == null) {
101                 paramObj2 = new NullWrapper("java.lang.String");
102             }
103 
104             Object paramObj3 = new IntegerWrapper(startDateMonth);
105 
106             Object paramObj4 = new IntegerWrapper(startDateDay);
107 
108             Object paramObj5 = new IntegerWrapper(startDateYear);
109 
110             Object paramObj6 = new IntegerWrapper(startDateHour);
111 
112             Object paramObj7 = new IntegerWrapper(startDateMinute);
113 
114             Object paramObj8 = new IntegerWrapper(endDateMonth);
115 
116             Object paramObj9 = new IntegerWrapper(endDateDay);
117 
118             Object paramObj10 = new IntegerWrapper(endDateYear);
119 
120             Object paramObj11 = new IntegerWrapper(durationHour);
121 
122             Object paramObj12 = new IntegerWrapper(durationMinute);
123 
124             Object paramObj13 = new BooleanWrapper(allDay);
125 
126             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
127 
128             Object paramObj15 = type;
129 
130             if (type == null) {
131                 paramObj15 = new NullWrapper("java.lang.String");
132             }
133 
134             Object paramObj16 = new BooleanWrapper(repeating);
135 
136             Object paramObj17 = recurrence;
137 
138             if (recurrence == null) {
139                 paramObj17 = new NullWrapper(
140                         "com.liferay.portal.kernel.cal.Recurrence");
141             }
142 
143             Object paramObj18 = remindBy;
144 
145             if (remindBy == null) {
146                 paramObj18 = new NullWrapper("java.lang.String");
147             }
148 
149             Object paramObj19 = new IntegerWrapper(firstReminder);
150 
151             Object paramObj20 = new IntegerWrapper(secondReminder);
152 
153             Object paramObj21 = new BooleanWrapper(addCommunityPermissions);
154 
155             Object paramObj22 = new BooleanWrapper(addGuestPermissions);
156 
157             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
158                     "addEvent",
159                     new Object[] {
160                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
161                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
162                         paramObj10, paramObj11, paramObj12, paramObj13,
163                         paramObj14, paramObj15, paramObj16, paramObj17,
164                         paramObj18, paramObj19, paramObj20, paramObj21,
165                         paramObj22
166                     });
167 
168             Object returnObj = null;
169 
170             try {
171                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
172             }
173             catch (Exception e) {
174                 if (e instanceof com.liferay.portal.SystemException) {
175                     throw (com.liferay.portal.SystemException)e;
176                 }
177 
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 throw new com.liferay.portal.SystemException(e);
183             }
184 
185             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
186         }
187         catch (com.liferay.portal.SystemException se) {
188             _log.error(se, se);
189 
190             throw se;
191         }
192     }
193 
194     public static com.liferay.portlet.calendar.model.CalEvent addEvent(
195         HttpPrincipal httpPrincipal, long plid, java.lang.String title,
196         java.lang.String description, int startDateMonth, int startDateDay,
197         int startDateYear, int startDateHour, int startDateMinute,
198         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
199         int durationMinute, boolean allDay, boolean timeZoneSensitive,
200         java.lang.String type, boolean repeating,
201         com.liferay.portal.kernel.cal.Recurrence recurrence,
202         java.lang.String remindBy, int firstReminder, int secondReminder,
203         java.lang.String[] communityPermissions,
204         java.lang.String[] guestPermissions)
205         throws com.liferay.portal.SystemException,
206             com.liferay.portal.PortalException {
207         try {
208             Object paramObj0 = new LongWrapper(plid);
209 
210             Object paramObj1 = title;
211 
212             if (title == null) {
213                 paramObj1 = new NullWrapper("java.lang.String");
214             }
215 
216             Object paramObj2 = description;
217 
218             if (description == null) {
219                 paramObj2 = new NullWrapper("java.lang.String");
220             }
221 
222             Object paramObj3 = new IntegerWrapper(startDateMonth);
223 
224             Object paramObj4 = new IntegerWrapper(startDateDay);
225 
226             Object paramObj5 = new IntegerWrapper(startDateYear);
227 
228             Object paramObj6 = new IntegerWrapper(startDateHour);
229 
230             Object paramObj7 = new IntegerWrapper(startDateMinute);
231 
232             Object paramObj8 = new IntegerWrapper(endDateMonth);
233 
234             Object paramObj9 = new IntegerWrapper(endDateDay);
235 
236             Object paramObj10 = new IntegerWrapper(endDateYear);
237 
238             Object paramObj11 = new IntegerWrapper(durationHour);
239 
240             Object paramObj12 = new IntegerWrapper(durationMinute);
241 
242             Object paramObj13 = new BooleanWrapper(allDay);
243 
244             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
245 
246             Object paramObj15 = type;
247 
248             if (type == null) {
249                 paramObj15 = new NullWrapper("java.lang.String");
250             }
251 
252             Object paramObj16 = new BooleanWrapper(repeating);
253 
254             Object paramObj17 = recurrence;
255 
256             if (recurrence == null) {
257                 paramObj17 = new NullWrapper(
258                         "com.liferay.portal.kernel.cal.Recurrence");
259             }
260 
261             Object paramObj18 = remindBy;
262 
263             if (remindBy == null) {
264                 paramObj18 = new NullWrapper("java.lang.String");
265             }
266 
267             Object paramObj19 = new IntegerWrapper(firstReminder);
268 
269             Object paramObj20 = new IntegerWrapper(secondReminder);
270 
271             Object paramObj21 = communityPermissions;
272 
273             if (communityPermissions == null) {
274                 paramObj21 = new NullWrapper("[Ljava.lang.String;");
275             }
276 
277             Object paramObj22 = guestPermissions;
278 
279             if (guestPermissions == null) {
280                 paramObj22 = new NullWrapper("[Ljava.lang.String;");
281             }
282 
283             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
284                     "addEvent",
285                     new Object[] {
286                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
287                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
288                         paramObj10, paramObj11, paramObj12, paramObj13,
289                         paramObj14, paramObj15, paramObj16, paramObj17,
290                         paramObj18, paramObj19, paramObj20, paramObj21,
291                         paramObj22
292                     });
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.SystemException) {
301                     throw (com.liferay.portal.SystemException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.PortalException) {
305                     throw (com.liferay.portal.PortalException)e;
306                 }
307 
308                 throw new com.liferay.portal.SystemException(e);
309             }
310 
311             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     public static void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
321         throws com.liferay.portal.SystemException,
322             com.liferay.portal.PortalException {
323         try {
324             Object paramObj0 = new LongWrapper(eventId);
325 
326             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
327                     "deleteEvent", new Object[] { paramObj0 });
328 
329             try {
330                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
331             }
332             catch (Exception e) {
333                 if (e instanceof com.liferay.portal.SystemException) {
334                     throw (com.liferay.portal.SystemException)e;
335                 }
336 
337                 if (e instanceof com.liferay.portal.PortalException) {
338                     throw (com.liferay.portal.PortalException)e;
339                 }
340 
341                 throw new com.liferay.portal.SystemException(e);
342             }
343         }
344         catch (com.liferay.portal.SystemException se) {
345             _log.error(se, se);
346 
347             throw se;
348         }
349     }
350 
351     public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
352         long eventId)
353         throws com.liferay.portal.SystemException,
354             com.liferay.portal.PortalException {
355         try {
356             Object paramObj0 = new LongWrapper(eventId);
357 
358             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
359                     "exportEvent", new Object[] { paramObj0 });
360 
361             Object returnObj = null;
362 
363             try {
364                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
365             }
366             catch (Exception e) {
367                 if (e instanceof com.liferay.portal.SystemException) {
368                     throw (com.liferay.portal.SystemException)e;
369                 }
370 
371                 if (e instanceof com.liferay.portal.PortalException) {
372                     throw (com.liferay.portal.PortalException)e;
373                 }
374 
375                 throw new com.liferay.portal.SystemException(e);
376             }
377 
378             return (java.io.File)returnObj;
379         }
380         catch (com.liferay.portal.SystemException se) {
381             _log.error(se, se);
382 
383             throw se;
384         }
385     }
386 
387     public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
388         long plid, java.lang.String fileName)
389         throws com.liferay.portal.SystemException,
390             com.liferay.portal.PortalException {
391         try {
392             Object paramObj0 = new LongWrapper(plid);
393 
394             Object paramObj1 = fileName;
395 
396             if (fileName == null) {
397                 paramObj1 = new NullWrapper("java.lang.String");
398             }
399 
400             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
401                     "exportGroupEvents", new Object[] { paramObj0, paramObj1 });
402 
403             Object returnObj = null;
404 
405             try {
406                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
407             }
408             catch (Exception e) {
409                 if (e instanceof com.liferay.portal.SystemException) {
410                     throw (com.liferay.portal.SystemException)e;
411                 }
412 
413                 if (e instanceof com.liferay.portal.PortalException) {
414                     throw (com.liferay.portal.PortalException)e;
415                 }
416 
417                 throw new com.liferay.portal.SystemException(e);
418             }
419 
420             return (java.io.File)returnObj;
421         }
422         catch (com.liferay.portal.SystemException se) {
423             _log.error(se, se);
424 
425             throw se;
426         }
427     }
428 
429     public static com.liferay.portlet.calendar.model.CalEvent getEvent(
430         HttpPrincipal httpPrincipal, long eventId)
431         throws com.liferay.portal.SystemException,
432             com.liferay.portal.PortalException {
433         try {
434             Object paramObj0 = new LongWrapper(eventId);
435 
436             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
437                     "getEvent", new Object[] { paramObj0 });
438 
439             Object returnObj = null;
440 
441             try {
442                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
443             }
444             catch (Exception e) {
445                 if (e instanceof com.liferay.portal.SystemException) {
446                     throw (com.liferay.portal.SystemException)e;
447                 }
448 
449                 if (e instanceof com.liferay.portal.PortalException) {
450                     throw (com.liferay.portal.PortalException)e;
451                 }
452 
453                 throw new com.liferay.portal.SystemException(e);
454             }
455 
456             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
457         }
458         catch (com.liferay.portal.SystemException se) {
459             _log.error(se, se);
460 
461             throw se;
462         }
463     }
464 
465     public static void importICal4j(HttpPrincipal httpPrincipal, long plid,
466         java.io.File file)
467         throws com.liferay.portal.SystemException,
468             com.liferay.portal.PortalException {
469         try {
470             Object paramObj0 = new LongWrapper(plid);
471 
472             Object paramObj1 = file;
473 
474             if (file == null) {
475                 paramObj1 = new NullWrapper("java.io.File");
476             }
477 
478             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
479                     "importICal4j", new Object[] { paramObj0, paramObj1 });
480 
481             try {
482                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
483             }
484             catch (Exception e) {
485                 if (e instanceof com.liferay.portal.SystemException) {
486                     throw (com.liferay.portal.SystemException)e;
487                 }
488 
489                 if (e instanceof com.liferay.portal.PortalException) {
490                     throw (com.liferay.portal.PortalException)e;
491                 }
492 
493                 throw new com.liferay.portal.SystemException(e);
494             }
495         }
496         catch (com.liferay.portal.SystemException se) {
497             _log.error(se, se);
498 
499             throw se;
500         }
501     }
502 
503     public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
504         HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
505         java.lang.String description, int startDateMonth, int startDateDay,
506         int startDateYear, int startDateHour, int startDateMinute,
507         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
508         int durationMinute, boolean allDay, boolean timeZoneSensitive,
509         java.lang.String type, boolean repeating,
510         com.liferay.portal.kernel.cal.Recurrence recurrence,
511         java.lang.String remindBy, int firstReminder, int secondReminder)
512         throws com.liferay.portal.SystemException,
513             com.liferay.portal.PortalException {
514         try {
515             Object paramObj0 = new LongWrapper(eventId);
516 
517             Object paramObj1 = title;
518 
519             if (title == null) {
520                 paramObj1 = new NullWrapper("java.lang.String");
521             }
522 
523             Object paramObj2 = description;
524 
525             if (description == null) {
526                 paramObj2 = new NullWrapper("java.lang.String");
527             }
528 
529             Object paramObj3 = new IntegerWrapper(startDateMonth);
530 
531             Object paramObj4 = new IntegerWrapper(startDateDay);
532 
533             Object paramObj5 = new IntegerWrapper(startDateYear);
534 
535             Object paramObj6 = new IntegerWrapper(startDateHour);
536 
537             Object paramObj7 = new IntegerWrapper(startDateMinute);
538 
539             Object paramObj8 = new IntegerWrapper(endDateMonth);
540 
541             Object paramObj9 = new IntegerWrapper(endDateDay);
542 
543             Object paramObj10 = new IntegerWrapper(endDateYear);
544 
545             Object paramObj11 = new IntegerWrapper(durationHour);
546 
547             Object paramObj12 = new IntegerWrapper(durationMinute);
548 
549             Object paramObj13 = new BooleanWrapper(allDay);
550 
551             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
552 
553             Object paramObj15 = type;
554 
555             if (type == null) {
556                 paramObj15 = new NullWrapper("java.lang.String");
557             }
558 
559             Object paramObj16 = new BooleanWrapper(repeating);
560 
561             Object paramObj17 = recurrence;
562 
563             if (recurrence == null) {
564                 paramObj17 = new NullWrapper(
565                         "com.liferay.portal.kernel.cal.Recurrence");
566             }
567 
568             Object paramObj18 = remindBy;
569 
570             if (remindBy == null) {
571                 paramObj18 = new NullWrapper("java.lang.String");
572             }
573 
574             Object paramObj19 = new IntegerWrapper(firstReminder);
575 
576             Object paramObj20 = new IntegerWrapper(secondReminder);
577 
578             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
579                     "updateEvent",
580                     new Object[] {
581                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
582                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
583                         paramObj10, paramObj11, paramObj12, paramObj13,
584                         paramObj14, paramObj15, paramObj16, paramObj17,
585                         paramObj18, paramObj19, paramObj20
586                     });
587 
588             Object returnObj = null;
589 
590             try {
591                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
592             }
593             catch (Exception e) {
594                 if (e instanceof com.liferay.portal.SystemException) {
595                     throw (com.liferay.portal.SystemException)e;
596                 }
597 
598                 if (e instanceof com.liferay.portal.PortalException) {
599                     throw (com.liferay.portal.PortalException)e;
600                 }
601 
602                 throw new com.liferay.portal.SystemException(e);
603             }
604 
605             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
606         }
607         catch (com.liferay.portal.SystemException se) {
608             _log.error(se, se);
609 
610             throw se;
611         }
612     }
613 
614     private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
615 }