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