001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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", java.lang.String.class, java.lang.String.class,
072                                            int.class, int.class, int.class, int.class, int.class,
073                                            int.class, int.class, int.class, int.class, int.class,
074                                            boolean.class, boolean.class, java.lang.String.class,
075                                            boolean.class,
076                                            com.liferay.portal.kernel.cal.TZSRecurrence.class,
077                                            int.class, int.class, int.class,
078                                            com.liferay.portal.service.ServiceContext.class);
079    
080                            MethodHandler methodHandler = new MethodHandler(methodKey, title,
081                                            description, startDateMonth, startDateDay, startDateYear,
082                                            startDateHour, startDateMinute, endDateMonth, endDateDay,
083                                            endDateYear, durationHour, durationMinute, allDay,
084                                            timeZoneSensitive, type, repeating, recurrence, remindBy,
085                                            firstReminder, secondReminder, serviceContext);
086    
087                            Object returnObj = null;
088    
089                            try {
090                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
091                            }
092                            catch (Exception e) {
093                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
094                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
095                                    }
096    
097                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
098                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
099                                    }
100    
101                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
102                            }
103    
104                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
105                    }
106                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
115                            com.liferay.portal.kernel.exception.SystemException {
116                    try {
117                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
118                                            "deleteEvent", long.class);
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.kernel.exception.PortalException) {
127                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
128                                    }
129    
130                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
131                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
132                                    }
133    
134                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
135                            }
136                    }
137                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
147                            com.liferay.portal.kernel.exception.SystemException {
148                    try {
149                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
150                                            "exportEvent", long.class);
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.kernel.exception.PortalException) {
161                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
162                                    }
163    
164                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
165                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
166                                    }
167    
168                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
169                            }
170    
171                            return (java.io.File)returnObj;
172                    }
173                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
183                            com.liferay.portal.kernel.exception.SystemException {
184                    try {
185                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
186                                            "exportGroupEvents", long.class, java.lang.String.class);
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.kernel.exception.PortalException) {
198                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
199                                    }
200    
201                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
202                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
203                                    }
204    
205                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
206                            }
207    
208                            return (java.io.File)returnObj;
209                    }
210                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
220                            com.liferay.portal.kernel.exception.SystemException {
221                    try {
222                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
223                                            "getEvent", long.class);
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.kernel.exception.PortalException) {
234                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
235                                    }
236    
237                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
238                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
239                                    }
240    
241                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
242                            }
243    
244                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
245                    }
246                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
256                            com.liferay.portal.kernel.exception.SystemException {
257                    try {
258                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
259                                            "importICal4j", long.class, java.io.File.class);
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.kernel.exception.PortalException) {
269                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
270                                    }
271    
272                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
273                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
274                                    }
275    
276                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
277                            }
278                    }
279                    catch (com.liferay.portal.kernel.exception.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.kernel.exception.PortalException,
297                            com.liferay.portal.kernel.exception.SystemException {
298                    try {
299                            MethodKey methodKey = new MethodKey(CalEventServiceUtil.class.getName(),
300                                            "updateEvent", long.class, java.lang.String.class,
301                                            java.lang.String.class, int.class, int.class, int.class,
302                                            int.class, int.class, int.class, int.class, int.class,
303                                            int.class, int.class, boolean.class, boolean.class,
304                                            java.lang.String.class, boolean.class,
305                                            com.liferay.portal.kernel.cal.TZSRecurrence.class,
306                                            int.class, int.class, int.class,
307                                            com.liferay.portal.service.ServiceContext.class);
308    
309                            MethodHandler methodHandler = new MethodHandler(methodKey, eventId,
310                                            title, description, startDateMonth, startDateDay,
311                                            startDateYear, startDateHour, startDateMinute,
312                                            endDateMonth, endDateDay, endDateYear, durationHour,
313                                            durationMinute, allDay, timeZoneSensitive, type, repeating,
314                                            recurrence, remindBy, firstReminder, secondReminder,
315                                            serviceContext);
316    
317                            Object returnObj = null;
318    
319                            try {
320                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
321                            }
322                            catch (Exception e) {
323                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
324                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
325                                    }
326    
327                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
328                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
329                                    }
330    
331                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
332                            }
333    
334                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
335                    }
336                    catch (com.liferay.portal.kernel.exception.SystemException se) {
337                            _log.error(se, se);
338    
339                            throw se;
340                    }
341            }
342    
343            private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
344    }