1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

EWS: refactor options, use enums

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1065 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-05-26 21:49:46 +00:00
parent 81e47e93b2
commit 8b98ba3dfa
3 changed files with 22 additions and 42 deletions

View File

@ -25,10 +25,16 @@ import java.io.Writer;
* Extended MAPI property. * Extended MAPI property.
*/ */
public class ExtendedFieldURI implements FieldURI { public class ExtendedFieldURI implements FieldURI {
protected final String propertyTag; protected enum PropertyType {
protected final String propertyType; ApplicationTime, ApplicationTimeArray, Binary, BinaryArray, Boolean, CLSID, CLSIDArray, Currency, CurrencyArray,
Double, DoubleArray, Error, Float, FloatArray, Integer, IntegerArray, Long, LongArray, Null, Object,
ObjectArray, Short, ShortArray, SystemTime, SystemTimeArray, String, StringArray
}
public ExtendedFieldURI(String propertyTag, String propertyType) { protected final String propertyTag;
protected final PropertyType propertyType;
public ExtendedFieldURI(String propertyTag, PropertyType propertyType) {
this.propertyTag = propertyTag; this.propertyTag = propertyTag;
this.propertyType = propertyType; this.propertyType = propertyType;
} }
@ -37,18 +43,18 @@ public class ExtendedFieldURI implements FieldURI {
writer.write("<t:ExtendedFieldURI PropertyTag=\""); writer.write("<t:ExtendedFieldURI PropertyTag=\"");
writer.write(propertyTag); writer.write(propertyTag);
writer.write("\" PropertyType=\""); writer.write("\" PropertyType=\"");
writer.write(propertyType); writer.write(propertyType.toString());
writer.write("\"/>"); writer.write("\"/>");
} }
public static final ExtendedFieldURI PR_INSTANCE_KEY = new ExtendedFieldURI("0x0FF6", "Binary"); public static final ExtendedFieldURI PR_INSTANCE_KEY = new ExtendedFieldURI("0x0FF6", PropertyType.Binary);
public static final ExtendedFieldURI PR_MESSAGE_SIZE = new ExtendedFieldURI("0x0E08", "Integer"); public static final ExtendedFieldURI PR_MESSAGE_SIZE = new ExtendedFieldURI("0x0E08", PropertyType.Integer);
public static final ExtendedFieldURI PR_INTERNET_ARTICLE_NUMBER = new ExtendedFieldURI("0x0E23", "Integer"); public static final ExtendedFieldURI PR_INTERNET_ARTICLE_NUMBER = new ExtendedFieldURI("0x0E23", PropertyType.Integer);
public static final ExtendedFieldURI JUNK_FLAG = new ExtendedFieldURI("0x1083", "Integer"); public static final ExtendedFieldURI JUNK_FLAG = new ExtendedFieldURI("0x1083", PropertyType.Integer);
public static final ExtendedFieldURI PR_FLAG_STATUS = new ExtendedFieldURI("0x1090", "Integer"); public static final ExtendedFieldURI PR_FLAG_STATUS = new ExtendedFieldURI("0x1090", PropertyType.Integer);
public static final ExtendedFieldURI PR_MESSAGE_FLAGS = new ExtendedFieldURI("0x0E07", "Integer"); public static final ExtendedFieldURI PR_MESSAGE_FLAGS = new ExtendedFieldURI("0x0E07", PropertyType.Integer);
public static final ExtendedFieldURI PR_ACTION_FLAG = new ExtendedFieldURI("0x1081", "Integer"); public static final ExtendedFieldURI PR_ACTION_FLAG = new ExtendedFieldURI("0x1081", PropertyType.Integer);
public static final ExtendedFieldURI PR_URL_COMP_NAME = new ExtendedFieldURI("0x10F3", "String"); public static final ExtendedFieldURI PR_URL_COMP_NAME = new ExtendedFieldURI("0x10F3", PropertyType.String);
} }

View File

@ -24,23 +24,10 @@ import java.io.Writer;
/** /**
* Folder folderQueryTraversalType search mode. * Folder folderQueryTraversalType search mode.
*/ */
public final class FolderQueryTraversal { public final class FolderQueryTraversal extends AttributeOption {
private final String value;
private FolderQueryTraversal(String value) { private FolderQueryTraversal(String value) {
this.value = value; super("Traversal", value);
}
/**
* Write XML content to writer.
*
* @param writer writer
* @throws IOException on error
*/
public void write(Writer writer) throws IOException {
writer.write(" Traversal=\"");
writer.write(value);
writer.write("\"");
} }
/** /**

View File

@ -24,23 +24,10 @@ import java.io.Writer;
/** /**
* MessageDisposition flag. * MessageDisposition flag.
*/ */
public class MessageDisposition { public class MessageDisposition extends AttributeOption {
private final String value;
private MessageDisposition(String value) { private MessageDisposition(String value) {
this.value = value; super("MessageDisposition", value);
}
/**
* Write XML content to writer.
*
* @param writer writer
* @throws java.io.IOException on error
*/
public void write(Writer writer) throws IOException {
writer.write(" MessageDisposition=\"");
writer.write(value);
writer.write("\"");
} }
public static final MessageDisposition SaveOnly = new MessageDisposition("SaveOnly"); public static final MessageDisposition SaveOnly = new MessageDisposition("SaveOnly");