1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-01-12 22:18:11 -05:00

Caldav: fix time-range filter support in EWS mode

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1271 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-25 19:55:51 +00:00
parent c7df65080a
commit d6984cff6f
4 changed files with 26 additions and 10 deletions

View File

@ -631,7 +631,7 @@ public class CaldavConnection extends AbstractConnection {
*/
public void patchCalendar(CaldavRequest request) throws IOException {
if (request.hasProperty("displayname")) {
session.moveFolder(request.getFolderPath(), request.getParentFolderPath()+'/'+request.getProperty("displayname"));
session.moveFolder(request.getFolderPath(), request.getParentFolderPath() + '/' + request.getProperty("displayname"));
}
CaldavResponse response = new CaldavResponse(HttpStatus.SC_MULTI_STATUS);
response.startMultistatus();
@ -1392,9 +1392,8 @@ public class CaldavConnection extends AbstractConnection {
} else if ("calendar-multiget".equals(currentElement)
|| "addressbook-multiget".equals(currentElement)) {
isMultiGet = true;
} else if ("time-range".equals(currentElement)) {
timeRangeStart = streamReader.getAttributeValue(null, "start");
timeRangeEnd = streamReader.getAttributeValue(null, "end");
} else if ("comp-filter".equals(currentElement)) {
handleCompFilter(streamReader);
} else if (inProperties && !"calendar-free-busy-set".equals(currentElement)) {
properties.put(currentElement, streamReader.getElementText());
}
@ -1429,6 +1428,23 @@ public class CaldavConnection extends AbstractConnection {
}
}
protected boolean isEndTag(XMLStreamReader reader, String tagLocalName) {
return (reader.getEventType() == XMLStreamConstants.END_ELEMENT) && (reader.getLocalName().equals(tagLocalName));
}
public void handleCompFilter(XMLStreamReader reader) throws XMLStreamException {
while (reader.hasNext() && !isEndTag(reader, "comp-filter")) {
int event = reader.next();
if (event == XMLStreamConstants.START_ELEMENT) {
String tagLocalName = reader.getLocalName();
if ("time-range".equals(tagLocalName)) {
timeRangeStart = reader.getAttributeValue(null, "start");
timeRangeEnd = reader.getAttributeValue(null, "end");
}
}
}
}
public boolean hasProperty(String propertyName) {
return properties.containsKey(propertyName);
}
@ -1468,7 +1484,7 @@ public class CaldavConnection extends AbstractConnection {
}
return getFolderPath(endIndex, null);
}
/**
* Get request folder path with subFolder.
*
@ -1482,7 +1498,7 @@ public class CaldavConnection extends AbstractConnection {
} else {
endIndex = getPathLength() - 1;
}
return getFolderPath(endIndex, subFolder);
return getFolderPath(endIndex, subFolder);
}
protected String getFolderPath(int endIndex, String subFolder) {

View File

@ -612,7 +612,7 @@ public abstract class ExchangeSession {
protected enum Operator {
Or, And, Not, IsEqualTo,
IsGreaterThan, IsGreaterThanOrEqualTo,
IsLessThan, IsLowerThanOrEqualTo,
IsLessThan, IsLessThanOrEqualTo,
IsNull, IsTrue, IsFalse,
Like, StartsWith, Contains
}

View File

@ -398,7 +398,7 @@ public class DavExchangeSession extends ExchangeSession {
operatorMap.put(Operator.IsEqualTo, " = ");
operatorMap.put(Operator.IsGreaterThanOrEqualTo, " >= ");
operatorMap.put(Operator.IsGreaterThan, " > ");
operatorMap.put(Operator.IsLowerThanOrEqualTo, " <= ");
operatorMap.put(Operator.IsLessThanOrEqualTo, " <= ");
operatorMap.put(Operator.IsLessThan, " < ");
operatorMap.put(Operator.Like, " like ");
operatorMap.put(Operator.IsNull, " is null");
@ -523,7 +523,7 @@ public class DavExchangeSession extends ExchangeSession {
@Override
public Condition lte(String attributeName, String value) {
return new AttributeCondition(attributeName, Operator.IsLowerThanOrEqualTo, value);
return new AttributeCondition(attributeName, Operator.IsLessThanOrEqualTo, value);
}
@Override

View File

@ -448,7 +448,7 @@ public class EwsExchangeSession extends ExchangeSession {
@Override
public Condition lte(String attributeName, String value) {
return new AttributeCondition(attributeName, Operator.IsLowerThanOrEqualTo, value);
return new AttributeCondition(attributeName, Operator.IsLessThanOrEqualTo, value);
}
@Override