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.
*/
public class ExtendedFieldURI implements FieldURI {
protected final String propertyTag;
protected final String propertyType;
protected enum 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.propertyType = propertyType;
}
@ -37,18 +43,18 @@ public class ExtendedFieldURI implements FieldURI {
writer.write("<t:ExtendedFieldURI PropertyTag=\"");
writer.write(propertyTag);
writer.write("\" PropertyType=\"");
writer.write(propertyType);
writer.write(propertyType.toString());
writer.write("\"/>");
}
public static final ExtendedFieldURI PR_INSTANCE_KEY = new ExtendedFieldURI("0x0FF6", "Binary");
public static final ExtendedFieldURI PR_MESSAGE_SIZE = new ExtendedFieldURI("0x0E08", "Integer");
public static final ExtendedFieldURI PR_INTERNET_ARTICLE_NUMBER = new ExtendedFieldURI("0x0E23", "Integer");
public static final ExtendedFieldURI JUNK_FLAG = new ExtendedFieldURI("0x1083", "Integer");
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");
public static final ExtendedFieldURI PR_INSTANCE_KEY = new ExtendedFieldURI("0x0FF6", PropertyType.Binary);
public static final ExtendedFieldURI PR_MESSAGE_SIZE = new ExtendedFieldURI("0x0E08", PropertyType.Integer);
public static final ExtendedFieldURI PR_INTERNET_ARTICLE_NUMBER = new ExtendedFieldURI("0x0E23", PropertyType.Integer);
public static final ExtendedFieldURI JUNK_FLAG = new ExtendedFieldURI("0x1083", PropertyType.Integer);
public static final ExtendedFieldURI PR_FLAG_STATUS = new ExtendedFieldURI("0x1090", PropertyType.Integer);
public static final ExtendedFieldURI PR_MESSAGE_FLAGS = new ExtendedFieldURI("0x0E07", PropertyType.Integer);
public static final ExtendedFieldURI PR_ACTION_FLAG = new ExtendedFieldURI("0x1081", PropertyType.Integer);
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.
*/
public final class FolderQueryTraversal {
private final String value;
public final class FolderQueryTraversal extends AttributeOption {
private FolderQueryTraversal(String value) {
this.value = 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("\"");
super("Traversal", value);
}
/**

View File

@ -24,23 +24,10 @@ import java.io.Writer;
/**
* MessageDisposition flag.
*/
public class MessageDisposition {
private final String value;
public class MessageDisposition extends AttributeOption {
private MessageDisposition(String value) {
this.value = 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("\"");
super("MessageDisposition", value);
}
public static final MessageDisposition SaveOnly = new MessageDisposition("SaveOnly");