mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
EWS: implement SortOrder
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2092 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
f9715c60c4
commit
3f79bba608
@ -82,6 +82,7 @@ public abstract class EWSMethod extends PostMethod {
|
|||||||
protected Item item;
|
protected Item item;
|
||||||
|
|
||||||
protected SearchExpression searchExpression;
|
protected SearchExpression searchExpression;
|
||||||
|
protected FieldOrder fieldOrder;
|
||||||
|
|
||||||
protected String serverVersion;
|
protected String serverVersion;
|
||||||
protected String timezoneContext;
|
protected String timezoneContext;
|
||||||
@ -163,6 +164,10 @@ public abstract class EWSMethod extends PostMethod {
|
|||||||
this.searchExpression = searchExpression;
|
this.searchExpression = searchExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setFieldOrder(FieldOrder fieldOrder) {
|
||||||
|
this.fieldOrder = fieldOrder;
|
||||||
|
}
|
||||||
|
|
||||||
protected void writeShape(Writer writer) throws IOException {
|
protected void writeShape(Writer writer) throws IOException {
|
||||||
if (baseShape != null) {
|
if (baseShape != null) {
|
||||||
writer.write("<m:");
|
writer.write("<m:");
|
||||||
@ -277,6 +282,16 @@ public abstract class EWSMethod extends PostMethod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void writeSortOrder(Writer writer) throws IOException {
|
||||||
|
if (fieldOrder != null) {
|
||||||
|
writer.write("<m:SortOrder>");
|
||||||
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
fieldOrder.appendTo(buffer);
|
||||||
|
writer.write(buffer.toString());
|
||||||
|
writer.write("</m:SortOrder>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void startChanges(Writer writer) throws IOException {
|
protected void startChanges(Writer writer) throws IOException {
|
||||||
//noinspection VariableNotUsedInsideIf
|
//noinspection VariableNotUsedInsideIf
|
||||||
if (updates != null) {
|
if (updates != null) {
|
||||||
@ -371,6 +386,7 @@ public abstract class EWSMethod extends PostMethod {
|
|||||||
writeShape(writer);
|
writeShape(writer);
|
||||||
writeIndexedPageItemView(writer);
|
writeIndexedPageItemView(writer);
|
||||||
writeRestriction(writer);
|
writeRestriction(writer);
|
||||||
|
writeSortOrder(writer);
|
||||||
writeParentFolderId(writer);
|
writeParentFolderId(writer);
|
||||||
writeToFolderId(writer);
|
writeToFolderId(writer);
|
||||||
writeItemId(writer);
|
writeItemId(writer);
|
||||||
|
45
src/java/davmail/exchange/ews/FieldOrder.java
Normal file
45
src/java/davmail/exchange/ews/FieldOrder.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
|
||||||
|
* Copyright (C) 2013 Mickael Guessant
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
package davmail.exchange.ews;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort order.
|
||||||
|
*/
|
||||||
|
public class FieldOrder {
|
||||||
|
protected enum Order {
|
||||||
|
Descending, Ascending
|
||||||
|
}
|
||||||
|
protected Order order;
|
||||||
|
protected FieldURI fieldURI;
|
||||||
|
|
||||||
|
public FieldOrder(FieldURI fieldURI, Order order) {
|
||||||
|
this.fieldURI = fieldURI;
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Append sort order to buffer.
|
||||||
|
*
|
||||||
|
* @param buffer search buffer
|
||||||
|
*/
|
||||||
|
void appendTo(StringBuilder buffer) {
|
||||||
|
buffer.append("<t:FieldOrder Order=\"").append(order).append("\">");
|
||||||
|
fieldURI.appendTo(buffer);
|
||||||
|
buffer.append("</t:FieldOrder>");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user