1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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, 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,
76          com.liferay.portal.service.ServiceContext serviceContext)
77          throws com.liferay.portal.kernel.exception.PortalException,
78              com.liferay.portal.kernel.exception.SystemException {
79          try {
80              Object paramObj0 = title;
81  
82              if (title == null) {
83                  paramObj0 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj1 = description;
87  
88              if (description == null) {
89                  paramObj1 = new NullWrapper("java.lang.String");
90              }
91  
92              Object paramObj2 = new IntegerWrapper(startDateMonth);
93  
94              Object paramObj3 = new IntegerWrapper(startDateDay);
95  
96              Object paramObj4 = new IntegerWrapper(startDateYear);
97  
98              Object paramObj5 = new IntegerWrapper(startDateHour);
99  
100             Object paramObj6 = new IntegerWrapper(startDateMinute);
101 
102             Object paramObj7 = new IntegerWrapper(endDateMonth);
103 
104             Object paramObj8 = new IntegerWrapper(endDateDay);
105 
106             Object paramObj9 = new IntegerWrapper(endDateYear);
107 
108             Object paramObj10 = new IntegerWrapper(durationHour);
109 
110             Object paramObj11 = new IntegerWrapper(durationMinute);
111 
112             Object paramObj12 = new BooleanWrapper(allDay);
113 
114             Object paramObj13 = new BooleanWrapper(timeZoneSensitive);
115 
116             Object paramObj14 = type;
117 
118             if (type == null) {
119                 paramObj14 = new NullWrapper("java.lang.String");
120             }
121 
122             Object paramObj15 = new BooleanWrapper(repeating);
123 
124             Object paramObj16 = recurrence;
125 
126             if (recurrence == null) {
127                 paramObj16 = new NullWrapper(
128                         "com.liferay.portal.kernel.cal.TZSRecurrence");
129             }
130 
131             Object paramObj17 = new IntegerWrapper(remindBy);
132 
133             Object paramObj18 = new IntegerWrapper(firstReminder);
134 
135             Object paramObj19 = new IntegerWrapper(secondReminder);
136 
137             Object paramObj20 = serviceContext;
138 
139             if (serviceContext == null) {
140                 paramObj20 = new NullWrapper(
141                         "com.liferay.portal.service.ServiceContext");
142             }
143 
144             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
145                     "addEvent",
146                     new Object[] {
147                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
148                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
149                         paramObj10, paramObj11, paramObj12, paramObj13,
150                         paramObj14, paramObj15, paramObj16, paramObj17,
151                         paramObj18, paramObj19, paramObj20
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.kernel.exception.PortalException) {
161                     throw (com.liferay.portal.kernel.exception.PortalException)e;
162                 }
163 
164                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
165                     throw (com.liferay.portal.kernel.exception.SystemException)e;
166                 }
167 
168                 throw new com.liferay.portal.kernel.exception.SystemException(e);
169             }
170 
171             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
172         }
173         catch (com.liferay.portal.kernel.exception.SystemException se) {
174             _log.error(se, se);
175 
176             throw se;
177         }
178     }
179 
180     public static void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
181         throws com.liferay.portal.kernel.exception.PortalException,
182             com.liferay.portal.kernel.exception.SystemException {
183         try {
184             Object paramObj0 = new LongWrapper(eventId);
185 
186             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
187                     "deleteEvent", new Object[] { paramObj0 });
188 
189             try {
190                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
191             }
192             catch (Exception e) {
193                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
194                     throw (com.liferay.portal.kernel.exception.PortalException)e;
195                 }
196 
197                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
198                     throw (com.liferay.portal.kernel.exception.SystemException)e;
199                 }
200 
201                 throw new com.liferay.portal.kernel.exception.SystemException(e);
202             }
203         }
204         catch (com.liferay.portal.kernel.exception.SystemException se) {
205             _log.error(se, se);
206 
207             throw se;
208         }
209     }
210 
211     public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
212         long eventId)
213         throws com.liferay.portal.kernel.exception.PortalException,
214             com.liferay.portal.kernel.exception.SystemException {
215         try {
216             Object paramObj0 = new LongWrapper(eventId);
217 
218             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
219                     "exportEvent", new Object[] { paramObj0 });
220 
221             Object returnObj = null;
222 
223             try {
224                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
225             }
226             catch (Exception e) {
227                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
228                     throw (com.liferay.portal.kernel.exception.PortalException)e;
229                 }
230 
231                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
232                     throw (com.liferay.portal.kernel.exception.SystemException)e;
233                 }
234 
235                 throw new com.liferay.portal.kernel.exception.SystemException(e);
236             }
237 
238             return (java.io.File)returnObj;
239         }
240         catch (com.liferay.portal.kernel.exception.SystemException se) {
241             _log.error(se, se);
242 
243             throw se;
244         }
245     }
246 
247     public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
248         long groupId, java.lang.String fileName)
249         throws com.liferay.portal.kernel.exception.PortalException,
250             com.liferay.portal.kernel.exception.SystemException {
251         try {
252             Object paramObj0 = new LongWrapper(groupId);
253 
254             Object paramObj1 = fileName;
255 
256             if (fileName == null) {
257                 paramObj1 = new NullWrapper("java.lang.String");
258             }
259 
260             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
261                     "exportGroupEvents", new Object[] { paramObj0, paramObj1 });
262 
263             Object returnObj = null;
264 
265             try {
266                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
267             }
268             catch (Exception e) {
269                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
270                     throw (com.liferay.portal.kernel.exception.PortalException)e;
271                 }
272 
273                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
274                     throw (com.liferay.portal.kernel.exception.SystemException)e;
275                 }
276 
277                 throw new com.liferay.portal.kernel.exception.SystemException(e);
278             }
279 
280             return (java.io.File)returnObj;
281         }
282         catch (com.liferay.portal.kernel.exception.SystemException se) {
283             _log.error(se, se);
284 
285             throw se;
286         }
287     }
288 
289     public static com.liferay.portlet.calendar.model.CalEvent getEvent(
290         HttpPrincipal httpPrincipal, long eventId)
291         throws com.liferay.portal.kernel.exception.PortalException,
292             com.liferay.portal.kernel.exception.SystemException {
293         try {
294             Object paramObj0 = new LongWrapper(eventId);
295 
296             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
297                     "getEvent", new Object[] { paramObj0 });
298 
299             Object returnObj = null;
300 
301             try {
302                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
303             }
304             catch (Exception e) {
305                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
306                     throw (com.liferay.portal.kernel.exception.PortalException)e;
307                 }
308 
309                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
310                     throw (com.liferay.portal.kernel.exception.SystemException)e;
311                 }
312 
313                 throw new com.liferay.portal.kernel.exception.SystemException(e);
314             }
315 
316             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
317         }
318         catch (com.liferay.portal.kernel.exception.SystemException se) {
319             _log.error(se, se);
320 
321             throw se;
322         }
323     }
324 
325     public static void importICal4j(HttpPrincipal httpPrincipal, long groupId,
326         java.io.File file)
327         throws com.liferay.portal.kernel.exception.PortalException,
328             com.liferay.portal.kernel.exception.SystemException {
329         try {
330             Object paramObj0 = new LongWrapper(groupId);
331 
332             Object paramObj1 = file;
333 
334             if (file == null) {
335                 paramObj1 = new NullWrapper("java.io.File");
336             }
337 
338             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
339                     "importICal4j", new Object[] { paramObj0, paramObj1 });
340 
341             try {
342                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
343             }
344             catch (Exception e) {
345                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
346                     throw (com.liferay.portal.kernel.exception.PortalException)e;
347                 }
348 
349                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
350                     throw (com.liferay.portal.kernel.exception.SystemException)e;
351                 }
352 
353                 throw new com.liferay.portal.kernel.exception.SystemException(e);
354             }
355         }
356         catch (com.liferay.portal.kernel.exception.SystemException se) {
357             _log.error(se, se);
358 
359             throw se;
360         }
361     }
362 
363     public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
364         HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
365         java.lang.String description, int startDateMonth, int startDateDay,
366         int startDateYear, int startDateHour, int startDateMinute,
367         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
368         int durationMinute, boolean allDay, boolean timeZoneSensitive,
369         java.lang.String type, boolean repeating,
370         com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
371         int firstReminder, int secondReminder,
372         com.liferay.portal.service.ServiceContext serviceContext)
373         throws com.liferay.portal.kernel.exception.PortalException,
374             com.liferay.portal.kernel.exception.SystemException {
375         try {
376             Object paramObj0 = new LongWrapper(eventId);
377 
378             Object paramObj1 = title;
379 
380             if (title == null) {
381                 paramObj1 = new NullWrapper("java.lang.String");
382             }
383 
384             Object paramObj2 = description;
385 
386             if (description == null) {
387                 paramObj2 = new NullWrapper("java.lang.String");
388             }
389 
390             Object paramObj3 = new IntegerWrapper(startDateMonth);
391 
392             Object paramObj4 = new IntegerWrapper(startDateDay);
393 
394             Object paramObj5 = new IntegerWrapper(startDateYear);
395 
396             Object paramObj6 = new IntegerWrapper(startDateHour);
397 
398             Object paramObj7 = new IntegerWrapper(startDateMinute);
399 
400             Object paramObj8 = new IntegerWrapper(endDateMonth);
401 
402             Object paramObj9 = new IntegerWrapper(endDateDay);
403 
404             Object paramObj10 = new IntegerWrapper(endDateYear);
405 
406             Object paramObj11 = new IntegerWrapper(durationHour);
407 
408             Object paramObj12 = new IntegerWrapper(durationMinute);
409 
410             Object paramObj13 = new BooleanWrapper(allDay);
411 
412             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
413 
414             Object paramObj15 = type;
415 
416             if (type == null) {
417                 paramObj15 = new NullWrapper("java.lang.String");
418             }
419 
420             Object paramObj16 = new BooleanWrapper(repeating);
421 
422             Object paramObj17 = recurrence;
423 
424             if (recurrence == null) {
425                 paramObj17 = new NullWrapper(
426                         "com.liferay.portal.kernel.cal.TZSRecurrence");
427             }
428 
429             Object paramObj18 = new IntegerWrapper(remindBy);
430 
431             Object paramObj19 = new IntegerWrapper(firstReminder);
432 
433             Object paramObj20 = new IntegerWrapper(secondReminder);
434 
435             Object paramObj21 = serviceContext;
436 
437             if (serviceContext == null) {
438                 paramObj21 = new NullWrapper(
439                         "com.liferay.portal.service.ServiceContext");
440             }
441 
442             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
443                     "updateEvent",
444                     new Object[] {
445                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
446                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
447                         paramObj10, paramObj11, paramObj12, paramObj13,
448                         paramObj14, paramObj15, paramObj16, paramObj17,
449                         paramObj18, paramObj19, paramObj20, paramObj21
450                     });
451 
452             Object returnObj = null;
453 
454             try {
455                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
456             }
457             catch (Exception e) {
458                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
459                     throw (com.liferay.portal.kernel.exception.PortalException)e;
460                 }
461 
462                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
463                     throw (com.liferay.portal.kernel.exception.SystemException)e;
464                 }
465 
466                 throw new com.liferay.portal.kernel.exception.SystemException(e);
467             }
468 
469             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
470         }
471         catch (com.liferay.portal.kernel.exception.SystemException se) {
472             _log.error(se, se);
473 
474             throw se;
475         }
476     }
477 
478     private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
479 }