MAPIProperty is a better fit name for HSMF, so change the name before it gets too widely used

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1058116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-01-12 12:45:51 +00:00
parent 112b2b584e
commit 4358a18407
10 changed files with 1127 additions and 1127 deletions

View File

@ -16,20 +16,20 @@
==================================================================== */
package org.apache.poi.hsmf.datatypes;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_ADDITIONAL_INFO;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_CONTENT_BASE;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_CONTENT_LOCATION;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_DATA;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_DISPOSITION;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_ENCODING;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_EXTENSION;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_FLAGS;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_LONG_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_LONG_PATHNAME;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_MIME_TAG;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_RENDERING;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_SIZE;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_ADDITIONAL_INFO;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_CONTENT_BASE;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_CONTENT_LOCATION;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DATA;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DISPOSITION;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_ENCODING;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_EXTENSION;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FLAGS;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_PATHNAME;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_MIME_TAG;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_RENDERING;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_SIZE;
import java.util.ArrayList;
import java.util.Comparator;

View File

@ -71,50 +71,50 @@ public final class Chunks implements ChunkGroup {
* Called by the parser whenever a chunk is found.
*/
public void record(Chunk chunk) {
if(chunk.getChunkId() == MAPIAttribute.MESSAGE_CLASS.id) {
if(chunk.getChunkId() == MAPIProperty.MESSAGE_CLASS.id) {
messageClass = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.INTERNET_MESSAGE_ID.id) {
else if(chunk.getChunkId() == MAPIProperty.INTERNET_MESSAGE_ID.id) {
messageId = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.MESSAGE_SUBMISSION_ID.id) {
else if(chunk.getChunkId() == MAPIProperty.MESSAGE_SUBMISSION_ID.id) {
// TODO - parse
submissionChunk = (MessageSubmissionChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.RECEIVED_BY_ADDRTYPE.id) {
else if(chunk.getChunkId() == MAPIProperty.RECEIVED_BY_ADDRTYPE.id) {
sentByServerType = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.TRANSPORT_MESSAGE_HEADERS.id) {
else if(chunk.getChunkId() == MAPIProperty.TRANSPORT_MESSAGE_HEADERS.id) {
messageHeaders = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.CONVERSATION_TOPIC.id) {
else if(chunk.getChunkId() == MAPIProperty.CONVERSATION_TOPIC.id) {
conversationTopic = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.SUBJECT.id) {
else if(chunk.getChunkId() == MAPIProperty.SUBJECT.id) {
subjectChunk = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.ORIGINAL_SUBJECT.id) {
else if(chunk.getChunkId() == MAPIProperty.ORIGINAL_SUBJECT.id) {
// TODO
}
else if(chunk.getChunkId() == MAPIAttribute.DISPLAY_TO.id) {
else if(chunk.getChunkId() == MAPIProperty.DISPLAY_TO.id) {
displayToChunk = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.DISPLAY_CC.id) {
else if(chunk.getChunkId() == MAPIProperty.DISPLAY_CC.id) {
displayCCChunk = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.DISPLAY_BCC.id) {
else if(chunk.getChunkId() == MAPIProperty.DISPLAY_BCC.id) {
displayBCCChunk = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.SENDER_EMAIL_ADDRESS.id) {
else if(chunk.getChunkId() == MAPIProperty.SENDER_EMAIL_ADDRESS.id) {
emailFromChunk = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.SENDER_NAME.id) {
else if(chunk.getChunkId() == MAPIProperty.SENDER_NAME.id) {
displayFromChunk = (StringChunk)chunk;
}
else if(chunk.getChunkId() == MAPIAttribute.BODY.id) {
else if(chunk.getChunkId() == MAPIProperty.BODY.id) {
textBodyChunk = (StringChunk)chunk;
}

File diff suppressed because it is too large Load Diff

View File

@ -32,12 +32,12 @@ import java.util.List;
public final class RecipientChunks implements ChunkGroup {
public static final String PREFIX = "__recip_version1.0_#";
public static final MAPIAttribute RECIPIENT_NAME = MAPIAttribute.DISPLAY_NAME;
public static final MAPIAttribute DELIVERY_TYPE = MAPIAttribute.ADDRTYPE;
public static final MAPIAttribute RECIPIENT_EMAIL_ADDRESS = MAPIAttribute.EMAIL_ADDRESS;
public static final MAPIAttribute RECIPIENT_SEARCH = MAPIAttribute.SEARCH_KEY;
public static final MAPIAttribute RECIPIENT_SMTP_ADDRESS = MAPIAttribute.SMTP_ADDRESS;
public static final MAPIAttribute RECIPIENT_DISPLAY_NAME = MAPIAttribute.RECIPIENT_DISPLAY_NAME;
public static final MAPIProperty RECIPIENT_NAME = MAPIProperty.DISPLAY_NAME;
public static final MAPIProperty DELIVERY_TYPE = MAPIProperty.ADDRTYPE;
public static final MAPIProperty RECIPIENT_EMAIL_ADDRESS = MAPIProperty.EMAIL_ADDRESS;
public static final MAPIProperty RECIPIENT_SEARCH = MAPIProperty.SEARCH_KEY;
public static final MAPIProperty RECIPIENT_SMTP_ADDRESS = MAPIProperty.SMTP_ADDRESS;
public static final MAPIProperty RECIPIENT_DISPLAY_NAME = MAPIProperty.RECIPIENT_DISPLAY_NAME;
/** Our 0 based position in the list of recipients */
public int recipientNumber;

View File

@ -22,7 +22,7 @@ import java.io.IOException;
import org.apache.poi.hsmf.datatypes.Chunk;
import org.apache.poi.hsmf.datatypes.ChunkGroup;
import org.apache.poi.hsmf.datatypes.MAPIAttribute;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.hsmf.datatypes.Types;
import org.apache.poi.hsmf.parsers.POIFSChunkParser;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@ -41,10 +41,10 @@ public class HSMFDump {
for(ChunkGroup chunks : chunkGroups) {
System.out.println(chunks.getClass().getSimpleName());
for(Chunk chunk : chunks.getChunks()) {
MAPIAttribute attr = MAPIAttribute.get(chunk.getChunkId());
MAPIProperty attr = MAPIProperty.get(chunk.getChunkId());
String idName = attr.id + " - " + attr.name;
if(attr == MAPIAttribute.UNKNOWN) {
if(attr == MAPIProperty.UNKNOWN) {
idName = chunk.getChunkId() + " - (unknown)";
}

View File

@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import org.apache.poi.hsmf.datatypes.MAPIAttribute;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.hsmf.datatypes.Types;
/**
@ -32,18 +32,18 @@ public class TypesLister {
public TypesLister() {}
public void listByName(PrintStream out) {
ArrayList<MAPIAttribute> all = new ArrayList<MAPIAttribute>(MAPIAttribute.getAll());
Collections.sort(all, new Comparator<MAPIAttribute>() {
public int compare(MAPIAttribute a, MAPIAttribute b) {
ArrayList<MAPIProperty> all = new ArrayList<MAPIProperty>(MAPIProperty.getAll());
Collections.sort(all, new Comparator<MAPIProperty>() {
public int compare(MAPIProperty a, MAPIProperty b) {
return a.name.compareTo(b.name);
}
});
list(all, out);
}
public void listById(PrintStream out) {
ArrayList<MAPIAttribute> all = new ArrayList<MAPIAttribute>(MAPIAttribute.getAll());
Collections.sort(all, new Comparator<MAPIAttribute>() {
public int compare(MAPIAttribute a, MAPIAttribute b) {
ArrayList<MAPIProperty> all = new ArrayList<MAPIProperty>(MAPIProperty.getAll());
Collections.sort(all, new Comparator<MAPIProperty>() {
public int compare(MAPIProperty a, MAPIProperty b) {
if(a.id < b.id) return -1;
if(a.id > b.id) return +1;
return 0;
@ -51,8 +51,8 @@ public class TypesLister {
});
list(all, out);
}
private void list(ArrayList<MAPIAttribute> list, PrintStream out) {
for(MAPIAttribute attr : list) {
private void list(ArrayList<MAPIProperty> list, PrintStream out) {
for(MAPIProperty attr : list) {
String id = Integer.toHexString(attr.id);
while(id.length() < 4) { id = "0"+id; }

View File

@ -26,7 +26,7 @@ import org.apache.poi.hsmf.datatypes.Chunk;
import org.apache.poi.hsmf.datatypes.ChunkGroup;
import org.apache.poi.hsmf.datatypes.Chunks;
import org.apache.poi.hsmf.datatypes.DirectoryChunk;
import org.apache.poi.hsmf.datatypes.MAPIAttribute;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.hsmf.datatypes.MessageSubmissionChunk;
import org.apache.poi.hsmf.datatypes.NameIdChunks;
import org.apache.poi.hsmf.datatypes.RecipientChunks;
@ -135,7 +135,7 @@ public final class POIFSChunkParser {
Chunk chunk = null;
// Special cases based on the ID
if(chunkId == MAPIAttribute.MESSAGE_SUBMISSION_ID.id) {
if(chunkId == MAPIProperty.MESSAGE_SUBMISSION_ID.id) {
chunk = new MessageSubmissionChunk(namePrefix, chunkId, type);
}
else {

View File

@ -53,28 +53,28 @@ public final class TestChunkData extends TestCase {
public void testTextBodyChunk() {
StringChunk chunk = new StringChunk(0x1000, Types.UNICODE_STRING);
assertEquals(chunk.getChunkId(), MAPIAttribute.BODY.id);
assertEquals(chunk.getChunkId(), MAPIProperty.BODY.id);
}
public void testDisplayToChunk() {
StringChunk chunk = new StringChunk(0x0E04, Types.UNICODE_STRING);
assertEquals(chunk.getChunkId(), MAPIAttribute.DISPLAY_TO.id);
assertEquals(chunk.getChunkId(), MAPIProperty.DISPLAY_TO.id);
}
public void testDisplayCCChunk() {
StringChunk chunk = new StringChunk(0x0E03, Types.UNICODE_STRING);
assertEquals(chunk.getChunkId(), MAPIAttribute.DISPLAY_CC.id);
assertEquals(chunk.getChunkId(), MAPIProperty.DISPLAY_CC.id);
}
public void testDisplayBCCChunk() {
StringChunk chunk = new StringChunk(0x0E02, Types.UNICODE_STRING);
assertEquals(chunk.getChunkId(), MAPIAttribute.DISPLAY_BCC.id);
assertEquals(chunk.getChunkId(), MAPIProperty.DISPLAY_BCC.id);
}
public void testSubjectChunk() {
Chunk chunk = new StringChunk(0x0037, Types.UNICODE_STRING);
assertEquals(chunk.getChunkId(), MAPIAttribute.SUBJECT.id);
assertEquals(chunk.getChunkId(), MAPIProperty.SUBJECT.id);
}
}

View File

@ -28,7 +28,7 @@ import org.apache.poi.hsmf.MAPIMessage;
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
import org.apache.poi.hsmf.datatypes.ChunkGroup;
import org.apache.poi.hsmf.datatypes.Chunks;
import org.apache.poi.hsmf.datatypes.MAPIAttribute;
import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.hsmf.datatypes.NameIdChunks;
import org.apache.poi.hsmf.datatypes.RecipientChunks;
import org.apache.poi.hsmf.datatypes.RecipientChunks.RecipientChunksSorter;
@ -57,10 +57,10 @@ public final class TestPOIFSChunkParser extends TestCase {
// Check a few core things are present
simple.getRoot().getEntry(
(new StringChunk(MAPIAttribute.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
(new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
);
simple.getRoot().getEntry(
(new StringChunk(MAPIAttribute.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
(new StringChunk(MAPIProperty.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
);
// Now load the file