/** * 保存google事件 * * @param event * @param cid * @throws Exception */ public FDEvent saveGoogleEvent(FDEvent event, FDCalendar cal) throws Exception { Map<String, String> params = new HashMap<String, String>(); // params.put("cid", cal.getId()); // params.put("cid", event.getCalendarId()); // params.put("type", "1" ); // FDPrintln.print("save google event :"+event); // JSONObject obj =event.toJsonObjByGoogle(); // params.put("text", obj.toString() ); params.put("method", "addEvent"); params.put("accountId", cal.getGoogleAccountId()); params.put("calendarId", event.getCalendarId()); FDPrintln.print("save google event :" + event); JSONObject obj = event.toJsonObjByGoogle(); params.put("params", obj.toString()); FDPrintln.print("saveGoogleEvent params " + obj.toString()); FDEvent receiveEvent = null; FDJson json = sendPOSTRequestByJson("user/Google", params); if (json != null) { if (json.getStatusCode() != 1) return null; receiveEvent = new FDEvent(json.getData(), cal, FDCalendarAccount.TYPE_GOOGLE); receiveEvent.setBackground(cal.getBackgroundColor()); receiveEvent.setAccount(cal.getId()); } return receiveEvent; }
public FDJson editGoogleEvent(FDEvent event, FDCalendar cal) throws Exception { Map<String, String> params = new HashMap<String, String>(); // params.put("cid", cid); // params.put("type", "2"); // params.put("eid", event.getId()); // JSONObject obj = event.toJsonObjByGoogle(); // params.put("text", obj.toString()); params.put("method", "updateEvent"); params.put("accountId", cal.getGoogleAccountId()); params.put("calendarId", cal.getId()); params.put("eventId", event.getId()); JSONObject obj = event.toJsonObjByGoogle(); params.put("params", obj.toString()); FDPrintln.print(" edit Google Event params : " + obj.toString()); FDJson json = sendPOSTRequestByJson("user/Google", params); return json; }