mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 19:52:21 -05:00
Caldav: implement percent complete and status VTODO updates
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1737 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
7036f3fd51
commit
42623b3994
@ -91,6 +91,23 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
//AcceptSharingInvitation
|
//AcceptSharingInvitation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final Map<String, String> vTodoToTaskStatusMap = new HashMap<String, String>();
|
||||||
|
static final Map<String, String> taskTovTodoStatusMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
//taskTovTodoStatusMap.put("NotStarted", null);
|
||||||
|
taskTovTodoStatusMap.put("InProgress", "IN-PROCESS");
|
||||||
|
taskTovTodoStatusMap.put("Completed", "COMPLETED");
|
||||||
|
taskTovTodoStatusMap.put("WaitingOnOthers", "NEEDS-ACTION");
|
||||||
|
taskTovTodoStatusMap.put("Deferred", "CANCELLED");
|
||||||
|
|
||||||
|
//vTodoToTaskStatusMap.put(null, "NotStarted");
|
||||||
|
vTodoToTaskStatusMap.put("IN-PROCESS", "InProgress");
|
||||||
|
vTodoToTaskStatusMap.put("COMPLETED", "Completed");
|
||||||
|
vTodoToTaskStatusMap.put("NEEDS-ACTION", "WaitingOnOthers");
|
||||||
|
vTodoToTaskStatusMap.put("CANCELLED", "Deferred");
|
||||||
|
}
|
||||||
|
|
||||||
protected Map<String, String> folderIdMap;
|
protected Map<String, String> folderIdMap;
|
||||||
|
|
||||||
protected class Folder extends ExchangeSession.Folder {
|
protected class Folder extends ExchangeSession.Folder {
|
||||||
@ -1220,6 +1237,17 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
updates.add(Field.createFieldUpdate("urlcompname", convertItemNameToEML(itemName)));
|
updates.add(Field.createFieldUpdate("urlcompname", convertItemNameToEML(itemName)));
|
||||||
updates.add(Field.createFieldUpdate("subject", vCalendar.getFirstVeventPropertyValue("SUMMARY")));
|
updates.add(Field.createFieldUpdate("subject", vCalendar.getFirstVeventPropertyValue("SUMMARY")));
|
||||||
updates.add(Field.createFieldUpdate("description", vCalendar.getFirstVeventPropertyValue("DESCRIPTION")));
|
updates.add(Field.createFieldUpdate("description", vCalendar.getFirstVeventPropertyValue("DESCRIPTION")));
|
||||||
|
String percentComplete = vCalendar.getFirstVeventPropertyValue("PERCENT-COMPLETE");
|
||||||
|
if (percentComplete == null) {
|
||||||
|
percentComplete = "0";
|
||||||
|
}
|
||||||
|
updates.add(Field.createFieldUpdate("percentcomplete", percentComplete));
|
||||||
|
String vTodoStatus = vCalendar.getFirstVeventPropertyValue("STATUS");
|
||||||
|
if (vTodoStatus == null) {
|
||||||
|
updates.add(Field.createFieldUpdate("status", "NotStarted"));
|
||||||
|
} else {
|
||||||
|
updates.add(Field.createFieldUpdate("status", vTodoToTaskStatusMap.get(vTodoStatus)));
|
||||||
|
}
|
||||||
if (currentItemId != null) {
|
if (currentItemId != null) {
|
||||||
// update
|
// update
|
||||||
createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly,
|
createOrUpdateItemMethod = new UpdateItemMethod(MessageDisposition.SaveOnly,
|
||||||
@ -1347,6 +1375,8 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
getItemMethod.addAdditionalProperty(Field.get("lastmodified"));
|
getItemMethod.addAdditionalProperty(Field.get("lastmodified"));
|
||||||
getItemMethod.addAdditionalProperty(Field.get("calendaruid"));
|
getItemMethod.addAdditionalProperty(Field.get("calendaruid"));
|
||||||
getItemMethod.addAdditionalProperty(Field.get("description"));
|
getItemMethod.addAdditionalProperty(Field.get("description"));
|
||||||
|
getItemMethod.addAdditionalProperty(Field.get("percentcomplete"));
|
||||||
|
getItemMethod.addAdditionalProperty(Field.get("status"));
|
||||||
} else if (!"Message".equals(type)) {
|
} else if (!"Message".equals(type)) {
|
||||||
getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
|
getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
|
||||||
getItemMethod.addAdditionalProperty(Field.get("reminderset"));
|
getItemMethod.addAdditionalProperty(Field.get("reminderset"));
|
||||||
@ -1376,6 +1406,8 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
vTodo.setPropertyValue("UID", calendarUid);
|
vTodo.setPropertyValue("UID", calendarUid);
|
||||||
vTodo.setPropertyValue("SUMMARY", getItemMethod.getResponseItem().get(Field.get("subject").getResponseName()));
|
vTodo.setPropertyValue("SUMMARY", getItemMethod.getResponseItem().get(Field.get("subject").getResponseName()));
|
||||||
vTodo.setPropertyValue("DESCRIPTION", getItemMethod.getResponseItem().get(Field.get("description").getResponseName()));
|
vTodo.setPropertyValue("DESCRIPTION", getItemMethod.getResponseItem().get(Field.get("description").getResponseName()));
|
||||||
|
vTodo.setPropertyValue("PERCENT-COMPLETE", getItemMethod.getResponseItem().get(Field.get("percentcomplete").getResponseName()));
|
||||||
|
vTodo.setPropertyValue("STATUS", taskTovTodoStatusMap.get(getItemMethod.getResponseItem().get(Field.get("status").getResponseName())));
|
||||||
localVCalendar.addVObject(vTodo);
|
localVCalendar.addVObject(vTodo);
|
||||||
content = localVCalendar.toString().getBytes("UTF-8");
|
content = localVCalendar.toString().getBytes("UTF-8");
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,6 +207,10 @@ public final class Field {
|
|||||||
FIELD_MAP.put("xmozsnoozetime", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsnoozetime"));
|
FIELD_MAP.put("xmozsnoozetime", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsnoozetime"));
|
||||||
FIELD_MAP.put("xmozsendinvitations", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsendinvitations"));
|
FIELD_MAP.put("xmozsendinvitations", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozsendinvitations"));
|
||||||
|
|
||||||
|
// task
|
||||||
|
FIELD_MAP.put("percentcomplete", new UnindexedFieldURI("task:PercentComplete"));
|
||||||
|
FIELD_MAP.put("status", new UnindexedFieldURI("task:Status"));
|
||||||
|
|
||||||
// attachments
|
// attachments
|
||||||
FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments"));
|
FIELD_MAP.put("attachments", new UnindexedFieldURI("item:Attachments"));
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ public class UnindexedFieldURI implements FieldURI {
|
|||||||
itemType = "Message";
|
itemType = "Message";
|
||||||
} else if (fieldURI.startsWith("calendar") && itemType != null) {
|
} else if (fieldURI.startsWith("calendar") && itemType != null) {
|
||||||
itemType = "CalendarItem";
|
itemType = "CalendarItem";
|
||||||
|
} else if (fieldURI.startsWith("task") && itemType != null) {
|
||||||
|
itemType = "Task";
|
||||||
}
|
}
|
||||||
if (itemType != null) {
|
if (itemType != null) {
|
||||||
appendTo(buffer);
|
appendTo(buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user