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