diff options
author | Debajit Ghosh <debajit@google.com> | 2009-08-10 22:21:21 -0700 |
---|---|---|
committer | Debajit Ghosh <debajit@google.com> | 2009-08-11 18:19:17 -0700 |
commit | 6453565a538cb48c481896eab709eba03ab88607 (patch) | |
tree | fe60fc92cfad640e55654ae997cbde403a59c4ad | |
parent | 0c7aea12e37bf285a40ed0f7f31712ed141419f3 (diff) | |
download | gdata-6453565a538cb48c481896eab709eba03ab88607.tar.gz |
adding support for calendar quickadd. quickadd lets you add an event to a
calendar just using natural language, processed on the server-side.
4 files changed, 45 insertions, 1 deletions
diff --git a/src/com/google/wireless/gdata/calendar/data/EventEntry.java b/src/com/google/wireless/gdata/calendar/data/EventEntry.java index 0542cb0..f7e06a3 100644 --- a/src/com/google/wireless/gdata/calendar/data/EventEntry.java +++ b/src/com/google/wireless/gdata/calendar/data/EventEntry.java @@ -78,6 +78,7 @@ public class EventEntry extends Entry { private String where = null; private String commentsUri = null; private Hashtable extendedProperties = null; + private boolean quickAdd = false; /** * Creates a new empty event entry. @@ -104,6 +105,7 @@ public class EventEntry extends Entry { where = null; commentsUri = null; extendedProperties = null; + quickAdd = false; } /** @@ -280,6 +282,14 @@ public class EventEntry extends Entry { this.commentsUri = commentsUri; } + public boolean isQuickAdd() { + return quickAdd; + } + + public void setQuickAdd(boolean quickAdd) { + this.quickAdd = quickAdd; + } + public void toString(StringBuffer sb) { super.toString(sb); sb.append("STATUS: " + status + "\n"); @@ -289,7 +299,7 @@ public class EventEntry extends Entry { appendIfNotNull(sb, "ORIGINAL_EVENT_ID", originalEventId); appendIfNotNull(sb, "ORIGINAL_START_TIME", originalEventStartTime); - + sb.append("QUICK_ADD: " + (quickAdd ? "true" : "false")); sb.append("SEND_EVENT_NOTIFICATIONS: " + (sendEventNotifications ? "true" : "false")); Enumeration whos = this.attendees.elements(); diff --git a/src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java b/src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java index eae45fd..1081756 100644 --- a/src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java +++ b/src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java @@ -99,6 +99,8 @@ public class XmlEventEntryGDataSerializer extends XmlEntryGDataSerializer { serializeExtendedProperty(serializer, propertyName, propertyValue); } } + + serializeQuickAdd(serializer, entry.isQuickAdd()); } private static void serializeEventStatus(XmlSerializer serializer, @@ -401,4 +403,13 @@ public class XmlEventEntryGDataSerializer extends XmlEntryGDataSerializer { serializer.attribute(null /* ns */, "value", value); serializer.endTag(XmlGDataParser.NAMESPACE_GD_URI, "extendedProperty"); } + + private static void serializeQuickAdd(XmlSerializer serializer, + boolean quickAdd) throws IOException { + if (quickAdd) { + serializer.startTag(NAMESPACE_GCAL, "quickadd"); + serializer.attribute(null /* ns */, "value", "true"); + serializer.endTag(NAMESPACE_GCAL, "quickadd"); + } + } } diff --git a/src/com/google/wireless/gdata2/calendar/data/EventEntry.java b/src/com/google/wireless/gdata2/calendar/data/EventEntry.java index c0bf75f..e5a5f9c 100644 --- a/src/com/google/wireless/gdata2/calendar/data/EventEntry.java +++ b/src/com/google/wireless/gdata2/calendar/data/EventEntry.java @@ -77,6 +77,7 @@ public class EventEntry extends Entry { private String where = null; private String commentsUri = null; private Hashtable extendedProperties = null; + private boolean quickAdd = false; /** * Creates a new empty event entry. @@ -102,6 +103,7 @@ public class EventEntry extends Entry { where = null; commentsUri = null; extendedProperties = null; + quickAdd = false; } /** @@ -270,6 +272,14 @@ public class EventEntry extends Entry { this.commentsUri = commentsUri; } + public boolean isQuickAdd() { + return quickAdd; + } + + public void setQuickAdd(boolean quickAdd) { + this.quickAdd = quickAdd; + } + public void toString(StringBuffer sb) { super.toString(sb); sb.append("STATUS: " + status + "\n"); @@ -280,6 +290,8 @@ public class EventEntry extends Entry { appendIfNotNull(sb, "ORIGINAL_EVENT_ID", originalEventId); appendIfNotNull(sb, "ORIGINAL_START_TIME", originalEventStartTime); + sb.append("QUICK_ADD: " + (quickAdd ? "true" : "false")); + Enumeration whos = this.attendees.elements(); while (whos.hasMoreElements()) { Who who = (Who) whos.nextElement(); diff --git a/src/com/google/wireless/gdata2/calendar/serializer/xml/XmlEventEntryGDataSerializer.java b/src/com/google/wireless/gdata2/calendar/serializer/xml/XmlEventEntryGDataSerializer.java index f16eb5d..ce16a77 100644 --- a/src/com/google/wireless/gdata2/calendar/serializer/xml/XmlEventEntryGDataSerializer.java +++ b/src/com/google/wireless/gdata2/calendar/serializer/xml/XmlEventEntryGDataSerializer.java @@ -94,6 +94,8 @@ public class XmlEventEntryGDataSerializer extends XmlEntryGDataSerializer { serializeExtendedProperty(serializer, propertyName, propertyValue); } } + + serializeQuickAdd(serializer, entry.isQuickAdd()); } private static void serializeEventStatus(XmlSerializer serializer, @@ -396,4 +398,13 @@ public class XmlEventEntryGDataSerializer extends XmlEntryGDataSerializer { serializer.attribute(null /* ns */, "value", value); serializer.endTag(XmlGDataParser.NAMESPACE_GD_URI, "extendedProperty"); } + + private static void serializeQuickAdd(XmlSerializer serializer, + boolean quickAdd) throws IOException { + if (quickAdd) { + serializer.startTag(NAMESPACE_GCAL, "quickadd"); + serializer.attribute(null /* ns */, "value", "true"); + serializer.endTag(NAMESPACE_GCAL, "quickadd"); + } + } } |