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