org.nhindirect.stagent.mail.notifications
Class Notification

java.lang.Object
  extended by org.nhindirect.stagent.mail.notifications.Notification

public class Notification
extends Object

Represents notification (MDN) content.

The NotificationMessage represents the actually sendable MDN.

Author:
Greg Meyer, Umesh Madan

Constructor Summary
Notification(Disposition disposition)
          Initializes a new instance with the supplied Disposition
Notification(NotificationType notification)
          Initializes a new instance of the supplied notification type.
 
Method Summary
 javax.mail.internet.MimeMultipart getAsMultipart()
          Gets the notification object as a MimeMultipart object;
 Disposition getDisposition()
          Gets the Disposition for this instance.
 String getError()
          Gets the value of the error header.
 String getExplanation()
          Gets the body part corresponding to the notification explanation.
 Collection<String> getExtensions()
          Gets the list of extension values
 String getFailure()
          Gets the value of the failure header.
 String getFinalRecipeint()
          Gets the final recipient for this instance.
 MdnGateway getGateway()
          Gets the gateway that triggered this notification (optional).
 InputStream getInputStream()
          Gets an input stream of this notification that can be serialized.
 javax.mail.internet.InternetHeaders getNotificationFieldsAsHeaders()
          Parses the notification part fields into InternetHeaders.
static javax.mail.internet.InternetHeaders getNotificationFieldsAsHeaders(javax.mail.internet.MimeMessage message)
          Parses the notification part fields of a MDN MimeMessage message.
static javax.mail.internet.InternetHeaders getNotificationFieldsAsHeaders(javax.mail.internet.MimeMultipart mm)
          Parses the notification part fields of the MimeMultipart body of a MDN message.
 String getOriginalMessageId()
          Gets the ID of the message that triggered this notification (optional).
 Collection<MimeEntity> getParts()
          Returns a collection of body parts of the multipart report for this notification.
 ReportingUserAgent getReportingAgent()
          Gets the reporting agent that triggered this notification (optional).
 String getWarning()
          Gets the value of the warning header.
 byte[] serializeToBytes()
          Serializes the notification to an array of bytes.
 void setDisposition(Disposition disposition)
          Sets the Disposition for this instance.
 void setError(String error)
          Sets the value of the error header.
 void setExplanation(String explanation)
          Sets the body part corresponding to the notification explanation.
 void setExtensions(Collection<String> extensions)
          Sets the list of extension fields.
 void setFailure(String failure)
          Sets the value of the failure header.
 void setFinalRecipient(String recip)
          Sets final recipient.
 void setGateway(MdnGateway gateway)
          Sets the gateway that triggered this notification (optional).
 void setOriginalMessageId(String messageId)
          Sets the ID of the message that triggered this notification (optional).
 void setReportingAgent(ReportingUserAgent reportingAgent)
          Sets the reporting agent that triggered this notification (optional).
 void setWarning(String warning)
          Sets the value of the warning header.
 String toString()
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Notification

public Notification(NotificationType notification)
Initializes a new instance of the supplied notification type.

Parameters:
notification - The notification disposition for this instance.

Notification

public Notification(Disposition disposition)
Initializes a new instance with the supplied Disposition

Parameters:
disposition - The notification disposition for this instance.
Method Detail

getExplanation

public String getExplanation()
Gets the body part corresponding to the notification explanation.

From RFC 3798, section 3, item b:

The first component of the multipart/report contains a human- readable explanation of the MDN, as described in [RFC-REPORT].

Returns:
The body part corresponding to the notification explanation.

setExplanation

public void setExplanation(String explanation)
Sets the body part corresponding to the notification explanation.

Parameters:
explanation - The body part corresponding to the notification explanation.

getReportingAgent

public ReportingUserAgent getReportingAgent()
Gets the reporting agent that triggered this notification (optional).

Returns:
The reporting agent that triggered this notification.

setReportingAgent

public void setReportingAgent(ReportingUserAgent reportingAgent)
Sets the reporting agent that triggered this notification (optional).

Parameters:
reportingAgent - The reporting agent that triggered this notification

getGateway

public MdnGateway getGateway()
Gets the gateway that triggered this notification (optional).

Returns:
The gateway that triggered this notification

setGateway

public void setGateway(MdnGateway gateway)
Sets the gateway that triggered this notification (optional).

Parameters:
gateway - The gateway that triggered this notification

getOriginalMessageId

public String getOriginalMessageId()
Gets the ID of the message that triggered this notification (optional).

Returns:
The ID of the message that triggered this notification

setOriginalMessageId

public void setOriginalMessageId(String messageId)
Sets the ID of the message that triggered this notification (optional).

Parameters:
messageId - The ID of the message that triggered this notification

getFinalRecipeint

public String getFinalRecipeint()
Gets the final recipient for this instance.

Returns:
the final recipient for this instance

setFinalRecipient

public void setFinalRecipient(String recip)
Sets final recipient.

Parameters:
messageId - The final recipient.

getDisposition

public Disposition getDisposition()
Gets the Disposition for this instance.

Returns:
the Disposition for this instance

setDisposition

public void setDisposition(Disposition disposition)
Sets the Disposition for this instance.

Parameters:
disposition - The Disposition for this instance

getError

public String getError()
Gets the value of the error header.

Returns:
The value of the error header.

setError

public void setError(String error)
Sets the value of the error header.

Parameters:
error - The value of the error header.

setWarning

public void setWarning(String warning)
Sets the value of the warning header.

Parameters:
warning - The value of the warning header.

getWarning

public String getWarning()
Gets the value of the warning header.

Returns:
The value of the warning header.

setFailure

public void setFailure(String failure)
Sets the value of the failure header.

Parameters:
failure - The value of the failure header.

getFailure

public String getFailure()
Gets the value of the failure header.

Returns:
The value of the failure header.

setExtensions

public void setExtensions(Collection<String> extensions)
Sets the list of extension fields. Extension fields can either just be an extension name or a name with a value where the name and value are separated by a ":" character.

Parameters:
failure - List of exentension values.

getExtensions

public Collection<String> getExtensions()
Gets the list of extension values

Returns:
The list of extension values

getParts

public Collection<MimeEntity> getParts()
Returns a collection of body parts of the multipart report for this notification.

Returns:
A collection of body parts of the multipart report for this notification.

getAsMultipart

public javax.mail.internet.MimeMultipart getAsMultipart()
Gets the notification object as a MimeMultipart object;

Returns:
The notification object as a MimeMultipart object;

serializeToBytes

public byte[] serializeToBytes()
Serializes the notification to an array of bytes.

Returns:
byte array serialized form on this notification.

getInputStream

public InputStream getInputStream()
Gets an input stream of this notification that can be serialized.

Returns:
An input stream of this notification

toString

public String toString()

Overrides:
toString in class Object

getNotificationFieldsAsHeaders

public javax.mail.internet.InternetHeaders getNotificationFieldsAsHeaders()
Parses the notification part fields into InternetHeaders.

Returns:
The notification part fields as a set of Internet headers.

getNotificationFieldsAsHeaders

public static javax.mail.internet.InternetHeaders getNotificationFieldsAsHeaders(javax.mail.internet.MimeMessage message)
Parses the notification part fields of a MDN MimeMessage message. The message is expected to conform to the MDN specification as described in RFC3798.

Returns:
The notification part fields as a set of Internet headers.

getNotificationFieldsAsHeaders

public static javax.mail.internet.InternetHeaders getNotificationFieldsAsHeaders(javax.mail.internet.MimeMultipart mm)
Parses the notification part fields of the MimeMultipart body of a MDN message. The multipart is expected to conform to the MDN specification as described in RFC3798.

Returns:
The notification part fields as a set of Internet headers.


Copyright © 2010-2015 NHIN Direct. All Rights Reserved.