001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.calendar.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.calendar.service.CalEventServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.calendar.service.CalEventServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       CalEventServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.calendar.service.CalEventServiceUtil
054     * @generated
055     */
056    public class CalEventServiceHttp {
057            public static com.liferay.portlet.calendar.model.CalEvent addEvent(
058                    HttpPrincipal httpPrincipal, java.lang.String title,
059                    java.lang.String description, int startDateMonth, int startDateDay,
060                    int startDateYear, int startDateHour, int startDateMinute,
061                    int endDateMonth, int endDateDay, int endDateYear, int durationHour,
062                    int durationMinute, boolean allDay, boolean timeZoneSensitive,
063                    java.lang.String type, boolean repeating,
064                    com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
065                    int firstReminder, int secondReminder,
066                    com.liferay.portal.service.ServiceContext serviceContext)
067                    throws com.liferay.portal.kernel.exception.PortalException,
068                            com.liferay.portal.kernel.exception.SystemException {
069                    try {
070                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
071                                            "addEvent", _addEventParameterTypes0);
072    
073                            MethodHandler methodHandler = new MethodHandler(methodKey, title,
074                                            description, startDateMonth, startDateDay, startDateYear,
075                                            startDateHour, startDateMinute, endDateMonth, endDateDay,
076                                            endDateYear, durationHour, durationMinute, allDay,
077                                            timeZoneSensitive, type, repeating, recurrence, remindBy,
078                                            firstReminder, secondReminder, serviceContext);
079    
080                            Object returnObj = null;
081    
082                            try {
083                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
084                            }
085                            catch (Exception e) {
086                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
087                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
088                                    }
089    
090                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
091                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
092                                    }
093    
094                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
095                            }
096    
097                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
098                    }
099                    catch (com.liferay.portal.kernel.exception.SystemException se) {
100                            _log.error(se, se);
101    
102                            throw se;
103                    }
104            }
105    
106            public static void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
107                    throws com.liferay.portal.kernel.exception.PortalException,
108                            com.liferay.portal.kernel.exception.SystemException {
109                    try {
110                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
111                                            "deleteEvent", _deleteEventParameterTypes1);
112    
113                            MethodHandler methodHandler = new MethodHandler(methodKey, eventId);
114    
115                            try {
116                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
117                            }
118                            catch (Exception e) {
119                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
120                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
121                                    }
122    
123                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
124                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
125                                    }
126    
127                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
128                            }
129                    }
130                    catch (com.liferay.portal.kernel.exception.SystemException se) {
131                            _log.error(se, se);
132    
133                            throw se;
134                    }
135            }
136    
137            public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
138                    long eventId)
139                    throws com.liferay.portal.kernel.exception.PortalException,
140                            com.liferay.portal.kernel.exception.SystemException {
141                    try {
142                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
143                                            "exportEvent", _exportEventParameterTypes2);
144    
145                            MethodHandler methodHandler = new MethodHandler(methodKey, eventId);
146    
147                            Object returnObj = null;
148    
149                            try {
150                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
151                            }
152                            catch (Exception e) {
153                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
154                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
155                                    }
156    
157                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
158                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
159                                    }
160    
161                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
162                            }
163    
164                            return (java.io.File)returnObj;
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
174                    long groupId, java.lang.String fileName)
175                    throws com.liferay.portal.kernel.exception.PortalException,
176                            com.liferay.portal.kernel.exception.SystemException {
177                    try {
178                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
179                                            "exportGroupEvents", _exportGroupEventsParameterTypes3);
180    
181                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
182                                            fileName);
183    
184                            Object returnObj = null;
185    
186                            try {
187                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
188                            }
189                            catch (Exception e) {
190                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
191                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
192                                    }
193    
194                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
195                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
196                                    }
197    
198                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
199                            }
200    
201                            return (java.io.File)returnObj;
202                    }
203                    catch (com.liferay.portal.kernel.exception.SystemException se) {
204                            _log.error(se, se);
205    
206                            throw se;
207                    }
208            }
209    
210            public static com.liferay.portlet.calendar.model.CalEvent getEvent(
211                    HttpPrincipal httpPrincipal, long eventId)
212                    throws com.liferay.portal.kernel.exception.PortalException,
213                            com.liferay.portal.kernel.exception.SystemException {
214                    try {
215                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
216                                            "getEvent", _getEventParameterTypes4);
217    
218                            MethodHandler methodHandler = new MethodHandler(methodKey, eventId);
219    
220                            Object returnObj = null;
221    
222                            try {
223                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
224                            }
225                            catch (Exception e) {
226                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
227                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
228                                    }
229    
230                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
231                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
232                                    }
233    
234                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
235                            }
236    
237                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
238                    }
239                    catch (com.liferay.portal.kernel.exception.SystemException se) {
240                            _log.error(se, se);
241    
242                            throw se;
243                    }
244            }
245    
246            public static void importICal4j(HttpPrincipal httpPrincipal, long groupId,
247                    java.io.File file)
248                    throws com.liferay.portal.kernel.exception.PortalException,
249                            com.liferay.portal.kernel.exception.SystemException {
250                    try {
251                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
252                                            "importICal4j", _importICal4jParameterTypes5);
253    
254                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
255                                            file);
256    
257                            try {
258                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
259                            }
260                            catch (Exception e) {
261                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
262                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
263                                    }
264    
265                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
266                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
267                                    }
268    
269                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
270                            }
271                    }
272                    catch (com.liferay.portal.kernel.exception.SystemException se) {
273                            _log.error(se, se);
274    
275                            throw se;
276                    }
277            }
278    
279            public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
280                    HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
281                    java.lang.String description, int startDateMonth, int startDateDay,
282                    int startDateYear, int startDateHour, int startDateMinute,
283                    int endDateMonth, int endDateDay, int endDateYear, int durationHour,
284                    int durationMinute, boolean allDay, boolean timeZoneSensitive,
285                    java.lang.String type, boolean repeating,
286                    com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
287                    int firstReminder, int secondReminder,
288                    com.liferay.portal.service.ServiceContext serviceContext)
289                    throws com.liferay.portal.kernel.exception.PortalException,
290                            com.liferay.portal.kernel.exception.SystemException {
291                    try {
292                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
293                                            "updateEvent", _updateEventParameterTypes6);
294    
295                            MethodHandler methodHandler = new MethodHandler(methodKey, eventId,
296                                            title, description, startDateMonth, startDateDay,
297                                            startDateYear, startDateHour, startDateMinute,
298                                            endDateMonth, endDateDay, endDateYear, durationHour,
299                                            durationMinute, allDay, timeZoneSensitive, type, repeating,
300                                            recurrence, remindBy, firstReminder, secondReminder,
301                                            serviceContext);
302    
303                            Object returnObj = null;
304    
305                            try {
306                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
307                            }
308                            catch (Exception e) {
309                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
310                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
311                                    }
312    
313                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
314                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
315                                    }
316    
317                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
318                            }
319    
320                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
321                    }
322                    catch (com.liferay.portal.kernel.exception.SystemException se) {
323                            _log.error(se, se);
324    
325                            throw se;
326                    }
327            }
328    
329            private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
330            private static final Class<?>[] _addEventParameterTypes0 = new Class[] {
331                            java.lang.String.class, java.lang.String.class, int.class, int.class,
332                            int.class, int.class, int.class, int.class, int.class, int.class,
333                            int.class, int.class, boolean.class, boolean.class,
334                            java.lang.String.class, boolean.class,
335                            com.liferay.portal.kernel.cal.TZSRecurrence.class, int.class,
336                            int.class, int.class,
337                            com.liferay.portal.service.ServiceContext.class
338                    };
339            private static final Class<?>[] _deleteEventParameterTypes1 = new Class[] {
340                            long.class
341                    };
342            private static final Class<?>[] _exportEventParameterTypes2 = new Class[] {
343                            long.class
344                    };
345            private static final Class<?>[] _exportGroupEventsParameterTypes3 = new Class[] {
346                            long.class, java.lang.String.class
347                    };
348            private static final Class<?>[] _getEventParameterTypes4 = new Class[] {
349                            long.class
350                    };
351            private static final Class<?>[] _importICal4jParameterTypes5 = new Class[] {
352                            long.class, java.io.File.class
353                    };
354            private static final Class<?>[] _updateEventParameterTypes6 = new Class[] {
355                            long.class, java.lang.String.class, java.lang.String.class,
356                            int.class, int.class, int.class, int.class, int.class, int.class,
357                            int.class, int.class, int.class, int.class, boolean.class,
358                            boolean.class, java.lang.String.class, boolean.class,
359                            com.liferay.portal.kernel.cal.TZSRecurrence.class, int.class,
360                            int.class, int.class,
361                            com.liferay.portal.service.ServiceContext.class
362                    };
363    }