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