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 8e5bc2a5cc
commit d9056a1a5d
10 changed files with 1127 additions and 1127 deletions

View File

@ -16,20 +16,20 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hsmf.datatypes; package org.apache.poi.hsmf.datatypes;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_ADDITIONAL_INFO; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_ADDITIONAL_INFO;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_CONTENT_BASE; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_CONTENT_BASE;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_CONTENT_LOCATION; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_CONTENT_LOCATION;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_DATA; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DATA;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_DISPOSITION; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_DISPOSITION;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_ENCODING; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_ENCODING;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_EXTENSION; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_EXTENSION;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_FILENAME; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_FLAGS; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_FLAGS;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_LONG_FILENAME; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_FILENAME;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_LONG_PATHNAME; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_LONG_PATHNAME;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_MIME_TAG; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_MIME_TAG;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_RENDERING; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_RENDERING;
import static org.apache.poi.hsmf.datatypes.MAPIAttribute.ATTACH_SIZE; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_SIZE;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; 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. * Called by the parser whenever a chunk is found.
*/ */
public void record(Chunk chunk) { public void record(Chunk chunk) {
if(chunk.getChunkId() == MAPIAttribute.MESSAGE_CLASS.id) { if(chunk.getChunkId() == MAPIProperty.MESSAGE_CLASS.id) {
messageClass = (StringChunk)chunk; messageClass = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.INTERNET_MESSAGE_ID.id) { else if(chunk.getChunkId() == MAPIProperty.INTERNET_MESSAGE_ID.id) {
messageId = (StringChunk)chunk; messageId = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.MESSAGE_SUBMISSION_ID.id) { else if(chunk.getChunkId() == MAPIProperty.MESSAGE_SUBMISSION_ID.id) {
// TODO - parse // TODO - parse
submissionChunk = (MessageSubmissionChunk)chunk; submissionChunk = (MessageSubmissionChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.RECEIVED_BY_ADDRTYPE.id) { else if(chunk.getChunkId() == MAPIProperty.RECEIVED_BY_ADDRTYPE.id) {
sentByServerType = (StringChunk)chunk; sentByServerType = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.TRANSPORT_MESSAGE_HEADERS.id) { else if(chunk.getChunkId() == MAPIProperty.TRANSPORT_MESSAGE_HEADERS.id) {
messageHeaders = (StringChunk)chunk; messageHeaders = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.CONVERSATION_TOPIC.id) { else if(chunk.getChunkId() == MAPIProperty.CONVERSATION_TOPIC.id) {
conversationTopic = (StringChunk)chunk; conversationTopic = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.SUBJECT.id) { else if(chunk.getChunkId() == MAPIProperty.SUBJECT.id) {
subjectChunk = (StringChunk)chunk; subjectChunk = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.ORIGINAL_SUBJECT.id) { else if(chunk.getChunkId() == MAPIProperty.ORIGINAL_SUBJECT.id) {
// TODO // TODO
} }
else if(chunk.getChunkId() == MAPIAttribute.DISPLAY_TO.id) { else if(chunk.getChunkId() == MAPIProperty.DISPLAY_TO.id) {
displayToChunk = (StringChunk)chunk; displayToChunk = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.DISPLAY_CC.id) { else if(chunk.getChunkId() == MAPIProperty.DISPLAY_CC.id) {
displayCCChunk = (StringChunk)chunk; displayCCChunk = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.DISPLAY_BCC.id) { else if(chunk.getChunkId() == MAPIProperty.DISPLAY_BCC.id) {
displayBCCChunk = (StringChunk)chunk; displayBCCChunk = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.SENDER_EMAIL_ADDRESS.id) { else if(chunk.getChunkId() == MAPIProperty.SENDER_EMAIL_ADDRESS.id) {
emailFromChunk = (StringChunk)chunk; emailFromChunk = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.SENDER_NAME.id) { else if(chunk.getChunkId() == MAPIProperty.SENDER_NAME.id) {
displayFromChunk = (StringChunk)chunk; displayFromChunk = (StringChunk)chunk;
} }
else if(chunk.getChunkId() == MAPIAttribute.BODY.id) { else if(chunk.getChunkId() == MAPIProperty.BODY.id) {
textBodyChunk = (StringChunk)chunk; 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 final class RecipientChunks implements ChunkGroup {
public static final String PREFIX = "__recip_version1.0_#"; public static final String PREFIX = "__recip_version1.0_#";
public static final MAPIAttribute RECIPIENT_NAME = MAPIAttribute.DISPLAY_NAME; public static final MAPIProperty RECIPIENT_NAME = MAPIProperty.DISPLAY_NAME;
public static final MAPIAttribute DELIVERY_TYPE = MAPIAttribute.ADDRTYPE; public static final MAPIProperty DELIVERY_TYPE = MAPIProperty.ADDRTYPE;
public static final MAPIAttribute RECIPIENT_EMAIL_ADDRESS = MAPIAttribute.EMAIL_ADDRESS; public static final MAPIProperty RECIPIENT_EMAIL_ADDRESS = MAPIProperty.EMAIL_ADDRESS;
public static final MAPIAttribute RECIPIENT_SEARCH = MAPIAttribute.SEARCH_KEY; public static final MAPIProperty RECIPIENT_SEARCH = MAPIProperty.SEARCH_KEY;
public static final MAPIAttribute RECIPIENT_SMTP_ADDRESS = MAPIAttribute.SMTP_ADDRESS; public static final MAPIProperty RECIPIENT_SMTP_ADDRESS = MAPIProperty.SMTP_ADDRESS;
public static final MAPIAttribute RECIPIENT_DISPLAY_NAME = MAPIAttribute.RECIPIENT_DISPLAY_NAME; public static final MAPIProperty RECIPIENT_DISPLAY_NAME = MAPIProperty.RECIPIENT_DISPLAY_NAME;
/** Our 0 based position in the list of recipients */ /** Our 0 based position in the list of recipients */
public int recipientNumber; 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.Chunk;
import org.apache.poi.hsmf.datatypes.ChunkGroup; 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.datatypes.Types;
import org.apache.poi.hsmf.parsers.POIFSChunkParser; import org.apache.poi.hsmf.parsers.POIFSChunkParser;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@ -41,10 +41,10 @@ public class HSMFDump {
for(ChunkGroup chunks : chunkGroups) { for(ChunkGroup chunks : chunkGroups) {
System.out.println(chunks.getClass().getSimpleName()); System.out.println(chunks.getClass().getSimpleName());
for(Chunk chunk : chunks.getChunks()) { for(Chunk chunk : chunks.getChunks()) {
MAPIAttribute attr = MAPIAttribute.get(chunk.getChunkId()); MAPIProperty attr = MAPIProperty.get(chunk.getChunkId());
String idName = attr.id + " - " + attr.name; String idName = attr.id + " - " + attr.name;
if(attr == MAPIAttribute.UNKNOWN) { if(attr == MAPIProperty.UNKNOWN) {
idName = chunk.getChunkId() + " - (unknown)"; idName = chunk.getChunkId() + " - (unknown)";
} }

View File

@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; 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; import org.apache.poi.hsmf.datatypes.Types;
/** /**
@ -32,18 +32,18 @@ public class TypesLister {
public TypesLister() {} public TypesLister() {}
public void listByName(PrintStream out) { public void listByName(PrintStream out) {
ArrayList<MAPIAttribute> all = new ArrayList<MAPIAttribute>(MAPIAttribute.getAll()); ArrayList<MAPIProperty> all = new ArrayList<MAPIProperty>(MAPIProperty.getAll());
Collections.sort(all, new Comparator<MAPIAttribute>() { Collections.sort(all, new Comparator<MAPIProperty>() {
public int compare(MAPIAttribute a, MAPIAttribute b) { public int compare(MAPIProperty a, MAPIProperty b) {
return a.name.compareTo(b.name); return a.name.compareTo(b.name);
} }
}); });
list(all, out); list(all, out);
} }
public void listById(PrintStream out) { public void listById(PrintStream out) {
ArrayList<MAPIAttribute> all = new ArrayList<MAPIAttribute>(MAPIAttribute.getAll()); ArrayList<MAPIProperty> all = new ArrayList<MAPIProperty>(MAPIProperty.getAll());
Collections.sort(all, new Comparator<MAPIAttribute>() { Collections.sort(all, new Comparator<MAPIProperty>() {
public int compare(MAPIAttribute a, MAPIAttribute b) { public int compare(MAPIProperty a, MAPIProperty b) {
if(a.id < b.id) return -1; if(a.id < b.id) return -1;
if(a.id > b.id) return +1; if(a.id > b.id) return +1;
return 0; return 0;
@ -51,8 +51,8 @@ public class TypesLister {
}); });
list(all, out); list(all, out);
} }
private void list(ArrayList<MAPIAttribute> list, PrintStream out) { private void list(ArrayList<MAPIProperty> list, PrintStream out) {
for(MAPIAttribute attr : list) { for(MAPIProperty attr : list) {
String id = Integer.toHexString(attr.id); String id = Integer.toHexString(attr.id);
while(id.length() < 4) { id = "0"+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.ChunkGroup;
import org.apache.poi.hsmf.datatypes.Chunks; import org.apache.poi.hsmf.datatypes.Chunks;
import org.apache.poi.hsmf.datatypes.DirectoryChunk; 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.MessageSubmissionChunk;
import org.apache.poi.hsmf.datatypes.NameIdChunks; import org.apache.poi.hsmf.datatypes.NameIdChunks;
import org.apache.poi.hsmf.datatypes.RecipientChunks; import org.apache.poi.hsmf.datatypes.RecipientChunks;
@ -135,7 +135,7 @@ public final class POIFSChunkParser {
Chunk chunk = null; Chunk chunk = null;
// Special cases based on the ID // 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); chunk = new MessageSubmissionChunk(namePrefix, chunkId, type);
} }
else { else {

View File

@ -53,28 +53,28 @@ public final class TestChunkData extends TestCase {
public void testTextBodyChunk() { public void testTextBodyChunk() {
StringChunk chunk = new StringChunk(0x1000, Types.UNICODE_STRING); StringChunk chunk = new StringChunk(0x1000, Types.UNICODE_STRING);
assertEquals(chunk.getChunkId(), MAPIAttribute.BODY.id); assertEquals(chunk.getChunkId(), MAPIProperty.BODY.id);
} }
public void testDisplayToChunk() { public void testDisplayToChunk() {
StringChunk chunk = new StringChunk(0x0E04, Types.UNICODE_STRING); 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() { public void testDisplayCCChunk() {
StringChunk chunk = new StringChunk(0x0E03, Types.UNICODE_STRING); 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() { public void testDisplayBCCChunk() {
StringChunk chunk = new StringChunk(0x0E02, Types.UNICODE_STRING); 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() { public void testSubjectChunk() {
Chunk chunk = new StringChunk(0x0037, Types.UNICODE_STRING); 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.AttachmentChunks;
import org.apache.poi.hsmf.datatypes.ChunkGroup; import org.apache.poi.hsmf.datatypes.ChunkGroup;
import org.apache.poi.hsmf.datatypes.Chunks; 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.NameIdChunks;
import org.apache.poi.hsmf.datatypes.RecipientChunks; import org.apache.poi.hsmf.datatypes.RecipientChunks;
import org.apache.poi.hsmf.datatypes.RecipientChunks.RecipientChunksSorter; 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 // Check a few core things are present
simple.getRoot().getEntry( simple.getRoot().getEntry(
(new StringChunk(MAPIAttribute.SUBJECT.id, Types.ASCII_STRING)).getEntryName() (new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
); );
simple.getRoot().getEntry( 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 // Now load the file