summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebajit Ghosh <debajit@google.com>2009-07-31 00:11:22 -0700
committerDebajit Ghosh <debajit@google.com>2009-07-31 00:32:28 -0700
commit164dc8c8d2650c2b7a7a94f7eb2b96072f1272c8 (patch)
treec54ecf424954e906fef073da4be972a5080ab7df
parentcea16624985cbd82a58cbdb515ded6759c8fe2c8 (diff)
downloadgdata-164dc8c8d2650c2b7a7a94f7eb2b96072f1272c8.tar.gz
Add support for gcal:sendEventNotifications to gdata library.
We'll need to merge this code into the gdata2 library once we're happy with it.
-rw-r--r--src/com/google/wireless/gdata/calendar/data/EventEntry.java12
-rw-r--r--src/com/google/wireless/gdata/calendar/parser/xml/XmlEventsGDataParser.java8
-rw-r--r--src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java5
3 files changed, 24 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 5f2f271..0542cb0 100644
--- a/src/com/google/wireless/gdata/calendar/data/EventEntry.java
+++ b/src/com/google/wireless/gdata/calendar/data/EventEntry.java
@@ -70,6 +70,7 @@ public class EventEntry extends Entry {
private byte visibility = VISIBILITY_DEFAULT;
private byte transparency = TRANSPARENCY_OPAQUE;
private Vector attendees = new Vector();
+ private boolean sendEventNotifications = false;
private Vector whens = new Vector();
private Vector reminders = null;
private String originalEventId = null;
@@ -94,6 +95,7 @@ public class EventEntry extends Entry {
recurrence = null;
visibility = VISIBILITY_DEFAULT;
transparency = TRANSPARENCY_OPAQUE;
+ sendEventNotifications = false;
attendees.removeAllElements();
whens.removeAllElements();
reminders = null;
@@ -160,6 +162,14 @@ public class EventEntry extends Entry {
this.visibility = visibility;
}
+ public boolean getSendEventNotifications() {
+ return sendEventNotifications;
+ }
+
+ public void setSendEventNotifications(boolean sendEventNotifications) {
+ this.sendEventNotifications = sendEventNotifications;
+ }
+
public void clearAttendees() {
attendees.clear();
}
@@ -280,6 +290,8 @@ public class EventEntry extends Entry {
appendIfNotNull(sb, "ORIGINAL_EVENT_ID", originalEventId);
appendIfNotNull(sb, "ORIGINAL_START_TIME", originalEventStartTime);
+ sb.append("SEND_EVENT_NOTIFICATIONS: " + (sendEventNotifications ? "true" : "false"));
+
Enumeration whos = this.attendees.elements();
while (whos.hasMoreElements()) {
Who who = (Who) whos.nextElement();
diff --git a/src/com/google/wireless/gdata/calendar/parser/xml/XmlEventsGDataParser.java b/src/com/google/wireless/gdata/calendar/parser/xml/XmlEventsGDataParser.java
index 7ec447e..920a8d5 100644
--- a/src/com/google/wireless/gdata/calendar/parser/xml/XmlEventsGDataParser.java
+++ b/src/com/google/wireless/gdata/calendar/parser/xml/XmlEventsGDataParser.java
@@ -152,7 +152,13 @@ public class XmlEventsGDataParser extends XmlGDataParser {
eventEntry.setVisibility(visibility);
} else if ("who".equals(name)) {
handleWho(eventEntry);
- } else if ("when".equals(name)) {
+ } else if ("sendEventNotifications".equals(name)) {
+ // TODO: check that the namespace is gCal
+ String value = parser.getAttributeValue(null /* ns */, "value");
+ if ("true".equals(value)) {
+ eventEntry.setSendEventNotifications(true);
+ }
+ } else if ("when".equals(name)) {
handleWhen(eventEntry);
} else if ("reminder".equals(name)) {
if (!hasSeenReminder) {
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 ccb701f..eae45fd 100644
--- a/src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java
+++ b/src/com/google/wireless/gdata/calendar/serializer/xml/XmlEventEntryGDataSerializer.java
@@ -54,6 +54,11 @@ public class XmlEventEntryGDataSerializer extends XmlEntryGDataSerializer {
serializeEventStatus(serializer, entry.getStatus());
serializeTransparency(serializer, entry.getTransparency());
serializeVisibility(serializer, entry.getVisibility());
+ if (entry.getSendEventNotifications()) {
+ serializer.startTag(NAMESPACE_GCAL_URI, "sendEventNotifications");
+ serializer.attribute(null /* ns */, "value", "true");
+ serializer.endTag(NAMESPACE_GCAL_URI, "sendEventNotifications");
+ }
Enumeration attendees = entry.getAttendees().elements();
while (attendees.hasMoreElements()) {
Who attendee = (Who) attendees.nextElement();