com.auxilii.msgparser
Class Message

Object
  extended by com.auxilii.msgparser.Message

public class Message
extends Object

Class that represents a .msg file. Some fields from the .msg file are stored in special parameters (e.g., fromEmail). Attachments are stored in the property attachments). An attachment may be of the type MsgAttachment which represents another attached (encapsulated) .msg object.

Author:
roman.kurmanowytsch

Field Summary
protected  List<Attachment> attachments
          A list of all attachments (both FileAttachment and MsgAttachment).
protected  String bodyRTF
          The body in RTF format (if available)
protected  String bodyText
          The normalized body text.
protected  Date date
          Email Date
protected  String fromEmail
          The address part of From: mail address.
protected  String fromName
          The name part of the From: mail address
protected  String headers
          Email headers (if available)
protected static Logger logger
           
protected  String messageClass
          The message class as defined in the .msg file.
protected  String messageId
          The message Id.
protected  Map<String,Object> properties
          Contains all properties that are not covered by the special properties.
protected  String subject
          The mail's subject.
protected  String toEmail
          The address part of To: mail address.
protected  String toName
          The name part of the To: mail address
 
Constructor Summary
Message()
           
 
Method Summary
 void addAttachment(Attachment attachment)
           
 String createMailString(String mail, String name)
          Convenience method for creating an email address expression (including the name, the address, or both).
 List<Attachment> getAttachments()
           
 String getBodyRTF()
           
 String getBodyText()
           
 Date getDate()
           
static Date getDateFromHeaders(String headers)
           
 String getFromEmail()
           
 String getFromName()
           
 String getHeaders()
           
 String getMessageClass()
           
 String getMessageId()
           
 String getSubject()
           
 String getToEmail()
           
 String getToName()
           
 void setAttachments(List<Attachment> attachments)
           
 void setBodyRTF(String bodyRTF)
           
 void setBodyText(String bodyText)
           
 void setDate(Date date)
           
 void setFromEmail(String fromEmail)
           
 void setFromName(String fromName)
           
 void setHeaders(String headers)
           
 void setMessageClass(String messageClass)
           
 void setMessageId(String messageId)
           
 void setProperty(String name, Object value)
          Sets the name/value pair in the properties map.
 void setSubject(String subject)
           
 void setToEmail(String toEmail)
           
 void setToName(String toName)
           
 String toLongString()
          Provides all information of this message object.
 String toString()
          Provides a short representation of this .msg object.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger

messageClass

protected String messageClass
The message class as defined in the .msg file.


messageId

protected String messageId
The message Id.


fromEmail

protected String fromEmail
The address part of From: mail address.


fromName

protected String fromName
The name part of the From: mail address


toEmail

protected String toEmail
The address part of To: mail address.


toName

protected String toName
The name part of the To: mail address


subject

protected String subject
The mail's subject.


bodyText

protected String bodyText
The normalized body text.


bodyRTF

protected String bodyRTF
The body in RTF format (if available)


headers

protected String headers
Email headers (if available)


date

protected Date date
Email Date


attachments

protected List<Attachment> attachments
A list of all attachments (both FileAttachment and MsgAttachment).


properties

protected Map<String,Object> properties
Contains all properties that are not covered by the special properties.

Constructor Detail

Message

public Message()
Method Detail

addAttachment

public void addAttachment(Attachment attachment)

setProperty

public void setProperty(String name,
                        Object value)
                 throws ClassCastException
Sets the name/value pair in the properties map. Some properties are put into special attributes (e.g., toEmail when the property name is '0076').

Parameters:
name - The property name (i.e., the class of the document entry).
value - The value of the field.
Throws:
ClassCastException - Thrown if the detected data type does not match the expected data type.

toString

public String toString()
Provides a short representation of this .msg object.

Overrides:
toString in class Object
See Also:
Object.toString()

toLongString

public String toLongString()
Provides all information of this message object.

Returns:
The full message information.

createMailString

public String createMailString(String mail,
                               String name)
Convenience method for creating an email address expression (including the name, the address, or both).

Parameters:
mail - The mail address.
name - The name part of the address.
Returns:
A combination of the name and address.

getAttachments

public List<Attachment> getAttachments()
Returns:
the attachments

setAttachments

public void setAttachments(List<Attachment> attachments)
Parameters:
attachments - the attachments to set

getBodyText

public String getBodyText()
Returns:
the bodyText

setBodyText

public void setBodyText(String bodyText)
Parameters:
bodyText - the bodyText to set

getFromEmail

public String getFromEmail()
Returns:
the fromEmail

setFromEmail

public void setFromEmail(String fromEmail)
Parameters:
fromEmail - the fromEmail to set

getFromName

public String getFromName()
Returns:
the fromName

setFromName

public void setFromName(String fromName)
Parameters:
fromName - the fromName to set

getMessageClass

public String getMessageClass()
Returns:
the messageClass

setMessageClass

public void setMessageClass(String messageClass)
Parameters:
messageClass - the messageClass to set

getMessageId

public String getMessageId()
Returns:
the messageId

setMessageId

public void setMessageId(String messageId)
Parameters:
messageId - the messageId to set

getSubject

public String getSubject()
Returns:
the subject

setSubject

public void setSubject(String subject)
Parameters:
subject - the subject to set

getToEmail

public String getToEmail()
Returns:
the toEmail

setToEmail

public void setToEmail(String toEmail)
Parameters:
toEmail - the toEmail to set

getToName

public String getToName()
Returns:
the toName

setToName

public void setToName(String toName)
Parameters:
toName - the toName to set

getBodyRTF

public String getBodyRTF()
Returns:
the bodyRTF

setBodyRTF

public void setBodyRTF(String bodyRTF)
Parameters:
bodyRTF - the bodyRTF to set

getHeaders

public String getHeaders()
Returns:
the headers

setHeaders

public void setHeaders(String headers)
Parameters:
headers - the headers to set

getDateFromHeaders

public static Date getDateFromHeaders(String headers)

getDate

public Date getDate()
Returns:
the date

setDate

public void setDate(Date date)
Parameters:
date - the date to set


Copyright © 2007 Roman Kurmanowytsch