diff --git a/src/java/davmail/exchange/ews/FolderIdType.java b/src/java/davmail/exchange/ews/AttributeOption.java
similarity index 73%
rename from src/java/davmail/exchange/ews/FolderIdType.java
rename to src/java/davmail/exchange/ews/AttributeOption.java
index 18b1d10c..7aeb1fa4 100644
--- a/src/java/davmail/exchange/ews/FolderIdType.java
+++ b/src/java/davmail/exchange/ews/AttributeOption.java
@@ -22,19 +22,23 @@ import java.io.IOException;
import java.io.Writer;
/**
- * Folder Id.
+ * Generic attribute option.
*/
-public class FolderIdType {
- protected final String value;
+public abstract class AttributeOption extends Option {
- public FolderIdType(String value) {
- this.value = value;
+ protected AttributeOption(String name, String value) {
+ super(name, value);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void write(Writer writer) throws IOException {
- writer.write("");
+ writer.write("\"");
}
-
}
diff --git a/src/java/davmail/exchange/ews/BaseShape.java b/src/java/davmail/exchange/ews/BaseShape.java
new file mode 100644
index 00000000..50d48720
--- /dev/null
+++ b/src/java/davmail/exchange/ews/BaseShape.java
@@ -0,0 +1,44 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Item or folder base shape.
+ */
+public final class BaseShape extends ElementOption {
+ private BaseShape(String value) {
+ super("t:BaseShape", value);
+ }
+
+ /**
+ * Return id only.
+ */
+ public static final BaseShape ID_ONLY = new BaseShape("IdOnly");
+ /**
+ * Return default properties.
+ */
+ public static final BaseShape DEFAULT = new BaseShape("Default");
+ /**
+ * Return all properties, except MAPI extended properties.
+ */
+ public static final BaseShape ALL_PROPERTIES = new BaseShape("AllProperties");
+}
\ No newline at end of file
diff --git a/src/java/davmail/exchange/ews/CreateFolderMethod.java b/src/java/davmail/exchange/ews/CreateFolderMethod.java
new file mode 100644
index 00000000..ea715950
--- /dev/null
+++ b/src/java/davmail/exchange/ews/CreateFolderMethod.java
@@ -0,0 +1,30 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+/**
+ * Create Folder method.
+ */
+public class CreateFolderMethod extends EWSMethod {
+ public CreateFolderMethod(FolderId parentFolderId, Item item) {
+ super("Folder", "CreateFolder");
+ this.parentFolderId = parentFolderId;
+ this.item = item;
+ }
+}
diff --git a/src/java/davmail/exchange/ews/CreateItemMethod.java b/src/java/davmail/exchange/ews/CreateItemMethod.java
new file mode 100644
index 00000000..183545ed
--- /dev/null
+++ b/src/java/davmail/exchange/ews/CreateItemMethod.java
@@ -0,0 +1,30 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+/**
+ * Create Item method.
+ */
+public class CreateItemMethod extends EWSMethod {
+ public CreateItemMethod(FolderId parentFolderId, EWSMethod.Item item) {
+ super("Folder", "CreateFolder");
+ this.parentFolderId = parentFolderId;
+ this.item = item;
+ }
+}
diff --git a/src/java/davmail/exchange/ews/DeleteFolderMethod.java b/src/java/davmail/exchange/ews/DeleteFolderMethod.java
new file mode 100644
index 00000000..7eced6ea
--- /dev/null
+++ b/src/java/davmail/exchange/ews/DeleteFolderMethod.java
@@ -0,0 +1,30 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+/**
+ * Delete Folder method.
+ */
+public class DeleteFolderMethod extends EWSMethod {
+ public DeleteFolderMethod(FolderId folderId) {
+ super("Folder", "DeleteFolder");
+ this.folderId = folderId;
+ this.deleteType = Disposal.HARD_DELETE;
+ }
+}
diff --git a/src/java/davmail/exchange/ews/DeleteItemMethod.java b/src/java/davmail/exchange/ews/DeleteItemMethod.java
index a2122d73..4c82a8d5 100644
--- a/src/java/davmail/exchange/ews/DeleteItemMethod.java
+++ b/src/java/davmail/exchange/ews/DeleteItemMethod.java
@@ -22,7 +22,7 @@ package davmail.exchange.ews;
* Delete Item method.
*/
public class DeleteItemMethod extends EWSMethod {
- public DeleteItemMethod(FolderIdType folderId, ItemIdType itemId) {
+ public DeleteItemMethod(FolderId folderId, ItemId itemId) {
super("Item", "DeleteItem");
this.folderId = folderId;
this.itemId = itemId;
diff --git a/src/java/davmail/exchange/ews/Disposal.java b/src/java/davmail/exchange/ews/Disposal.java
new file mode 100644
index 00000000..d17d5305
--- /dev/null
+++ b/src/java/davmail/exchange/ews/Disposal.java
@@ -0,0 +1,35 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Disposal.
+ */
+public class Disposal extends AttributeOption {
+ private Disposal(String value) {
+ super("DeleteType", value);
+ }
+
+ public static final Disposal HARD_DELETE = new Disposal("HardDelete");
+ public static final Disposal SOFT_DELETE = new Disposal("SoftDelete");
+ public static final Disposal MOVE_TO_DELETED_ITEMS = new Disposal("MoveToDeletedItems");
+}
diff --git a/src/java/davmail/exchange/ews/DistinguishedFolderId.java b/src/java/davmail/exchange/ews/DistinguishedFolderId.java
new file mode 100644
index 00000000..5b44162e
--- /dev/null
+++ b/src/java/davmail/exchange/ews/DistinguishedFolderId.java
@@ -0,0 +1,47 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+/**
+ * Distinguished Folder Id.
+ */
+public class DistinguishedFolderId extends FolderId {
+
+ private DistinguishedFolderId(String value) {
+ super("t:DistinguishedFolderId", value);
+ }
+
+ public static final DistinguishedFolderId CALENDAR = new DistinguishedFolderId("calendar");
+ public static final DistinguishedFolderId CONTACTS = new DistinguishedFolderId("contacts");
+ public static final DistinguishedFolderId DELETEDITEMS = new DistinguishedFolderId("deleteditems");
+ public static final DistinguishedFolderId DRAFTS = new DistinguishedFolderId("drafts");
+ public static final DistinguishedFolderId INBOX = new DistinguishedFolderId("inbox");
+ public static final DistinguishedFolderId JOURNAL = new DistinguishedFolderId("journal");
+ public static final DistinguishedFolderId NOTES = new DistinguishedFolderId("notes");
+ public static final DistinguishedFolderId OUTBOX = new DistinguishedFolderId("outbox");
+ public static final DistinguishedFolderId SENTITEMS = new DistinguishedFolderId("sentitems");
+ public static final DistinguishedFolderId TASKS = new DistinguishedFolderId("tasks");
+ public static final DistinguishedFolderId MSGFOLDERROOT = new DistinguishedFolderId("msgfolderroot");
+ public static final DistinguishedFolderId PUBLICFOLDERSROOT = new DistinguishedFolderId("publicfoldersroot");
+ public static final DistinguishedFolderId ROOT = new DistinguishedFolderId("root");
+ public static final DistinguishedFolderId JUNKEMAIL = new DistinguishedFolderId("junkemail");
+ public static final DistinguishedFolderId SEARCHFOLDERS = new DistinguishedFolderId("searchfolders");
+ public static final DistinguishedFolderId VOICEMAIL = new DistinguishedFolderId("voicemail");
+
+}
\ No newline at end of file
diff --git a/src/java/davmail/exchange/ews/DistinguishedFolderIdType.java b/src/java/davmail/exchange/ews/DistinguishedFolderIdType.java
deleted file mode 100644
index 61650209..00000000
--- a/src/java/davmail/exchange/ews/DistinguishedFolderIdType.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
- * Copyright (C) 2010 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;
-
-import java.io.IOException;
-import java.io.Writer;
-
-public class DistinguishedFolderIdType extends FolderIdType {
-
- private DistinguishedFolderIdType(String value) {
- super(value);
- }
-
- @Override
- public void write(Writer writer) throws IOException {
- writer.write("");
- }
-
- public static final DistinguishedFolderIdType calendar = new DistinguishedFolderIdType("calendar");
- public static final DistinguishedFolderIdType contacts = new DistinguishedFolderIdType("contacts");
- public static final DistinguishedFolderIdType deleteditems = new DistinguishedFolderIdType("deleteditems");
- public static final DistinguishedFolderIdType drafts = new DistinguishedFolderIdType("drafts");
- public static final DistinguishedFolderIdType inbox = new DistinguishedFolderIdType("inbox");
- public static final DistinguishedFolderIdType journal = new DistinguishedFolderIdType("journal");
- public static final DistinguishedFolderIdType notes = new DistinguishedFolderIdType("notes");
- public static final DistinguishedFolderIdType outbox = new DistinguishedFolderIdType("outbox");
- public static final DistinguishedFolderIdType sentitems = new DistinguishedFolderIdType("sentitems");
- public static final DistinguishedFolderIdType tasks = new DistinguishedFolderIdType("tasks");
- public static final DistinguishedFolderIdType msgfolderroot = new DistinguishedFolderIdType("msgfolderroot");
- public static final DistinguishedFolderIdType publicfoldersroot = new DistinguishedFolderIdType("publicfoldersroot");
- public static final DistinguishedFolderIdType root = new DistinguishedFolderIdType("root");
- public static final DistinguishedFolderIdType junkemail = new DistinguishedFolderIdType("junkemail");
- public static final DistinguishedFolderIdType searchfolders = new DistinguishedFolderIdType("searchfolders");
- public static final DistinguishedFolderIdType voicemail = new DistinguishedFolderIdType("voicemail");
-
-}
\ No newline at end of file
diff --git a/src/java/davmail/exchange/ews/EWSMethod.java b/src/java/davmail/exchange/ews/EWSMethod.java
index ccb28893..deedcde9 100644
--- a/src/java/davmail/exchange/ews/EWSMethod.java
+++ b/src/java/davmail/exchange/ews/EWSMethod.java
@@ -18,6 +18,7 @@
*/
package davmail.exchange.ews;
+import com.wutka.dtd.DTDOutput;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpConnection;
@@ -31,10 +32,7 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
+import java.util.*;
/**
* EWS SOAP method.
@@ -42,13 +40,14 @@ import java.util.List;
public abstract class EWSMethod extends PostMethod {
protected static final Logger logger = Logger.getLogger(EWSMethod.class);
- protected FolderQueryTraversalType traversal;
- protected BaseShapeType baseShape;
+ protected FolderQueryTraversal traversal;
+ protected BaseShape baseShape;
protected boolean includeMimeContent;
- protected FolderIdType folderId;
- protected FolderIdType parentFolderId;
- protected ItemIdType itemId;
+ protected FolderId folderId;
+ protected FolderId parentFolderId;
+ protected ItemId itemId;
protected HashSet additionalProperties;
+ protected Disposal deleteType;
protected final String itemType;
protected final String methodName;
@@ -57,6 +56,7 @@ public abstract class EWSMethod extends PostMethod {
protected byte[] mimeContent;
protected List- responseItems;
protected String errorDetail;
+ protected Item item;
/**
* Build EWS method
@@ -99,15 +99,15 @@ public abstract class EWSMethod extends PostMethod {
return "POST";
}
- protected void setBaseShape(BaseShapeType baseShapeType) {
- this.baseShape = baseShapeType;
+ protected void setBaseShape(BaseShape baseShape) {
+ this.baseShape = baseShape;
}
- protected void setFolderId(FolderIdType folderId) {
+ protected void setFolderId(FolderId folderId) {
this.folderId = folderId;
}
- protected void setParentFolderId(FolderIdType folderId) {
+ protected void setParentFolderId(FolderId folderId) {
this.parentFolderId = folderId;
}
@@ -158,9 +158,21 @@ public abstract class EWSMethod extends PostMethod {
protected void writeParentFolderId(Writer writer) throws IOException {
if (parentFolderId != null) {
- writer.write("");
+ writer.write("");
parentFolderId.write(writer);
- writer.write("");
+ writer.write("");
+ }
+ }
+
+ protected void writeItem(Writer writer) throws IOException {
+ if (item != null) {
+ writer.write("");
+ item.write(writer);
+ writer.write("");
}
}
@@ -177,6 +189,9 @@ public abstract class EWSMethod extends PostMethod {
if (traversal != null) {
traversal.write(writer);
}
+ if (deleteType != null) {
+ deleteType.write(writer);
+ }
writer.write(">");
writeSoapBody(writer);
writer.write(" {
+ public static class Item extends HashMap {
public String type;
@Override
public String toString() {
return "type: " + type + ' ' + super.toString();
}
+
+ /**
+ * Write XML content to writer.
+ *
+ * @param writer writer
+ * @throws IOException on error
+ */
+ public void write(Writer writer) throws IOException {
+ writer.write("");
+ for (Map.Entry mapEntry : this.entrySet()) {
+ writer.write("");
+ writer.write(mapEntry.getValue());
+ writer.write("");
+ }
+ writer.write("");
+ }
}
public List
- getResponseItems() {
@@ -252,12 +292,11 @@ public abstract class EWSMethod extends PostMethod {
protected void handleErrors(XMLStreamReader reader) throws XMLStreamException {
String result = handleTag(reader, "ResponseCode");
- if (result != null && !"NoError".equals(result)) {
+ if (errorDetail == null && result != null && !"NoError".equals(result)) {
errorDetail = result;
}
- result = handleTag(reader, "faultstring");
- if (result != null) {
- errorDetail = result;
+ if (isStartTag(reader, "faultstring")) {
+ errorDetail = reader.getElementText();
}
}
diff --git a/src/java/davmail/exchange/ews/ElementOption.java b/src/java/davmail/exchange/ews/ElementOption.java
new file mode 100644
index 00000000..2d207053
--- /dev/null
+++ b/src/java/davmail/exchange/ews/ElementOption.java
@@ -0,0 +1,51 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Generic element option.
+ */
+public class ElementOption extends Option {
+ /**
+ * Create element option.
+ *
+ * @param name element tag name
+ * @param value element value
+ */
+ protected ElementOption(String name, String value) {
+ super(name, value);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ @Override
+ public void write(Writer writer) throws IOException {
+ writer.write('<');
+ writer.write(name);
+ writer.write('>');
+ writer.write(value);
+ writer.write("");
+ writer.write(name);
+ writer.write('>');
+ }
+}
diff --git a/src/java/davmail/exchange/ews/ExtendedFieldURI.java b/src/java/davmail/exchange/ews/ExtendedFieldURI.java
index 8a662ad1..66690fcb 100644
--- a/src/java/davmail/exchange/ews/ExtendedFieldURI.java
+++ b/src/java/davmail/exchange/ews/ExtendedFieldURI.java
@@ -48,5 +48,7 @@ public class ExtendedFieldURI implements FieldURI {
public static final ExtendedFieldURI PR_FLAG_STATUS = new ExtendedFieldURI("0x1090", "Integer");
public static final ExtendedFieldURI PR_MESSAGE_FLAGS = new ExtendedFieldURI("0x0E07", "Integer");
public static final ExtendedFieldURI PR_ACTION_FLAG = new ExtendedFieldURI("0x1081", "Integer");
+ public static final ExtendedFieldURI PR_URL_COMP_NAME = new ExtendedFieldURI("0x10F3", "String");
+
}
diff --git a/src/java/davmail/exchange/ews/FindFolderMethod.java b/src/java/davmail/exchange/ews/FindFolderMethod.java
index f8f4d5ed..3c72563d 100644
--- a/src/java/davmail/exchange/ews/FindFolderMethod.java
+++ b/src/java/davmail/exchange/ews/FindFolderMethod.java
@@ -23,7 +23,7 @@ package davmail.exchange.ews;
*/
public class FindFolderMethod extends EWSMethod {
- public FindFolderMethod(FolderQueryTraversalType traversal, BaseShapeType baseShape, FolderIdType parentFolderId) {
+ public FindFolderMethod(FolderQueryTraversal traversal, BaseShape baseShape, FolderId parentFolderId) {
super("Folder", "FindFolder");
this.traversal = traversal;
this.baseShape = baseShape;
diff --git a/src/java/davmail/exchange/ews/FindItemMethod.java b/src/java/davmail/exchange/ews/FindItemMethod.java
index c207b4d0..cc4e6810 100644
--- a/src/java/davmail/exchange/ews/FindItemMethod.java
+++ b/src/java/davmail/exchange/ews/FindItemMethod.java
@@ -18,14 +18,11 @@
*/
package davmail.exchange.ews;
-import java.io.IOException;
-import java.io.Writer;
-
/**
* EWS Find Item Method.
*/
public class FindItemMethod extends EWSMethod {
- public FindItemMethod(FolderQueryTraversalType traversal, BaseShapeType baseShape, FolderIdType parentFolderId) {
+ public FindItemMethod(FolderQueryTraversal traversal, BaseShape baseShape, FolderId parentFolderId) {
super("Item", "FindItem");
this.traversal = traversal;
this.baseShape = baseShape;
diff --git a/src/java/davmail/exchange/ews/FolderId.java b/src/java/davmail/exchange/ews/FolderId.java
new file mode 100644
index 00000000..6476e315
--- /dev/null
+++ b/src/java/davmail/exchange/ews/FolderId.java
@@ -0,0 +1,54 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Folder Id.
+ */
+public class FolderId extends Option {
+
+ protected FolderId(String name, String value) {
+ super(name, value);
+ }
+
+ /**
+ * Create FolderId option
+ *
+ * @param value id value
+ */
+ public FolderId(String value) {
+ super("t:FolderId", value);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ @Override
+ public void write(Writer writer) throws IOException {
+ writer.write('<');
+ writer.write(name);
+ writer.write(" Id=\"");
+ writer.write(value);
+ writer.write("\"/>");
+ }
+
+}
diff --git a/src/java/davmail/exchange/ews/FolderQueryTraversalType.java b/src/java/davmail/exchange/ews/FolderQueryTraversal.java
similarity index 80%
rename from src/java/davmail/exchange/ews/FolderQueryTraversalType.java
rename to src/java/davmail/exchange/ews/FolderQueryTraversal.java
index 10a3c360..3c2ccda9 100644
--- a/src/java/davmail/exchange/ews/FolderQueryTraversalType.java
+++ b/src/java/davmail/exchange/ews/FolderQueryTraversal.java
@@ -24,10 +24,10 @@ import java.io.Writer;
/**
* Folder folderQueryTraversalType search mode.
*/
-public final class FolderQueryTraversalType {
+public final class FolderQueryTraversal {
private final String value;
- private FolderQueryTraversalType(String value) {
+ private FolderQueryTraversal(String value) {
this.value = value;
}
@@ -46,9 +46,9 @@ public final class FolderQueryTraversalType {
/**
* Search only in current folder.
*/
- public static final FolderQueryTraversalType Shallow = new FolderQueryTraversalType("Shallow");
+ public static final FolderQueryTraversal SHALLOW = new FolderQueryTraversal("Shallow");
/**
* Recursive search.
*/
- public static final FolderQueryTraversalType Deep = new FolderQueryTraversalType("Deep");
+ public static final FolderQueryTraversal DEEP = new FolderQueryTraversal("Deep");
}
\ No newline at end of file
diff --git a/src/java/davmail/exchange/ews/GetFolderMethod.java b/src/java/davmail/exchange/ews/GetFolderMethod.java
index 18fb8af4..5b274de3 100644
--- a/src/java/davmail/exchange/ews/GetFolderMethod.java
+++ b/src/java/davmail/exchange/ews/GetFolderMethod.java
@@ -23,7 +23,7 @@ package davmail.exchange.ews;
*/
public class GetFolderMethod extends EWSMethod {
- public GetFolderMethod(BaseShapeType baseShape, FolderIdType folderId) {
+ public GetFolderMethod(BaseShape baseShape, FolderId folderId) {
super("Folder", "GetFolder");
this.baseShape = baseShape;
this.folderId = folderId;
diff --git a/src/java/davmail/exchange/ews/GetItemMethod.java b/src/java/davmail/exchange/ews/GetItemMethod.java
index 7afbe38e..cb131468 100644
--- a/src/java/davmail/exchange/ews/GetItemMethod.java
+++ b/src/java/davmail/exchange/ews/GetItemMethod.java
@@ -22,7 +22,7 @@ package davmail.exchange.ews;
* Get Item method.
*/
public class GetItemMethod extends EWSMethod {
- public GetItemMethod(BaseShapeType baseShape, ItemIdType itemId, boolean includeMimeContent) {
+ public GetItemMethod(BaseShape baseShape, ItemId itemId, boolean includeMimeContent) {
super("Item", "GetItem");
this.baseShape = baseShape;
this.itemId = itemId;
diff --git a/src/java/davmail/exchange/ews/ItemIdType.java b/src/java/davmail/exchange/ews/ItemId.java
similarity index 90%
rename from src/java/davmail/exchange/ews/ItemIdType.java
rename to src/java/davmail/exchange/ews/ItemId.java
index ebca1e64..fa86ff0e 100644
--- a/src/java/davmail/exchange/ews/ItemIdType.java
+++ b/src/java/davmail/exchange/ews/ItemId.java
@@ -24,7 +24,7 @@ import java.io.Writer;
/**
* Item id.
*/
-public class ItemIdType {
+public class ItemId {
protected final String id;
protected String changeKey;
@@ -34,7 +34,7 @@ public class ItemIdType {
* @param id item id
* @param changeKey item change key
*/
- public ItemIdType(String id, String changeKey) {
+ public ItemId(String id, String changeKey) {
this.id = id;
this.changeKey = changeKey;
}
@@ -44,7 +44,7 @@ public class ItemIdType {
*
* @param id item id
*/
- public ItemIdType(String id) {
+ public ItemId(String id) {
this.id = id;
}
diff --git a/src/java/davmail/exchange/ews/BaseShapeType.java b/src/java/davmail/exchange/ews/MessageDisposition.java
similarity index 62%
rename from src/java/davmail/exchange/ews/BaseShapeType.java
rename to src/java/davmail/exchange/ews/MessageDisposition.java
index 350180df..3bad753f 100644
--- a/src/java/davmail/exchange/ews/BaseShapeType.java
+++ b/src/java/davmail/exchange/ews/MessageDisposition.java
@@ -22,12 +22,12 @@ import java.io.IOException;
import java.io.Writer;
/**
- * Item or folder base shape.
+ * MessageDisposition flag.
*/
-public final class BaseShapeType {
+public class MessageDisposition {
private final String value;
- private BaseShapeType(String value) {
+ private MessageDisposition(String value) {
this.value = value;
}
@@ -35,24 +35,15 @@ public final class BaseShapeType {
* Write XML content to writer.
*
* @param writer writer
- * @throws IOException on error
+ * @throws java.io.IOException on error
*/
public void write(Writer writer) throws IOException {
- writer.write("");
+ writer.write(" MessageDisposition=\"");
writer.write(value);
- writer.write("");
+ writer.write("\"");
}
- /**
- * Return id only.
- */
- public static final BaseShapeType IdOnly = new BaseShapeType("IdOnly");
- /**
- * Return default properties.
- */
- public static final BaseShapeType Default = new BaseShapeType("Default");
- /**
- * Return all properties, except MAPI extended properties.
- */
- public static final BaseShapeType AllProperties = new BaseShapeType("AllProperties");
-}
\ No newline at end of file
+ public static final MessageDisposition SaveOnly = new MessageDisposition("SaveOnly");
+ public static final MessageDisposition SendOnly = new MessageDisposition("SendOnly");
+ public static final MessageDisposition SendAndSaveCopy = new MessageDisposition("SendAndSaveCopy");
+}
diff --git a/src/java/davmail/exchange/ews/Option.java b/src/java/davmail/exchange/ews/Option.java
new file mode 100644
index 00000000..53cfdfa0
--- /dev/null
+++ b/src/java/davmail/exchange/ews/Option.java
@@ -0,0 +1,44 @@
+/*
+ * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
+ * Copyright (C) 2010 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;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Generic option.
+ */
+public abstract class Option {
+ protected final String name;
+ protected final String value;
+
+ protected Option(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Write XML content to writer.
+ *
+ * @param writer writer
+ * @throws IOException on error
+ */
+ public abstract void write(Writer writer) throws IOException;
+
+}