001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.calendar.service.http;
022:
023: import com.liferay.portlet.calendar.service.CalEventServiceUtil;
024:
025: import org.json.JSONObject;
026:
027: /**
028: * <a href="CalEventServiceJSON.java.html"><b><i>View Source</i></b></a>
029: *
030: * <p>
031: * ServiceBuilder generated this class. Modifications in this class will be
032: * overwritten the next time is generated.
033: * </p>
034: *
035: * <p>
036: * This class provides a JSON utility for the
037: * <code>com.liferay.portlet.calendar.service.CalEventServiceUtil</code>
038: * service utility. The static methods of this class calls the same methods of
039: * the service utility. However, the signatures are different because it is
040: * difficult for JSON to support certain types.
041: * </p>
042: *
043: * <p>
044: * ServiceBuilder follows certain rules in translating the methods. For example,
045: * if the method in the service utility returns a <code>java.util.List</code>,
046: * that is translated to a <code>org.json.JSONArray</code>. If the method in the
047: * service utility returns a <code>com.liferay.portlet.calendar.model.CalEvent</code>,
048: * that is translated to a <code>org.json.JSONObject</code>. Methods that JSON
049: * cannot safely use are skipped. The logic for the translation is encapsulated
050: * in <code>com.liferay.portlet.calendar.service.http.CalEventJSONSerializer</code>.
051: * </p>
052: *
053: * <p>
054: * This allows you to call the the backend services directly from JavaScript.
055: * See <code>portal-web/docroot/html/portlet/tags_admin/unpacked.js</code> for a
056: * reference of how that portlet uses the generated JavaScript in
057: * <code>portal-web/docroot/html/js/service.js</code> to call the backend
058: * services directly from JavaScript.
059: * </p>
060: *
061: * <p>
062: * The JSON utility is only generated for remote services.
063: * </p>
064: *
065: * @author Brian Wing Shun Chan
066: *
067: * @see com.liferay.portlet.calendar.service.CalEventServiceUtil
068: * @see com.liferay.portlet.calendar.service.http.CalEventJSONSerializer
069: *
070: */
071: public class CalEventServiceJSON {
072: public static JSONObject addEvent(long plid,
073: java.lang.String title, java.lang.String description,
074: int startDateMonth, int startDateDay, int startDateYear,
075: int startDateHour, int startDateMinute, int endDateMonth,
076: int endDateDay, int endDateYear, int durationHour,
077: int durationMinute, boolean allDay,
078: boolean timeZoneSensitive, java.lang.String type,
079: boolean repeating,
080: com.liferay.portal.kernel.cal.Recurrence recurrence,
081: java.lang.String remindBy, int firstReminder,
082: int secondReminder, boolean addCommunityPermissions,
083: boolean addGuestPermissions)
084: throws java.rmi.RemoteException,
085: com.liferay.portal.SystemException,
086: com.liferay.portal.PortalException {
087: com.liferay.portlet.calendar.model.CalEvent returnValue = CalEventServiceUtil
088: .addEvent(plid, title, description, startDateMonth,
089: startDateDay, startDateYear, startDateHour,
090: startDateMinute, endDateMonth, endDateDay,
091: endDateYear, durationHour, durationMinute,
092: allDay, timeZoneSensitive, type, repeating,
093: recurrence, remindBy, firstReminder,
094: secondReminder, addCommunityPermissions,
095: addGuestPermissions);
096:
097: return CalEventJSONSerializer.toJSONObject(returnValue);
098: }
099:
100: public static JSONObject addEvent(long plid,
101: java.lang.String title, java.lang.String description,
102: int startDateMonth, int startDateDay, int startDateYear,
103: int startDateHour, int startDateMinute, int endDateMonth,
104: int endDateDay, int endDateYear, int durationHour,
105: int durationMinute, boolean allDay,
106: boolean timeZoneSensitive, java.lang.String type,
107: boolean repeating,
108: com.liferay.portal.kernel.cal.Recurrence recurrence,
109: java.lang.String remindBy, int firstReminder,
110: int secondReminder,
111: java.lang.String[] communityPermissions,
112: java.lang.String[] guestPermissions)
113: throws java.rmi.RemoteException,
114: com.liferay.portal.SystemException,
115: com.liferay.portal.PortalException {
116: com.liferay.portlet.calendar.model.CalEvent returnValue = CalEventServiceUtil
117: .addEvent(plid, title, description, startDateMonth,
118: startDateDay, startDateYear, startDateHour,
119: startDateMinute, endDateMonth, endDateDay,
120: endDateYear, durationHour, durationMinute,
121: allDay, timeZoneSensitive, type, repeating,
122: recurrence, remindBy, firstReminder,
123: secondReminder, communityPermissions,
124: guestPermissions);
125:
126: return CalEventJSONSerializer.toJSONObject(returnValue);
127: }
128:
129: public static void deleteEvent(long eventId)
130: throws java.rmi.RemoteException,
131: com.liferay.portal.SystemException,
132: com.liferay.portal.PortalException {
133: CalEventServiceUtil.deleteEvent(eventId);
134: }
135:
136: public static JSONObject getEvent(long eventId)
137: throws java.rmi.RemoteException,
138: com.liferay.portal.SystemException,
139: com.liferay.portal.PortalException {
140: com.liferay.portlet.calendar.model.CalEvent returnValue = CalEventServiceUtil
141: .getEvent(eventId);
142:
143: return CalEventJSONSerializer.toJSONObject(returnValue);
144: }
145:
146: public static JSONObject updateEvent(long eventId,
147: java.lang.String title, java.lang.String description,
148: int startDateMonth, int startDateDay, int startDateYear,
149: int startDateHour, int startDateMinute, int endDateMonth,
150: int endDateDay, int endDateYear, int durationHour,
151: int durationMinute, boolean allDay,
152: boolean timeZoneSensitive, java.lang.String type,
153: boolean repeating,
154: com.liferay.portal.kernel.cal.Recurrence recurrence,
155: java.lang.String remindBy, int firstReminder,
156: int secondReminder) throws java.rmi.RemoteException,
157: com.liferay.portal.SystemException,
158: com.liferay.portal.PortalException {
159: com.liferay.portlet.calendar.model.CalEvent returnValue = CalEventServiceUtil
160: .updateEvent(eventId, title, description,
161: startDateMonth, startDateDay, startDateYear,
162: startDateHour, startDateMinute, endDateMonth,
163: endDateDay, endDateYear, durationHour,
164: durationMinute, allDay, timeZoneSensitive,
165: type, repeating, recurrence, remindBy,
166: firstReminder, secondReminder);
167:
168: return CalEventJSONSerializer.toJSONObject(returnValue);
169: }
170: }
|