1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.calendar.service.CalEventServiceUtil;
25  
26  /**
27   * <a href="CalEventServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.calendar.service.CalEventServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       CalEventServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.calendar.service.CalEventServiceUtil
61   * @generated
62   */
63  public class CalEventServiceHttp {
64      public static com.liferay.portlet.calendar.model.CalEvent addEvent(
65          HttpPrincipal httpPrincipal, java.lang.String title,
66          java.lang.String description, int startDateMonth, int startDateDay,
67          int startDateYear, int startDateHour, int startDateMinute,
68          int endDateMonth, int endDateDay, int endDateYear, int durationHour,
69          int durationMinute, boolean allDay, boolean timeZoneSensitive,
70          java.lang.String type, boolean repeating,
71          com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
72          int firstReminder, int secondReminder,
73          com.liferay.portal.service.ServiceContext serviceContext)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
78                      "addEvent", _addEventParameterTypes0);
79  
80              MethodHandler methodHandler = new MethodHandler(methodKey, title,
81                      description, startDateMonth, startDateDay, startDateYear,
82                      startDateHour, startDateMinute, endDateMonth, endDateDay,
83                      endDateYear, durationHour, durationMinute, allDay,
84                      timeZoneSensitive, type, repeating, recurrence, remindBy,
85                      firstReminder, secondReminder, serviceContext);
86  
87              Object returnObj = null;
88  
89              try {
90                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
91              }
92              catch (Exception e) {
93                  if (e instanceof com.liferay.portal.PortalException) {
94                      throw (com.liferay.portal.PortalException)e;
95                  }
96  
97                  if (e instanceof com.liferay.portal.SystemException) {
98                      throw (com.liferay.portal.SystemException)e;
99                  }
100 
101                 throw new com.liferay.portal.SystemException(e);
102             }
103 
104             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
105         }
106         catch (com.liferay.portal.SystemException se) {
107             _log.error(se, se);
108 
109             throw se;
110         }
111     }
112 
113     public static void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
114         throws com.liferay.portal.PortalException,
115             com.liferay.portal.SystemException {
116         try {
117             MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
118                     "deleteEvent", _deleteEventParameterTypes1);
119 
120             MethodHandler methodHandler = new MethodHandler(methodKey, eventId);
121 
122             try {
123                 TunnelUtil.invoke(httpPrincipal, methodHandler);
124             }
125             catch (Exception e) {
126                 if (e instanceof com.liferay.portal.PortalException) {
127                     throw (com.liferay.portal.PortalException)e;
128                 }
129 
130                 if (e instanceof com.liferay.portal.SystemException) {
131                     throw (com.liferay.portal.SystemException)e;
132                 }
133 
134                 throw new com.liferay.portal.SystemException(e);
135             }
136         }
137         catch (com.liferay.portal.SystemException se) {
138             _log.error(se, se);
139 
140             throw se;
141         }
142     }
143 
144     public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
145         long eventId)
146         throws com.liferay.portal.PortalException,
147             com.liferay.portal.SystemException {
148         try {
149             MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
150                     "exportEvent", _exportEventParameterTypes2);
151 
152             MethodHandler methodHandler = new MethodHandler(methodKey, eventId);
153 
154             Object returnObj = null;
155 
156             try {
157                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
158             }
159             catch (Exception e) {
160                 if (e instanceof com.liferay.portal.PortalException) {
161                     throw (com.liferay.portal.PortalException)e;
162                 }
163 
164                 if (e instanceof com.liferay.portal.SystemException) {
165                     throw (com.liferay.portal.SystemException)e;
166                 }
167 
168                 throw new com.liferay.portal.SystemException(e);
169             }
170 
171             return (java.io.File)returnObj;
172         }
173         catch (com.liferay.portal.SystemException se) {
174             _log.error(se, se);
175 
176             throw se;
177         }
178     }
179 
180     public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
181         long groupId, java.lang.String fileName)
182         throws com.liferay.portal.PortalException,
183             com.liferay.portal.SystemException {
184         try {
185             MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
186                     "exportGroupEvents", _exportGroupEventsParameterTypes3);
187 
188             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
189                     fileName);
190 
191             Object returnObj = null;
192 
193             try {
194                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
195             }
196             catch (Exception e) {
197                 if (e instanceof com.liferay.portal.PortalException) {
198                     throw (com.liferay.portal.PortalException)e;
199                 }
200 
201                 if (e instanceof com.liferay.portal.SystemException) {
202                     throw (com.liferay.portal.SystemException)e;
203                 }
204 
205                 throw new com.liferay.portal.SystemException(e);
206             }
207 
208             return (java.io.File)returnObj;
209         }
210         catch (com.liferay.portal.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     public static com.liferay.portlet.calendar.model.CalEvent getEvent(
218         HttpPrincipal httpPrincipal, long eventId)
219         throws com.liferay.portal.PortalException,
220             com.liferay.portal.SystemException {
221         try {
222             MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
223                     "getEvent", _getEventParameterTypes4);
224 
225             MethodHandler methodHandler = new MethodHandler(methodKey, eventId);
226 
227             Object returnObj = null;
228 
229             try {
230                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
231             }
232             catch (Exception e) {
233                 if (e instanceof com.liferay.portal.PortalException) {
234                     throw (com.liferay.portal.PortalException)e;
235                 }
236 
237                 if (e instanceof com.liferay.portal.SystemException) {
238                     throw (com.liferay.portal.SystemException)e;
239                 }
240 
241                 throw new com.liferay.portal.SystemException(e);
242             }
243 
244             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
245         }
246         catch (com.liferay.portal.SystemException se) {
247             _log.error(se, se);
248 
249             throw se;
250         }
251     }
252 
253     public static void importICal4j(HttpPrincipal httpPrincipal, long groupId,
254         java.io.File file)
255         throws com.liferay.portal.PortalException,
256             com.liferay.portal.SystemException {
257         try {
258             MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
259                     "importICal4j", _importICal4jParameterTypes5);
260 
261             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
262                     file);
263 
264             try {
265                 TunnelUtil.invoke(httpPrincipal, methodHandler);
266             }
267             catch (Exception e) {
268                 if (e instanceof com.liferay.portal.PortalException) {
269                     throw (com.liferay.portal.PortalException)e;
270                 }
271 
272                 if (e instanceof com.liferay.portal.SystemException) {
273                     throw (com.liferay.portal.SystemException)e;
274                 }
275 
276                 throw new com.liferay.portal.SystemException(e);
277             }
278         }
279         catch (com.liferay.portal.SystemException se) {
280             _log.error(se, se);
281 
282             throw se;
283         }
284     }
285 
286     public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
287         HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
288         java.lang.String description, int startDateMonth, int startDateDay,
289         int startDateYear, int startDateHour, int startDateMinute,
290         int endDateMonth, int endDateDay, int endDateYear, int durationHour,
291         int durationMinute, boolean allDay, boolean timeZoneSensitive,
292         java.lang.String type, boolean repeating,
293         com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
294         int firstReminder, int secondReminder,
295         com.liferay.portal.service.ServiceContext serviceContext)
296         throws com.liferay.portal.PortalException,
297             com.liferay.portal.SystemException {
298         try {
299             MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
300                     "updateEvent", _updateEventParameterTypes6);
301 
302             MethodHandler methodHandler = new MethodHandler(methodKey, eventId,
303                     title, description, startDateMonth, startDateDay,
304                     startDateYear, startDateHour, startDateMinute,
305                     endDateMonth, endDateDay, endDateYear, durationHour,
306                     durationMinute, allDay, timeZoneSensitive, type, repeating,
307                     recurrence, remindBy, firstReminder, secondReminder,
308                     serviceContext);
309 
310             Object returnObj = null;
311 
312             try {
313                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
314             }
315             catch (Exception e) {
316                 if (e instanceof com.liferay.portal.PortalException) {
317                     throw (com.liferay.portal.PortalException)e;
318                 }
319 
320                 if (e instanceof com.liferay.portal.SystemException) {
321                     throw (com.liferay.portal.SystemException)e;
322                 }
323 
324                 throw new com.liferay.portal.SystemException(e);
325             }
326 
327             return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
328         }
329         catch (com.liferay.portal.SystemException se) {
330             _log.error(se, se);
331 
332             throw se;
333         }
334     }
335 
336     private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
337     private static final Class<?>[] _addEventParameterTypes0 = new Class[] {
338             java.lang.String.class, java.lang.String.class, int.class, int.class,
339             int.class, int.class, int.class, int.class, int.class, int.class,
340             int.class, int.class, boolean.class, boolean.class,
341             java.lang.String.class, boolean.class,
342             com.liferay.portal.kernel.cal.TZSRecurrence.class, int.class,
343             int.class, int.class,
344             com.liferay.portal.service.ServiceContext.class
345         };
346     private static final Class<?>[] _deleteEventParameterTypes1 = new Class[] {
347             long.class
348         };
349     private static final Class<?>[] _exportEventParameterTypes2 = new Class[] {
350             long.class
351         };
352     private static final Class<?>[] _exportGroupEventsParameterTypes3 = new Class[] {
353             long.class, java.lang.String.class
354         };
355     private static final Class<?>[] _getEventParameterTypes4 = new Class[] {
356             long.class
357         };
358     private static final Class<?>[] _importICal4jParameterTypes5 = new Class[] {
359             long.class, java.io.File.class
360         };
361     private static final Class<?>[] _updateEventParameterTypes6 = new Class[] {
362             long.class, java.lang.String.class, java.lang.String.class,
363             int.class, int.class, int.class, int.class, int.class, int.class,
364             int.class, int.class, int.class, int.class, boolean.class,
365             boolean.class, java.lang.String.class, boolean.class,
366             com.liferay.portal.kernel.cal.TZSRecurrence.class, int.class,
367             int.class, int.class,
368             com.liferay.portal.service.ServiceContext.class
369         };
370 }