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