Commit d2757a52 authored by Mickaël Guessant's avatar Mickaël Guessant

Caldav: EWS refactoring, implement allday, sensitivity and categories update

git-svn-id: https://svn.code.sf.net/p/davmail/code/trunk@2511 3d1905a2-6b24-0410-a738-b14d5a86fcbd
parent 32666891
...@@ -377,7 +377,7 @@ public class VProperty { ...@@ -377,7 +377,7 @@ public class VProperty {
if (c == ',' && if (c == ',' &&
// multivalued properties // multivalued properties
("N".equals(key) || ("N".equals(key) ||
"CATEGORIES".equals(key) || //"CATEGORIES".equals(key) ||
"NICKNAME".equals(key) "NICKNAME".equals(key)
)) { )) {
// convert multiple values to multiline values (e.g. street) // convert multiple values to multiline values (e.g. street)
......
...@@ -1559,8 +1559,31 @@ public class EwsExchangeSession extends ExchangeSession { ...@@ -1559,8 +1559,31 @@ public class EwsExchangeSession extends ExchangeSession {
// TODO: update all event fields and handle other occurrences // TODO: update all event fields and handle other occurrences
updates.add(Field.createFieldUpdate("dtstart", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DTSTART")))); updates.add(Field.createFieldUpdate("dtstart", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DTSTART"))));
updates.add(Field.createFieldUpdate("dtend", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DTEND")))); updates.add(Field.createFieldUpdate("dtend", convertCalendarDateToExchange(vCalendar.getFirstVeventPropertyValue("DTEND"))));
updates.add(Field.createFieldUpdate("isalldayevent", Boolean.toString(vCalendar.isCdoAllDay())));
String eventClass = vCalendar.getFirstVeventPropertyValue("CLASS");
if ("PRIVATE".equals(eventClass)) {
eventClass = "Private";
} else if ("CONFIDENTIAL".equals(eventClass)) {
eventClass = "Confidential";
} else {
// PUBLIC
eventClass = "Normal";
}
updates.add(Field.createFieldUpdate("itemsensitivity", eventClass));
updates.add(Field.createFieldUpdate("description", vCalendar.getFirstVeventPropertyValue("DESCRIPTION"))); updates.add(Field.createFieldUpdate("description", vCalendar.getFirstVeventPropertyValue("DESCRIPTION")));
updates.add(Field.createFieldUpdate("location", vCalendar.getFirstVeventPropertyValue("LOCATION"))); updates.add(Field.createFieldUpdate("location", vCalendar.getFirstVeventPropertyValue("LOCATION")));
// Collect categories on multiple lines
List<VProperty> categories = vCalendar.getFirstVevent().getProperties("CATEGORIES");
if (categories != null) {
HashSet<String> categoryValues = new HashSet<String>();
for (VProperty category: categories) {
categoryValues.add(category.getValue());
}
updates.add(Field.createFieldUpdate("keywords", StringUtil.join(categoryValues, ",")));
}
VProperty rrule = vCalendar.getFirstVevent().getProperty("RRULE"); VProperty rrule = vCalendar.getFirstVevent().getProperty("RRULE");
if (rrule != null) { if (rrule != null) {
...@@ -1696,8 +1719,8 @@ public class EwsExchangeSession extends ExchangeSession { ...@@ -1696,8 +1719,8 @@ public class EwsExchangeSession extends ExchangeSession {
} else { } else {
// update existing item // update existing item
if (currentItemId != null && /*) { if (currentItemId != null) {
if (*/vCalendar.isMeeting() && !vCalendar.isMeetingOrganizer()) { if (vCalendar.isMeeting() && !vCalendar.isMeetingOrganizer()) {
// This is a meeting response // This is a meeting response
EWSMethod.Item item = new EWSMethod.Item(); EWSMethod.Item item = new EWSMethod.Item();
...@@ -1708,12 +1731,12 @@ public class EwsExchangeSession extends ExchangeSession { ...@@ -1708,12 +1731,12 @@ public class EwsExchangeSession extends ExchangeSession {
getFolderId(SENT), getFolderId(SENT),
item item
); );
/*} else { } else {
createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly, createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly,
ConflictResolution.AutoResolve, ConflictResolution.AutoResolve,
SendMeetingInvitationsOrCancellations.SendToAllAndSaveCopy, SendMeetingInvitationsOrCancellations.SendToAllAndSaveCopy,
currentItemId, buildFieldUpdates(vCalendar)); currentItemId, buildFieldUpdates(vCalendar));
}*/ }
} else { } else {
// create // create
EWSMethod.Item newItem = new EWSMethod.Item(); EWSMethod.Item newItem = new EWSMethod.Item();
......
...@@ -200,6 +200,9 @@ public final class Field { ...@@ -200,6 +200,9 @@ public final class Field {
FIELD_MAP.put("private", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Common, 0x8506, ExtendedFieldURI.PropertyType.Boolean)); FIELD_MAP.put("private", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Common, 0x8506, ExtendedFieldURI.PropertyType.Boolean));
FIELD_MAP.put("sensitivity", new ExtendedFieldURI(0x0036, ExtendedFieldURI.PropertyType.Integer)); FIELD_MAP.put("sensitivity", new ExtendedFieldURI(0x0036, ExtendedFieldURI.PropertyType.Integer));
// TODO: merge with sensitivity ?
FIELD_MAP.put("itemsensitivity", new UnindexedFieldURI("item:Sensitivity"));
FIELD_MAP.put("haspicture", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8015, ExtendedFieldURI.PropertyType.Boolean)); FIELD_MAP.put("haspicture", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8015, ExtendedFieldURI.PropertyType.Boolean));
FIELD_MAP.put("fburl", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80D8, ExtendedFieldURI.PropertyType.String)); FIELD_MAP.put("fburl", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x80D8, ExtendedFieldURI.PropertyType.String));
...@@ -222,6 +225,10 @@ public final class Field { ...@@ -222,6 +225,10 @@ public final class Field {
FIELD_MAP.put("optionalattendees", new UnindexedFieldURI("calendar:OptionalAttendees")); FIELD_MAP.put("optionalattendees", new UnindexedFieldURI("calendar:OptionalAttendees"));
FIELD_MAP.put("modifiedoccurrences", new UnindexedFieldURI("calendar:ModifiedOccurrences")); FIELD_MAP.put("modifiedoccurrences", new UnindexedFieldURI("calendar:ModifiedOccurrences"));
FIELD_MAP.put("recurrence", new UnindexedFieldURI("calendar:Recurrence"));
FIELD_MAP.put("isalldayevent", new UnindexedFieldURI("calendar:IsAllDayEvent"));
// does not work with Office 365, see https://msdn.microsoft.com/en-us/library/office/bb204271(v=exchg.150).aspx // does not work with Office 365, see https://msdn.microsoft.com/en-us/library/office/bb204271(v=exchg.150).aspx
//FIELD_MAP.put("isrecurring", new UnindexedFieldURI("calendar:IsRecurring")); //FIELD_MAP.put("isrecurring", new UnindexedFieldURI("calendar:IsRecurring"));
FIELD_MAP.put("isrecurring", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Appointment, 0x8223, ExtendedFieldURI.PropertyType.Boolean)); // PidLidRecurring FIELD_MAP.put("isrecurring", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Appointment, 0x8223, ExtendedFieldURI.PropertyType.Boolean)); // PidLidRecurring
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment