org.nhindirect.stagent
Class DefaultMessageEnvelope

java.lang.Object
  extended by org.nhindirect.stagent.DefaultMessageEnvelope
All Implemented Interfaces:
MessageEnvelope
Direct Known Subclasses:
IncomingMessage, OutgoingMessage

public class DefaultMessageEnvelope
extends Object
implements MessageEnvelope

A wrapper around a MimeMessage that categorizes routing headers such as trusted and non trusted recipients.

Author:
Greg Meyer, Umesh Madan

Constructor Summary
DefaultMessageEnvelope(Message message)
          Constructs an envelope from a message.
DefaultMessageEnvelope(Message message, NHINDAddressCollection recipients, NHINDAddress sender)
          Constructs an envelope from a message, a list of recipients, and a sender.
DefaultMessageEnvelope(String rawMessage)
          Constructs an envelope from a message represented by a raw string..
DefaultMessageEnvelope(String rawMessage, NHINDAddressCollection recipients, NHINDAddress sender)
          Constructs an envelope from a message represented as a raw string, a list of recipients, and a sender.
 
Method Summary
 void ensureRecipientsCategorizedByDomain(Collection<String> domains)
           
 NHINDAgent getAgent()
          Gets the agent associated with the message.
 NHINDAddressCollection getDomainRecipients()
          Gets a list of recipients in the message that are part of the agent's domain.
 Message getMessage()
          Gets the mime message wrapped in the envelope.
 Collection<NHINDAddress> getOtherRecipients()
          Gets a list of recipients in the message that are not part of the agent's domain.
 NHINDAddressCollection getRecipients()
          The collection of message recipients.
 NHINDAddressCollection getRejectedRecipients()
          Gets a list of recipients in the message that are not trusted by the address.
 NHINDAddress getSender()
          Gets the sender of the message.
 boolean hasDomainRecipients()
          Indicates if the message has recipients that are in the agent's domain.
 boolean hasOtherRecipients()
          Indicates if the message has recipients that are not in the agent's domain.
 boolean hasRecipients()
          Indicates if the message has any recipients.
 boolean hasRejectedRecipients()
          Indicates if the message has recipients that are not trusted by the address.
 String serializeMessage()
          Serializes the wrapped message to a raw string representation.
 void setAgent(NHINDAgent agent)
          Associates the security and trust agent with the message.
 void setMessage(Message message)
          Sets the mime message wrapped in the envelope.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageEnvelope

public DefaultMessageEnvelope(Message message)
Constructs an envelope from a message.

Parameters:
message - The mime message.

DefaultMessageEnvelope

public DefaultMessageEnvelope(String rawMessage)
Constructs an envelope from a message represented by a raw string..

Parameters:
rawMessage - The mime message.

DefaultMessageEnvelope

public DefaultMessageEnvelope(Message message,
                              NHINDAddressCollection recipients,
                              NHINDAddress sender)
Constructs an envelope from a message, a list of recipients, and a sender. This is intended to override the standard to and from headers in the incoming message.

Parameters:
message - The mime message.
recipients - A collection of addresses that denote the recipients of the message.
sender - The original sender of the message.

DefaultMessageEnvelope

public DefaultMessageEnvelope(String rawMessage,
                              NHINDAddressCollection recipients,
                              NHINDAddress sender)
Constructs an envelope from a message represented as a raw string, a list of recipients, and a sender. This is intended to override the standard to and from headers in the incoming message.

Parameters:
message - The incoming message.
recipients - A collection of addresses that denote the recipients of the message.
sender - The original sender of the message.
Method Detail

getAgent

public NHINDAgent getAgent()
Gets the agent associated with the message.

Specified by:
getAgent in interface MessageEnvelope
Returns:
The security and trust agent.

setAgent

public void setAgent(NHINDAgent agent)
Associates the security and trust agent with the message.

Parameters:
agent - The security and trust agent.

getMessage

public Message getMessage()
Gets the mime message wrapped in the envelope.

Specified by:
getMessage in interface MessageEnvelope
Returns:
the mime message wrapped in the envelope.

setMessage

public void setMessage(Message message)
Sets the mime message wrapped in the envelope.

Parameters:
message - The mime message wrapped in the envelope.

getSender

public NHINDAddress getSender()
Gets the sender of the message.

Specified by:
getSender in interface MessageEnvelope
Returns:
The sender of the message.

getRecipients

public NHINDAddressCollection getRecipients()
The collection of message recipients.

Specified by:
getRecipients in interface MessageEnvelope
Returns:
Collection of message recipients.

hasRecipients

public boolean hasRecipients()
Indicates if the message has any recipients.

Specified by:
hasRecipients in interface MessageEnvelope
Returns:
True if the message has recipients. False otherwise.

getRejectedRecipients

public NHINDAddressCollection getRejectedRecipients()
Gets a list of recipients in the message that are not trusted by the address.

Specified by:
getRejectedRecipients in interface MessageEnvelope
Returns:
A list of recipients in the message that are not trusted by the address.

hasRejectedRecipients

public boolean hasRejectedRecipients()
Indicates if the message has recipients that are not trusted by the address.

Specified by:
hasRejectedRecipients in interface MessageEnvelope
Returns:
True if the message has recipients that are not trusted by the address. False otherwise.

getDomainRecipients

public NHINDAddressCollection getDomainRecipients()
Gets a list of recipients in the message that are part of the agent's domain.

Specified by:
getDomainRecipients in interface MessageEnvelope
Returns:
A list of recipients in the agent's domain.

hasDomainRecipients

public boolean hasDomainRecipients()
Indicates if the message has recipients that are in the agent's domain.

Specified by:
hasDomainRecipients in interface MessageEnvelope
Returns:
True if the message has recipients that are in the agent's domain. False otherwise.

getOtherRecipients

public Collection<NHINDAddress> getOtherRecipients()
Gets a list of recipients in the message that are not part of the agent's domain.

Specified by:
getOtherRecipients in interface MessageEnvelope
Returns:
A list of recipients that are not in the agent's domain.

hasOtherRecipients

public boolean hasOtherRecipients()
Indicates if the message has recipients that are not in the agent's domain.

Specified by:
hasOtherRecipients in interface MessageEnvelope
Returns:
True if the message has recipients that are not in the agent's domain. False otherwise.

serializeMessage

public String serializeMessage()
Serializes the wrapped message to a raw string representation.

Specified by:
serializeMessage in interface MessageEnvelope
Returns:
The wrapped message to as a raw string representation.

ensureRecipientsCategorizedByDomain

public void ensureRecipientsCategorizedByDomain(Collection<String> domains)
Specified by:
ensureRecipientsCategorizedByDomain in interface MessageEnvelope


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