View Javadoc
1   /* 
2   Copyright (c) 2010, NHIN Direct Project
3   All rights reserved.
4   
5   Authors:
6      Umesh Madan     umeshma@microsoft.com
7      Greg Meyer      gm2552@cerner.com
8    
9   Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10  
11  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer 
13  in the documentation and/or other materials provided with the distribution.  Neither the name of the The NHIN Direct Project (nhindirect.org). 
14  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
16  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 
17  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
18  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
19  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
20  THE POSSIBILITY OF SUCH DAMAGE.
21  */package org.nhindirect.gateway.smtp;
22  
23  import java.util.Collection;
24  
25  import org.nhindirect.stagent.MessageEnvelope;
26  import org.nhindirect.stagent.mail.notifications.NotificationMessage;
27  
28  import java.util.Collections;
29  
30  /**
31   * Result structure for messages processed by the SmtpAgent.  Contains the result of processing the message and 
32   * an acknowledgment message that should be sent back according the security and trust policy.
33   * @author Greg Meyer
34   */
35  public class MessageProcessResult 
36  {
37  	private final MessageEnvelope processedMessage;
38  	
39  	private Collection<NotificationMessage> notificationMessages;
40  	
41  	/**
42  	 * Construct a result.
43  	 * @param processedMessage The resulting message of processing a message through the SmtpAgent.
44  	 * @param ackMessage An acknowledgment message that should be sent to the sender.
45  	 */
46  	public MessageProcessResult(MessageEnvelope processedMessage, Collection<NotificationMessage> notificationMessages)
47  	{
48  		this.processedMessage = processedMessage;
49  		this.notificationMessages = notificationMessages;
50  	}
51  
52  	/**
53  	 * Gets the resulting message of processing a message through the SmtpAgent.  A null message indicates that an error occurred while processing
54  	 * the message.
55  	 * @return The resulting message of processing a message through the SmtpAgen
56  	 */
57  	public MessageEnvelope getProcessedMessage() 
58  	{
59  		return processedMessage;
60  	}
61  
62  	/**
63  	 * Get the notification messages that should be sent back to the sender according the security and trust policy.
64  	 * @return The notification messages that should be sent back to the sender.
65  	 */
66  	public Collection<NotificationMessage> getNotificationMessages() 
67  	{
68  		if (notificationMessages != null)
69  			return Collections.unmodifiableCollection(notificationMessages);
70  		else
71  			return Collections.emptyList();
72  	}
73  
74  	public void setNotificationMessages(Collection<NotificationMessage> notificationMessages)
75  	{
76  		this.notificationMessages = notificationMessages;
77  	}
78  	
79  }