atg.userprofiling.dms
Class InboundEmailMessage

java.lang.Object
  extended by atg.nucleus.dms.DASMessage
      extended by atg.userprofiling.dms.InboundEmailMessage
All Implemented Interfaces:
java.io.Serializable

public class InboundEmailMessage
extends DASMessage

This is a JMS Message representing an inbound email message that was received by the POP3Service class. This is created for every single inbound email, regardless of whether it's been bounced or not.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static boolean DEBUG_MODE
           
protected static int INVALID_MESSAGE
           
protected  boolean mBounced
          Whether or not this email was bounced
protected  java.lang.String mBouncedEmailAddress
          The email address of the bounced recipient
protected  java.lang.String mBouncedErrorMessage
          The error message of the bounced email
protected  java.lang.String mBouncedReplyCode
          The reply code of the bounced email
protected  java.lang.String mBouncedStatusCode
          The status code of the bounced email
protected  boolean mCalculatedAllRecipients
          Whether or not we've already attempted to calculate the total number of recipients.
protected  javax.mail.Message mMessage
          The JavaMail Message object that represents the entire email
protected  java.lang.String[] mMessageCc
          An array of email address that this email was copied to
protected  java.lang.String mMessageFrom
          The email address of the email sender
protected  java.lang.String[] mMessageRecipients
          A combination of all the address specified in the "To" and the "Cc" headers
protected  java.lang.String mMessageReplyTo
          The email address that any replies should be sent to
protected  java.lang.String mMessageSubject
          The subject of the email
protected  java.lang.String[] mMessageTo
          An array of email addresses that this email was sent to
protected  java.lang.String mOriginalSubject
          The original subject of the email, disregarding the standard "Re:" String that accompanies replies
protected  java.util.Date mReceivedDate
          The date that this email was received
protected  java.lang.String mReportingBouncedEmailAddressDomain
          The email address domain of the bounced recipient
protected  boolean mSoftBounced
          Whether or not this email was soft bounced
protected  java.util.Map mTrackingData
          The tracking data contained in the email
protected static int SERIAL_COMPATIBLE_V2
           
protected static int VALID_MESSAGE
           
 
Constructor Summary
InboundEmailMessage()
           
InboundEmailMessage(javax.mail.Message pMessage, boolean pBounced)
          Constructs an instance of InboundEmailMessage
InboundEmailMessage(javax.mail.Message pMessage, boolean pBounced, EmailExaminer pExaminer)
          Constructs an instance of InboundEmailMessage
InboundEmailMessage(java.lang.String pMessageSubject, java.lang.String pOriginalSubject, java.lang.String pMessageFrom, java.lang.String[] pMessageTo, java.lang.String[] pMessageCc, java.lang.String pMessageReplyTo, java.util.Date pReceivedDate, boolean pBounced, javax.mail.Message pMessage)
          Constructs an instance of InboundEmailMessage
 
Method Summary
protected  java.lang.String[] convertAddressToStringArray(javax.mail.Address[] pAddresses)
          Takes an array of javax.mail.Address objects and converts it into a String array of email addresses.
 java.lang.String getBouncedEmailAddress()
          Gets the BouncedEmailAddress property
 java.lang.String getBouncedErrorMessage()
          Gets the BouncedErrorMessage property
 java.lang.String getBouncedReplyCode()
          Gets the BouncedReplyCode property
 java.lang.String getBouncedStatusCode()
          Gets the BouncedStatusCode property
 javax.mail.Message getMessage()
          Gets the message property
 java.lang.String[] getMessageCc()
          Gets the messageCc property
 java.lang.String getMessageFrom()
          Gets the messageFrom property
 java.lang.String[] getMessageRecipients()
          Gets the messageRecipients property
 java.lang.String getMessageReplyTo()
          Gets the messageReplyTo property
 java.lang.String getMessageSubject()
          Gets the messageSubject property
 java.lang.String[] getMessageTo()
          Gets the messageTo property
 java.lang.String getOriginalSubject()
          Gets the originalSubject property
 java.lang.String getProfileId()
          Returns the profile id from the tracking data if it exists
 java.util.Date getReceivedDate()
          Gets the receivedDate property
 java.lang.String getReportingBounced()
          Returns a string representation of the bounced property, for reporting purposes only
 java.lang.Boolean getReportingBouncedAsBoolean()
          Returns a Boolean representation of the bounced property, for reporting purposes only
 java.lang.String getReportingBouncedEmailAddressDomain()
          Gets the ReportingBouncedEmailAddressDomain property
 java.lang.String getReportingMessageCc()
           
 java.lang.String getReportingMessageTo()
           
 java.lang.Long getReportingReceivedDate()
          Returns a java.lang.Long of the time represented by the current receivedDate property, for use in the reporting engine
 java.lang.String getReportingSoftBounced()
          Returns a string representation of the softBounced property, for reporting purposes only
 java.lang.Boolean getReportingSoftBouncedAsBoolean()
          Returns a Boolean representation of the softBounced property, for reporting purposes only
 java.util.Map getTrackingData()
          Gets the TrackingData property
 void initBounceProperties(EmailExaminer pExaminer)
          This method initializes all of the bounced email properties for this message, if the email is indeed bounced.
protected  void initFromMessage(javax.mail.Message pMessage)
          Utility method for extracting information out of a javax.mail.Message and populating this object's properties with it
 boolean isBounced()
          Gets the bounced property
 boolean isSoftBounced()
          Gets the softBounced property
static void main(java.lang.String[] pArgs)
           
protected  java.util.Date parseRFC822String(java.lang.String pStringDate)
          Utility method to turn a String representing a date into an actual java.util.Date object, using the syntax specifications from dates in rcf822.
 void setBounced(boolean pBounced)
          Sets the bounced property
 void setBouncedEmailAddress(java.lang.String pBouncedEmailAddress)
          Sets the BouncedEmailAddress property
 void setBouncedErrorMessage(java.lang.String pBouncedErrorMessage)
          Sets the BouncedErrorMessage property
 void setBouncedReplyCode(java.lang.String pBouncedReplyCode)
          Sets the BouncedReplyCode property
 void setBouncedStatusCode(java.lang.String pBouncedStatusCode)
          Sets the BouncedStatusCode property
 void setMessage(javax.mail.Message pMessage)
          Sets the message property
 void setMessageCc(java.lang.String[] pMessageCc)
          Sets the messageCc property
 void setMessageFrom(java.lang.String pMessageFrom)
          Sets the messageFrom property
 void setMessageRecipients(java.lang.String[] pMessageRecipients)
          Sets the messageRecipients property
 void setMessageReplyTo(java.lang.String pMessageReplyTo)
          Sets the messageReplyTo property
 void setMessageSubject(java.lang.String pMessageSubject)
          Sets the messageSubject property
 void setMessageTo(java.lang.String[] pMessageTo)
          Sets the messageTo property
 void setOriginalSubject(java.lang.String pOriginalSubject)
          Sets the original subject of the email
 void setReceivedDate(java.util.Date pReceivedDate)
          Sets the receivedDate property
 void setReportingBouncedEmailAddressDomain(java.lang.String pReportingBouncedEmailAddressDomain)
          Sets the ReportingBouncedEmailAddressDomain property
 void setSoftBounced(boolean pSoftBounced)
          Sets the softBounced property
 void setTrackingData(java.util.Map pTrackingData)
          Sets the TrackingData property
protected  java.lang.String toStringProperties()
          Returns the String representation of all the public properties of this message.
 
Methods inherited from class atg.nucleus.dms.DASMessage
limitSize, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


DEBUG_MODE

protected static boolean DEBUG_MODE

VALID_MESSAGE

protected static int VALID_MESSAGE

INVALID_MESSAGE

protected static int INVALID_MESSAGE

SERIAL_COMPATIBLE_V2

protected static int SERIAL_COMPATIBLE_V2

mCalculatedAllRecipients

protected boolean mCalculatedAllRecipients
Whether or not we've already attempted to calculate the total number of recipients. We only want to do that once


mMessageSubject

protected java.lang.String mMessageSubject
The subject of the email


mOriginalSubject

protected java.lang.String mOriginalSubject
The original subject of the email, disregarding the standard "Re:" String that accompanies replies


mMessageFrom

protected java.lang.String mMessageFrom
The email address of the email sender


mMessageTo

protected java.lang.String[] mMessageTo
An array of email addresses that this email was sent to


mMessageCc

protected java.lang.String[] mMessageCc
An array of email address that this email was copied to


mMessageRecipients

protected java.lang.String[] mMessageRecipients
A combination of all the address specified in the "To" and the "Cc" headers


mMessageReplyTo

protected java.lang.String mMessageReplyTo
The email address that any replies should be sent to


mReceivedDate

protected java.util.Date mReceivedDate
The date that this email was received


mBounced

protected boolean mBounced
Whether or not this email was bounced


mSoftBounced

protected boolean mSoftBounced
Whether or not this email was soft bounced


mBouncedEmailAddress

protected java.lang.String mBouncedEmailAddress
The email address of the bounced recipient


mReportingBouncedEmailAddressDomain

protected java.lang.String mReportingBouncedEmailAddressDomain
The email address domain of the bounced recipient


mBouncedStatusCode

protected java.lang.String mBouncedStatusCode
The status code of the bounced email


mBouncedReplyCode

protected java.lang.String mBouncedReplyCode
The reply code of the bounced email


mBouncedErrorMessage

protected java.lang.String mBouncedErrorMessage
The error message of the bounced email


mTrackingData

protected java.util.Map mTrackingData
The tracking data contained in the email


mMessage

protected javax.mail.Message mMessage
The JavaMail Message object that represents the entire email

Constructor Detail

InboundEmailMessage

public InboundEmailMessage()

InboundEmailMessage

public InboundEmailMessage(javax.mail.Message pMessage,
                           boolean pBounced)
Constructs an instance of InboundEmailMessage

Parameters:
pMessage - the JavaMail Message representing the inbound email. This Message will be used to set the values for this Object's properties not passed in to this constructor.
pBounced - indicates whether or not this email was bounced

InboundEmailMessage

public InboundEmailMessage(javax.mail.Message pMessage,
                           boolean pBounced,
                           EmailExaminer pExaminer)
Constructs an instance of InboundEmailMessage

Parameters:
pMessage - the JavaMail Message representing the inbound email. This Message will be used to set the values for this Object's properties not passed in to this constructor.
pBounced - indicates whether or not this email was bounced
pExaminer - the email examiner that will get bounced properties from the given message, if any

InboundEmailMessage

public InboundEmailMessage(java.lang.String pMessageSubject,
                           java.lang.String pOriginalSubject,
                           java.lang.String pMessageFrom,
                           java.lang.String[] pMessageTo,
                           java.lang.String[] pMessageCc,
                           java.lang.String pMessageReplyTo,
                           java.util.Date pReceivedDate,
                           boolean pBounced,
                           javax.mail.Message pMessage)
Constructs an instance of InboundEmailMessage

Parameters:
pMessageSubject - the subject of the email message
pOriginalSubject - the original subject of the email message i.e. with the "Re:" String stripped, if it exists
pMessageFrom - the email address of the sender
pMessageTo - an array of addresses listed in the "To" header
pMessageCc - an array of addresses listed in the "Cc" header
pMessageReplyTo - the email address that all replies should be sent to
pReceivedDate - the date the email message was received by the POP3 client
pBounced - indicates whether or not the email was bounced
pMessage - the JavaMail Message containing all of the headers and content/attachments
Method Detail

setMessageSubject

public void setMessageSubject(java.lang.String pMessageSubject)
Sets the messageSubject property


getMessageSubject

public java.lang.String getMessageSubject()
Gets the messageSubject property


setOriginalSubject

public void setOriginalSubject(java.lang.String pOriginalSubject)
Sets the original subject of the email


getOriginalSubject

public java.lang.String getOriginalSubject()
Gets the originalSubject property


setMessageFrom

public void setMessageFrom(java.lang.String pMessageFrom)
Sets the messageFrom property


getMessageFrom

public java.lang.String getMessageFrom()
Gets the messageFrom property


setMessageTo

public void setMessageTo(java.lang.String[] pMessageTo)
Sets the messageTo property


getMessageTo

public java.lang.String[] getMessageTo()
Gets the messageTo property


setMessageCc

public void setMessageCc(java.lang.String[] pMessageCc)
Sets the messageCc property


getMessageCc

public java.lang.String[] getMessageCc()
Gets the messageCc property


setMessageRecipients

public void setMessageRecipients(java.lang.String[] pMessageRecipients)
Sets the messageRecipients property


getMessageRecipients

public java.lang.String[] getMessageRecipients()
Gets the messageRecipients property


setMessageReplyTo

public void setMessageReplyTo(java.lang.String pMessageReplyTo)
Sets the messageReplyTo property


getMessageReplyTo

public java.lang.String getMessageReplyTo()
Gets the messageReplyTo property


setReceivedDate

public void setReceivedDate(java.util.Date pReceivedDate)
Sets the receivedDate property


getReceivedDate

public java.util.Date getReceivedDate()
Gets the receivedDate property


setBounced

public void setBounced(boolean pBounced)
Sets the bounced property


isBounced

public boolean isBounced()
Gets the bounced property


setSoftBounced

public void setSoftBounced(boolean pSoftBounced)
Sets the softBounced property


isSoftBounced

public boolean isSoftBounced()
Gets the softBounced property


setBouncedEmailAddress

public void setBouncedEmailAddress(java.lang.String pBouncedEmailAddress)
Sets the BouncedEmailAddress property


getBouncedEmailAddress

public java.lang.String getBouncedEmailAddress()
Gets the BouncedEmailAddress property


setReportingBouncedEmailAddressDomain

public void setReportingBouncedEmailAddressDomain(java.lang.String pReportingBouncedEmailAddressDomain)
Sets the ReportingBouncedEmailAddressDomain property


getReportingBouncedEmailAddressDomain

public java.lang.String getReportingBouncedEmailAddressDomain()
Gets the ReportingBouncedEmailAddressDomain property


setBouncedStatusCode

public void setBouncedStatusCode(java.lang.String pBouncedStatusCode)
Sets the BouncedStatusCode property


getBouncedStatusCode

public java.lang.String getBouncedStatusCode()
Gets the BouncedStatusCode property


setBouncedErrorMessage

public void setBouncedErrorMessage(java.lang.String pBouncedErrorMessage)
Sets the BouncedErrorMessage property


getBouncedErrorMessage

public java.lang.String getBouncedErrorMessage()
Gets the BouncedErrorMessage property


setBouncedReplyCode

public void setBouncedReplyCode(java.lang.String pBouncedReplyCode)
Sets the BouncedReplyCode property


getBouncedReplyCode

public java.lang.String getBouncedReplyCode()
Gets the BouncedReplyCode property


setTrackingData

public void setTrackingData(java.util.Map pTrackingData)
Sets the TrackingData property


getTrackingData

public java.util.Map getTrackingData()
Gets the TrackingData property


getProfileId

public java.lang.String getProfileId()
Returns the profile id from the tracking data if it exists


setMessage

public void setMessage(javax.mail.Message pMessage)
Sets the message property

Parameters:
pMessage - the javax.mail.Message object representing the inbound email

getMessage

public javax.mail.Message getMessage()
Gets the message property

Returns:
the javax.mail.Message object representing the inbound email

toStringProperties

protected java.lang.String toStringProperties()
Returns the String representation of all the public properties of this message.

Overrides:
toStringProperties in class DASMessage

initFromMessage

protected void initFromMessage(javax.mail.Message pMessage)
Utility method for extracting information out of a javax.mail.Message and populating this object's properties with it

Parameters:
pMessage - the javax.mail.Message that will be used to populate this object

initBounceProperties

public void initBounceProperties(EmailExaminer pExaminer)
This method initializes all of the bounced email properties for this message, if the email is indeed bounced. The given EmailExaminer should be able to parse this object's email message for bounced properties. This method is called only when the inbound message is assumed to be bounced

Parameters:
pExaminer - the examiner used to parse this object's message for bounce information

convertAddressToStringArray

protected java.lang.String[] convertAddressToStringArray(javax.mail.Address[] pAddresses)
Takes an array of javax.mail.Address objects and converts it into a String array of email addresses. It will strip out null or 0-length addresses

Parameters:
pAddresses - an array of javax.mail.Address objects

parseRFC822String

protected java.util.Date parseRFC822String(java.lang.String pStringDate)
Utility method to turn a String representing a date into an actual java.util.Date object, using the syntax specifications from dates in rcf822.

Parameters:
pStringDate - the string representation of the date

getReportingMessageTo

public java.lang.String getReportingMessageTo()
Returns:
a comma-separated string of all of the elements in the messageTo property, for reporting purposes only

getReportingMessageCc

public java.lang.String getReportingMessageCc()
Returns:
a comma-separated string of all of the elements in the messageCc property, for reporting purposes only

getReportingReceivedDate

public java.lang.Long getReportingReceivedDate()
Returns a java.lang.Long of the time represented by the current receivedDate property, for use in the reporting engine


getReportingBounced

public java.lang.String getReportingBounced()
Returns a string representation of the bounced property, for reporting purposes only


getReportingSoftBounced

public java.lang.String getReportingSoftBounced()
Returns a string representation of the softBounced property, for reporting purposes only


getReportingBouncedAsBoolean

public java.lang.Boolean getReportingBouncedAsBoolean()
Returns a Boolean representation of the bounced property, for reporting purposes only


getReportingSoftBouncedAsBoolean

public java.lang.Boolean getReportingSoftBouncedAsBoolean()
Returns a Boolean representation of the softBounced property, for reporting purposes only


main

public static void main(java.lang.String[] pArgs)