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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.http.TunnelUtil;
026    
027    import com.liferay.portlet.calendar.service.CalEventServiceUtil;
028    
029    /**
030     * <p>
031     * This class provides a HTTP utility for the
032     * {@link com.liferay.portlet.calendar.service.CalEventServiceUtil} service utility. The
033     * static methods of this class calls the same methods of the service utility.
034     * However, the signatures are different because it requires an additional
035     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
036     * </p>
037     *
038     * <p>
039     * The benefits of using the HTTP utility is that it is fast and allows for
040     * tunneling without the cost of serializing to text. The drawback is that it
041     * only works with Java.
042     * </p>
043     *
044     * <p>
045     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
046     * configure security.
047     * </p>
048     *
049     * <p>
050     * The HTTP utility is only generated for remote services.
051     * </p>
052     *
053     * @author    Brian Wing Shun Chan
054     * @see       CalEventServiceSoap
055     * @see       com.liferay.portal.security.auth.HttpPrincipal
056     * @see       com.liferay.portlet.calendar.service.CalEventServiceUtil
057     * @generated
058     */
059    public class CalEventServiceHttp {
060            public static com.liferay.portlet.calendar.model.CalEvent addEvent(
061                    HttpPrincipal httpPrincipal, java.lang.String title,
062                    java.lang.String description, int startDateMonth, int startDateDay,
063                    int startDateYear, int startDateHour, int startDateMinute,
064                    int endDateMonth, int endDateDay, int endDateYear, int durationHour,
065                    int durationMinute, boolean allDay, boolean timeZoneSensitive,
066                    java.lang.String type, boolean repeating,
067                    com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
068                    int firstReminder, int secondReminder,
069                    com.liferay.portal.service.ServiceContext serviceContext)
070                    throws com.liferay.portal.kernel.exception.PortalException,
071                            com.liferay.portal.kernel.exception.SystemException {
072                    try {
073                            Object paramObj0 = title;
074    
075                            if (title == null) {
076                                    paramObj0 = new NullWrapper("java.lang.String");
077                            }
078    
079                            Object paramObj1 = description;
080    
081                            if (description == null) {
082                                    paramObj1 = new NullWrapper("java.lang.String");
083                            }
084    
085                            Object paramObj2 = new IntegerWrapper(startDateMonth);
086    
087                            Object paramObj3 = new IntegerWrapper(startDateDay);
088    
089                            Object paramObj4 = new IntegerWrapper(startDateYear);
090    
091                            Object paramObj5 = new IntegerWrapper(startDateHour);
092    
093                            Object paramObj6 = new IntegerWrapper(startDateMinute);
094    
095                            Object paramObj7 = new IntegerWrapper(endDateMonth);
096    
097                            Object paramObj8 = new IntegerWrapper(endDateDay);
098    
099                            Object paramObj9 = new IntegerWrapper(endDateYear);
100    
101                            Object paramObj10 = new IntegerWrapper(durationHour);
102    
103                            Object paramObj11 = new IntegerWrapper(durationMinute);
104    
105                            Object paramObj12 = new BooleanWrapper(allDay);
106    
107                            Object paramObj13 = new BooleanWrapper(timeZoneSensitive);
108    
109                            Object paramObj14 = type;
110    
111                            if (type == null) {
112                                    paramObj14 = new NullWrapper("java.lang.String");
113                            }
114    
115                            Object paramObj15 = new BooleanWrapper(repeating);
116    
117                            Object paramObj16 = recurrence;
118    
119                            if (recurrence == null) {
120                                    paramObj16 = new NullWrapper(
121                                                    "com.liferay.portal.kernel.cal.TZSRecurrence");
122                            }
123    
124                            Object paramObj17 = new IntegerWrapper(remindBy);
125    
126                            Object paramObj18 = new IntegerWrapper(firstReminder);
127    
128                            Object paramObj19 = new IntegerWrapper(secondReminder);
129    
130                            Object paramObj20 = serviceContext;
131    
132                            if (serviceContext == null) {
133                                    paramObj20 = new NullWrapper(
134                                                    "com.liferay.portal.service.ServiceContext");
135                            }
136    
137                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
138                                            "addEvent",
139                                            new Object[] {
140                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
141                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
142                                                    paramObj10, paramObj11, paramObj12, paramObj13,
143                                                    paramObj14, paramObj15, paramObj16, paramObj17,
144                                                    paramObj18, paramObj19, paramObj20
145                                            });
146    
147                            Object returnObj = null;
148    
149                            try {
150                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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 (com.liferay.portlet.calendar.model.CalEvent)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 void deleteEvent(HttpPrincipal httpPrincipal, long eventId)
174                    throws com.liferay.portal.kernel.exception.PortalException,
175                            com.liferay.portal.kernel.exception.SystemException {
176                    try {
177                            Object paramObj0 = new LongWrapper(eventId);
178    
179                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
180                                            "deleteEvent", new Object[] { paramObj0 });
181    
182                            try {
183                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
184                            }
185                            catch (Exception e) {
186                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
187                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
188                                    }
189    
190                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
191                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
192                                    }
193    
194                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
195                            }
196                    }
197                    catch (com.liferay.portal.kernel.exception.SystemException se) {
198                            _log.error(se, se);
199    
200                            throw se;
201                    }
202            }
203    
204            public static java.io.File exportEvent(HttpPrincipal httpPrincipal,
205                    long eventId)
206                    throws com.liferay.portal.kernel.exception.PortalException,
207                            com.liferay.portal.kernel.exception.SystemException {
208                    try {
209                            Object paramObj0 = new LongWrapper(eventId);
210    
211                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
212                                            "exportEvent", new Object[] { paramObj0 });
213    
214                            Object returnObj = null;
215    
216                            try {
217                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
218                            }
219                            catch (Exception e) {
220                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
221                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
222                                    }
223    
224                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
225                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230    
231                            return (java.io.File)returnObj;
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            public static java.io.File exportGroupEvents(HttpPrincipal httpPrincipal,
241                    long groupId, java.lang.String fileName)
242                    throws com.liferay.portal.kernel.exception.PortalException,
243                            com.liferay.portal.kernel.exception.SystemException {
244                    try {
245                            Object paramObj0 = new LongWrapper(groupId);
246    
247                            Object paramObj1 = fileName;
248    
249                            if (fileName == null) {
250                                    paramObj1 = new NullWrapper("java.lang.String");
251                            }
252    
253                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
254                                            "exportGroupEvents", new Object[] { paramObj0, paramObj1 });
255    
256                            Object returnObj = null;
257    
258                            try {
259                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
260                            }
261                            catch (Exception e) {
262                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
263                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
264                                    }
265    
266                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
267                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
268                                    }
269    
270                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
271                            }
272    
273                            return (java.io.File)returnObj;
274                    }
275                    catch (com.liferay.portal.kernel.exception.SystemException se) {
276                            _log.error(se, se);
277    
278                            throw se;
279                    }
280            }
281    
282            public static com.liferay.portlet.calendar.model.CalEvent getEvent(
283                    HttpPrincipal httpPrincipal, long eventId)
284                    throws com.liferay.portal.kernel.exception.PortalException,
285                            com.liferay.portal.kernel.exception.SystemException {
286                    try {
287                            Object paramObj0 = new LongWrapper(eventId);
288    
289                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
290                                            "getEvent", new Object[] { paramObj0 });
291    
292                            Object returnObj = null;
293    
294                            try {
295                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
296                            }
297                            catch (Exception e) {
298                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
299                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
300                                    }
301    
302                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
303                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
304                                    }
305    
306                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
307                            }
308    
309                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
310                    }
311                    catch (com.liferay.portal.kernel.exception.SystemException se) {
312                            _log.error(se, se);
313    
314                            throw se;
315                    }
316            }
317    
318            public static void importICal4j(HttpPrincipal httpPrincipal, long groupId,
319                    java.io.File file)
320                    throws com.liferay.portal.kernel.exception.PortalException,
321                            com.liferay.portal.kernel.exception.SystemException {
322                    try {
323                            Object paramObj0 = new LongWrapper(groupId);
324    
325                            Object paramObj1 = file;
326    
327                            if (file == null) {
328                                    paramObj1 = new NullWrapper("java.io.File");
329                            }
330    
331                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
332                                            "importICal4j", new Object[] { paramObj0, paramObj1 });
333    
334                            try {
335                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
336                            }
337                            catch (Exception e) {
338                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
339                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
340                                    }
341    
342                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
343                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
344                                    }
345    
346                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
347                            }
348                    }
349                    catch (com.liferay.portal.kernel.exception.SystemException se) {
350                            _log.error(se, se);
351    
352                            throw se;
353                    }
354            }
355    
356            public static com.liferay.portlet.calendar.model.CalEvent updateEvent(
357                    HttpPrincipal httpPrincipal, long eventId, java.lang.String title,
358                    java.lang.String description, int startDateMonth, int startDateDay,
359                    int startDateYear, int startDateHour, int startDateMinute,
360                    int endDateMonth, int endDateDay, int endDateYear, int durationHour,
361                    int durationMinute, boolean allDay, boolean timeZoneSensitive,
362                    java.lang.String type, boolean repeating,
363                    com.liferay.portal.kernel.cal.TZSRecurrence recurrence, int remindBy,
364                    int firstReminder, int secondReminder,
365                    com.liferay.portal.service.ServiceContext serviceContext)
366                    throws com.liferay.portal.kernel.exception.PortalException,
367                            com.liferay.portal.kernel.exception.SystemException {
368                    try {
369                            Object paramObj0 = new LongWrapper(eventId);
370    
371                            Object paramObj1 = title;
372    
373                            if (title == null) {
374                                    paramObj1 = new NullWrapper("java.lang.String");
375                            }
376    
377                            Object paramObj2 = description;
378    
379                            if (description == null) {
380                                    paramObj2 = new NullWrapper("java.lang.String");
381                            }
382    
383                            Object paramObj3 = new IntegerWrapper(startDateMonth);
384    
385                            Object paramObj4 = new IntegerWrapper(startDateDay);
386    
387                            Object paramObj5 = new IntegerWrapper(startDateYear);
388    
389                            Object paramObj6 = new IntegerWrapper(startDateHour);
390    
391                            Object paramObj7 = new IntegerWrapper(startDateMinute);
392    
393                            Object paramObj8 = new IntegerWrapper(endDateMonth);
394    
395                            Object paramObj9 = new IntegerWrapper(endDateDay);
396    
397                            Object paramObj10 = new IntegerWrapper(endDateYear);
398    
399                            Object paramObj11 = new IntegerWrapper(durationHour);
400    
401                            Object paramObj12 = new IntegerWrapper(durationMinute);
402    
403                            Object paramObj13 = new BooleanWrapper(allDay);
404    
405                            Object paramObj14 = new BooleanWrapper(timeZoneSensitive);
406    
407                            Object paramObj15 = type;
408    
409                            if (type == null) {
410                                    paramObj15 = new NullWrapper("java.lang.String");
411                            }
412    
413                            Object paramObj16 = new BooleanWrapper(repeating);
414    
415                            Object paramObj17 = recurrence;
416    
417                            if (recurrence == null) {
418                                    paramObj17 = new NullWrapper(
419                                                    "com.liferay.portal.kernel.cal.TZSRecurrence");
420                            }
421    
422                            Object paramObj18 = new IntegerWrapper(remindBy);
423    
424                            Object paramObj19 = new IntegerWrapper(firstReminder);
425    
426                            Object paramObj20 = new IntegerWrapper(secondReminder);
427    
428                            Object paramObj21 = serviceContext;
429    
430                            if (serviceContext == null) {
431                                    paramObj21 = new NullWrapper(
432                                                    "com.liferay.portal.service.ServiceContext");
433                            }
434    
435                            MethodWrapper methodWrapper = new MethodWrapper(CalEventServiceUtil.class.getName(),
436                                            "updateEvent",
437                                            new Object[] {
438                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
439                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
440                                                    paramObj10, paramObj11, paramObj12, paramObj13,
441                                                    paramObj14, paramObj15, paramObj16, paramObj17,
442                                                    paramObj18, paramObj19, paramObj20, paramObj21
443                                            });
444    
445                            Object returnObj = null;
446    
447                            try {
448                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
449                            }
450                            catch (Exception e) {
451                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
452                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
453                                    }
454    
455                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
456                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
457                                    }
458    
459                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
460                            }
461    
462                            return (com.liferay.portlet.calendar.model.CalEvent)returnObj;
463                    }
464                    catch (com.liferay.portal.kernel.exception.SystemException se) {
465                            _log.error(se, se);
466    
467                            throw se;
468                    }
469            }
470    
471            private static Log _log = LogFactoryUtil.getLog(CalEventServiceHttp.class);
472    }