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, 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,
84          com.liferay.portal.service.ServiceContext serviceContext)
85          throws com.liferay.portal.PortalException,
86              com.liferay.portal.SystemException {
87          try {
88              Object paramObj0 = title;
89  
90              if (title == null) {
91                  paramObj0 = new NullWrapper("java.lang.String");
92              }
93  
94              Object paramObj1 = description;
95  
96              if (description == null) {
97                  paramObj1 = new NullWrapper("java.lang.String");
98              }
99  
100             Object paramObj2 = new IntegerWrapper(startDateMonth);
101 
102             Object paramObj3 = new IntegerWrapper(startDateDay);
103 
104             Object paramObj4 = new IntegerWrapper(startDateYear);
105 
106             Object paramObj5 = new IntegerWrapper(startDateHour);
107 
108             Object paramObj6 = new IntegerWrapper(startDateMinute);
109 
110             Object paramObj7 = new IntegerWrapper(endDateMonth);
111 
112             Object paramObj8 = new IntegerWrapper(endDateDay);
113 
114             Object paramObj9 = new IntegerWrapper(endDateYear);
115 
116             Object paramObj10 = new IntegerWrapper(durationHour);
117 
118             Object paramObj11 = new IntegerWrapper(durationMinute);
119 
120             Object paramObj12 = new BooleanWrapper(allDay);
121 
122             Object paramObj13 = new BooleanWrapper(timeZoneSensitive);
123 
124             Object paramObj14 = type;
125 
126             if (type == null) {
127                 paramObj14 = new NullWrapper("java.lang.String");
128             }
129 
130             Object paramObj15 = new BooleanWrapper(repeating);
131 
132             Object paramObj16 = recurrence;
133 
134             if (recurrence == null) {
135                 paramObj16 = new NullWrapper(
136                         "com.liferay.portal.kernel.cal.TZSRecurrence");
137             }
138 
139             Object paramObj17 = new IntegerWrapper(remindBy);
140 
141             Object paramObj18 = new IntegerWrapper(firstReminder);
142 
143             Object paramObj19 = new IntegerWrapper(secondReminder);
144 
145             Object paramObj20 = serviceContext;
146 
147             if (serviceContext == null) {
148                 paramObj20 = new NullWrapper(
149                         "com.liferay.portal.service.ServiceContext");
150             }
151 
152             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
153                     "addEvent",
154                     new Object[] {
155                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
156                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
157                         paramObj10, paramObj11, paramObj12, paramObj13,
158                         paramObj14, paramObj15, paramObj16, paramObj17,
159                         paramObj18, paramObj19, paramObj20
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 void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
189         throws com.liferay.portal.PortalException,
190             com.liferay.portal.SystemException {
191         try {
192             Object paramObj0 = new LongWrapper(eventId);
193 
194             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
195                     "deleteEvent", new Object[] { paramObj0 });
196 
197             try {
198                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
199             }
200             catch (Exception e) {
201                 if (e instanceof com.liferay.portal.PortalException) {
202                     throw (com.liferay.portal.PortalException)e;
203                 }
204 
205                 if (e instanceof com.liferay.portal.SystemException) {
206                     throw (com.liferay.portal.SystemException)e;
207                 }
208 
209                 throw new com.liferay.portal.SystemException(e);
210             }
211         }
212         catch (com.liferay.portal.SystemException se) {
213             _log.error(se, se);
214 
215             throw se;
216         }
217     }
218 
219     public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
220         long eventId)
221         throws com.liferay.portal.PortalException,
222             com.liferay.portal.SystemException {
223         try {
224             Object paramObj0 = new LongWrapper(eventId);
225 
226             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
227                     "exportEvent", new Object[] { paramObj0 });
228 
229             Object returnObj = null;
230 
231             try {
232                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
233             }
234             catch (Exception e) {
235                 if (e instanceof com.liferay.portal.PortalException) {
236                     throw (com.liferay.portal.PortalException)e;
237                 }
238 
239                 if (e instanceof com.liferay.portal.SystemException) {
240                     throw (com.liferay.portal.SystemException)e;
241                 }
242 
243                 throw new com.liferay.portal.SystemException(e);
244             }
245 
246             return (java.io.File)returnObj;
247         }
248         catch (com.liferay.portal.SystemException se) {
249             _log.error(se, se);
250 
251             throw se;
252         }
253     }
254 
255     public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
256         long groupId, java.lang.String fileName)
257         throws com.liferay.portal.PortalException,
258             com.liferay.portal.SystemException {
259         try {
260             Object paramObj0 = new LongWrapper(groupId);
261 
262             Object paramObj1 = fileName;
263 
264             if (fileName == null) {
265                 paramObj1 = new NullWrapper("java.lang.String");
266             }
267 
268             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
269                     "exportGroupEvents", new Object[] { paramObj0, paramObj1 });
270 
271             Object returnObj = null;
272 
273             try {
274                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
275             }
276             catch (Exception e) {
277                 if (e instanceof com.liferay.portal.PortalException) {
278                     throw (com.liferay.portal.PortalException)e;
279                 }
280 
281                 if (e instanceof com.liferay.portal.SystemException) {
282                     throw (com.liferay.portal.SystemException)e;
283                 }
284 
285                 throw new com.liferay.portal.SystemException(e);
286             }
287 
288             return (java.io.File)returnObj;
289         }
290         catch (com.liferay.portal.SystemException se) {
291             _log.error(se, se);
292 
293             throw se;
294         }
295     }
296 
297     public static com.liferay.portlet.calendar.model.CalEvent getEvent(
298         HttpPrincipal httpPrincipal, long eventId)
299         throws com.liferay.portal.PortalException,
300             com.liferay.portal.SystemException {
301         try {
302             Object paramObj0 = new LongWrapper(eventId);
303 
304             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
305                     "getEvent", new Object[] { paramObj0 });
306 
307             Object returnObj = null;
308 
309             try {
310                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
311             }
312             catch (Exception e) {
313                 if (e instanceof com.liferay.portal.PortalException) {
314                     throw (com.liferay.portal.PortalException)e;
315                 }
316 
317                 if (e instanceof com.liferay.portal.SystemException) {
318                     throw (com.liferay.portal.SystemException)e;
319                 }
320 
321                 throw new com.liferay.portal.SystemException(e);
322             }
323 
324             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
325         }
326         catch (com.liferay.portal.SystemException se) {
327             _log.error(se, se);
328 
329             throw se;
330         }
331     }
332 
333     public static void importICal4j(HttpPrincipal httpPrincipal, long groupId,
334         java.io.File file)
335         throws com.liferay.portal.PortalException,
336             com.liferay.portal.SystemException {
337         try {
338             Object paramObj0 = new LongWrapper(groupId);
339 
340             Object paramObj1 = file;
341 
342             if (file == null) {
343                 paramObj1 = new NullWrapper("java.io.File");
344             }
345 
346             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
347                     "importICal4j", new Object[] { paramObj0, paramObj1 });
348 
349             try {
350                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
351             }
352             catch (Exception e) {
353                 if (e instanceof com.liferay.portal.PortalException) {
354                     throw (com.liferay.portal.PortalException)e;
355                 }
356 
357                 if (e instanceof com.liferay.portal.SystemException) {
358                     throw (com.liferay.portal.SystemException)e;
359                 }
360 
361                 throw new com.liferay.portal.SystemException(e);
362             }
363         }
364         catch (com.liferay.portal.SystemException se) {
365             _log.error(se, se);
366 
367             throw se;
368         }
369     }
370 
371     public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
372         HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
373         java.lang.String description, int startDateMonth, int startDateDay,
374         int startDateYear, int startDateHour, int startDateMinute,
375         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
376         int durationMinute, boolean allDay, boolean timeZoneSensitive,
377         java.lang.String type, boolean repeating,
378         com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
379         int firstReminder, int secondReminder,
380         com.liferay.portal.service.ServiceContext serviceContext)
381         throws com.liferay.portal.PortalException,
382             com.liferay.portal.SystemException {
383         try {
384             Object paramObj0 = new LongWrapper(eventId);
385 
386             Object paramObj1 = title;
387 
388             if (title == null) {
389                 paramObj1 = new NullWrapper("java.lang.String");
390             }
391 
392             Object paramObj2 = description;
393 
394             if (description == null) {
395                 paramObj2 = new NullWrapper("java.lang.String");
396             }
397 
398             Object paramObj3 = new IntegerWrapper(startDateMonth);
399 
400             Object paramObj4 = new IntegerWrapper(startDateDay);
401 
402             Object paramObj5 = new IntegerWrapper(startDateYear);
403 
404             Object paramObj6 = new IntegerWrapper(startDateHour);
405 
406             Object paramObj7 = new IntegerWrapper(startDateMinute);
407 
408             Object paramObj8 = new IntegerWrapper(endDateMonth);
409 
410             Object paramObj9 = new IntegerWrapper(endDateDay);
411 
412             Object paramObj10 = new IntegerWrapper(endDateYear);
413 
414             Object paramObj11 = new IntegerWrapper(durationHour);
415 
416             Object paramObj12 = new IntegerWrapper(durationMinute);
417 
418             Object paramObj13 = new BooleanWrapper(allDay);
419 
420             Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
421 
422             Object paramObj15 = type;
423 
424             if (type == null) {
425                 paramObj15 = new NullWrapper("java.lang.String");
426             }
427 
428             Object paramObj16 = new BooleanWrapper(repeating);
429 
430             Object paramObj17 = recurrence;
431 
432             if (recurrence == null) {
433                 paramObj17 = new NullWrapper(
434                         "com.liferay.portal.kernel.cal.TZSRecurrence");
435             }
436 
437             Object paramObj18 = new IntegerWrapper(remindBy);
438 
439             Object paramObj19 = new IntegerWrapper(firstReminder);
440 
441             Object paramObj20 = new IntegerWrapper(secondReminder);
442 
443             Object paramObj21 = serviceContext;
444 
445             if (serviceContext == null) {
446                 paramObj21 = new NullWrapper(
447                         "com.liferay.portal.service.ServiceContext");
448             }
449 
450             MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
451                     "updateEvent",
452                     new Object[] {
453                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
454                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
455                         paramObj10, paramObj11, paramObj12, paramObj13,
456                         paramObj14, paramObj15, paramObj16, paramObj17,
457                         paramObj18, paramObj19, paramObj20, paramObj21
458                     });
459 
460             Object returnObj = null;
461 
462             try {
463                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
464             }
465             catch (Exception e) {
466                 if (e instanceof com.liferay.portal.PortalException) {
467                     throw (com.liferay.portal.PortalException)e;
468                 }
469 
470                 if (e instanceof com.liferay.portal.SystemException) {
471                     throw (com.liferay.portal.SystemException)e;
472                 }
473 
474                 throw new com.liferay.portal.SystemException(e);
475             }
476 
477             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
478         }
479         catch (com.liferay.portal.SystemException se) {
480             _log.error(se, se);
481 
482             throw se;
483         }
484     }
485 
486     private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
487 }