mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Caldav: instancetype is null on Exchange 2010, switch to isrecurring in EWS FindItem
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1677 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
0c01e83c3c
commit
c1f6161c7b
@ -2516,19 +2516,13 @@ public abstract class ExchangeSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks");
|
boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks");
|
||||||
Condition condition;
|
Condition condition = getCalendarItemCondition(caldavDisableTasks, dateCondition);
|
||||||
if (caldavDisableTasks) {
|
|
||||||
condition = or(isEqualTo("instancetype", 1),
|
|
||||||
and(isEqualTo("instancetype", 0), dateCondition));
|
|
||||||
} else {
|
|
||||||
condition = or(isNull("instancetype"),
|
|
||||||
isEqualTo("instancetype", 1),
|
|
||||||
and(isEqualTo("instancetype", 0), dateCondition));
|
|
||||||
}
|
|
||||||
|
|
||||||
return searchEvents(folderPath, condition);
|
return searchEvents(folderPath, condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract Condition getCalendarItemCondition(boolean excludeTasks, Condition dateCondition);
|
||||||
|
|
||||||
protected Condition getRangeCondition(String timeRangeStart, String timeRangeEnd) throws IOException {
|
protected Condition getRangeCondition(String timeRangeStart, String timeRangeEnd) throws IOException {
|
||||||
try {
|
try {
|
||||||
SimpleDateFormat parser = getZuluDateFormat();
|
SimpleDateFormat parser = getZuluDateFormat();
|
||||||
@ -2557,15 +2551,7 @@ public abstract class ExchangeSession {
|
|||||||
public List<Event> searchEvents(String folderPath, String timeRangeStart, String timeRangeEnd) throws IOException {
|
public List<Event> searchEvents(String folderPath, String timeRangeStart, String timeRangeEnd) throws IOException {
|
||||||
Condition dateCondition = getRangeCondition(timeRangeStart, timeRangeEnd);
|
Condition dateCondition = getRangeCondition(timeRangeStart, timeRangeEnd);
|
||||||
boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks");
|
boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks");
|
||||||
Condition condition;
|
Condition condition = getCalendarItemCondition(caldavDisableTasks, dateCondition);
|
||||||
if (caldavDisableTasks) {
|
|
||||||
condition = or(isEqualTo("instancetype", 1),
|
|
||||||
and(isEqualTo("instancetype", 0), dateCondition));
|
|
||||||
} else {
|
|
||||||
condition = or(isNull("instancetype"),
|
|
||||||
isEqualTo("instancetype", 1),
|
|
||||||
and(isEqualTo("instancetype", 0), dateCondition));
|
|
||||||
}
|
|
||||||
|
|
||||||
return searchEvents(folderPath, condition);
|
return searchEvents(folderPath, condition);
|
||||||
}
|
}
|
||||||
@ -2581,19 +2567,18 @@ public abstract class ExchangeSession {
|
|||||||
*/
|
*/
|
||||||
public List<Event> searchEventsOnly(String folderPath, String timeRangeStart, String timeRangeEnd) throws IOException {
|
public List<Event> searchEventsOnly(String folderPath, String timeRangeStart, String timeRangeEnd) throws IOException {
|
||||||
Condition dateCondition = getRangeCondition(timeRangeStart, timeRangeEnd);
|
Condition dateCondition = getRangeCondition(timeRangeStart, timeRangeEnd);
|
||||||
return searchEvents(folderPath, or(isEqualTo("instancetype", 1),
|
return searchEvents(folderPath, getCalendarItemCondition(true, dateCondition));
|
||||||
and(isEqualTo("instancetype", 0), dateCondition)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search tasks only (VTODO).
|
* Search tasks only (VTODO).
|
||||||
*
|
*
|
||||||
* @param folderPath Exchange folder path
|
* @param folderPath Exchange folder path
|
||||||
* @return list of calendar events
|
* @return list of tasks
|
||||||
* @throws IOException on error
|
* @throws IOException on error
|
||||||
*/
|
*/
|
||||||
public List<Event> searchTasksOnly(String folderPath) throws IOException {
|
public List<Event> searchTasksOnly(String folderPath) throws IOException {
|
||||||
return searchEvents(folderPath, isNull("instancetype"));
|
return searchEvents(folderPath, not(isEqualTo("outlookmessageclass", "IPM.Appointment")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2611,7 +2596,7 @@ public abstract class ExchangeSession {
|
|||||||
LOGGER.debug("Shared or public calendar: exclude private events");
|
LOGGER.debug("Shared or public calendar: exclude private events");
|
||||||
privateCondition = isEqualTo("sensitivity", 0);
|
privateCondition = isEqualTo("sensitivity", 0);
|
||||||
}
|
}
|
||||||
// instancetype 0 single appointment / 1 master recurring appointment
|
|
||||||
return searchEvents(folderPath, ITEM_PROPERTIES,
|
return searchEvents(folderPath, ITEM_PROPERTIES,
|
||||||
and(filter, privateCondition));
|
and(filter, privateCondition));
|
||||||
}
|
}
|
||||||
|
@ -1867,6 +1867,19 @@ public class DavExchangeSession extends ExchangeSession {
|
|||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Condition getCalendarItemCondition(boolean excludeTasks, Condition dateCondition) {
|
||||||
|
// instancetype 0 single appointment / 1 master recurring appointment
|
||||||
|
if (excludeTasks) {
|
||||||
|
return or(isEqualTo("instancetype", 1),
|
||||||
|
and(isEqualTo("instancetype", 0), dateCondition));
|
||||||
|
} else {
|
||||||
|
return or(isNull("instancetype"),
|
||||||
|
isEqualTo("instancetype", 1),
|
||||||
|
and(isEqualTo("instancetype", 0), dateCondition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected MultiStatusResponse[] searchItems(String folderPath, Set<String> attributes, Condition condition,
|
protected MultiStatusResponse[] searchItems(String folderPath, Set<String> attributes, Condition condition,
|
||||||
FolderQueryTraversal folderQueryTraversal, int maxCount) throws IOException {
|
FolderQueryTraversal folderQueryTraversal, int maxCount) throws IOException {
|
||||||
String folderUrl = getFolderPath(folderPath);
|
String folderUrl = getFolderPath(folderPath);
|
||||||
|
@ -1393,6 +1393,19 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Condition getCalendarItemCondition(boolean excludeTasks, Condition dateCondition) {
|
||||||
|
// instancetype 0 single appointment / 1 master recurring appointment
|
||||||
|
if (excludeTasks) {
|
||||||
|
return or(isTrue("isrecurring"),
|
||||||
|
and(isFalse("isrecurring"), dateCondition));
|
||||||
|
} else {
|
||||||
|
return or(not(isEqualTo("outlookmessageclass", "IPM.Appointment")),
|
||||||
|
isTrue("isrecurring"),
|
||||||
|
and(isFalse("isrecurring"), dateCondition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ExchangeSession.Event> getEventMessages(String folderPath) throws IOException {
|
public List<ExchangeSession.Event> getEventMessages(String folderPath) throws IOException {
|
||||||
return searchEvents(folderPath, ITEM_PROPERTIES,
|
return searchEvents(folderPath, ITEM_PROPERTIES,
|
||||||
|
@ -199,6 +199,8 @@ 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("isrecurring", new UnindexedFieldURI("calendar:IsRecurring"));
|
||||||
|
|
||||||
FIELD_MAP.put("xmozlastack", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozlastack"));
|
FIELD_MAP.put("xmozlastack", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.PublicStrings, "xmozlastack"));
|
||||||
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"));
|
||||||
|
Loading…
Reference in New Issue
Block a user