use of org.nhindirect.stagent.OutgoingMessage in project nhin-d by DirectProject.
the class DefaultSmtpAgent method postProcessMessage.
private void postProcessMessage(MessageProcessResult result) {
boolean isOutgoing = (result.getProcessedMessage() instanceof OutgoingMessage);
// check for rejected recipients
if (auditor != null && result.getProcessedMessage().getRejectedRecipients() != null && result.getProcessedMessage().getRejectedRecipients().size() > 0) {
Collection<AuditContext> contexts = createContextCollectionFromMessage(result.getProcessedMessage(), Arrays.asList(AuditEvents.DEFAULT_HEADER_CONTEXT));
StringBuffer rejectedRecips = new StringBuffer();
int cnt = 0;
for (NHINDAddress address : result.getProcessedMessage().getRejectedRecipients()) {
rejectedRecips.append(address.getAddress());
if (++cnt < result.getProcessedMessage().getRejectedRecipients().size())
rejectedRecips.append(", ");
}
contexts.add(new DefaultAuditContext(AuditEvents.REJECTED_RECIPIENTS_CONTEXT, rejectedRecips.toString()));
auditor.audit(PRINICPAL, new AuditEvent(AuditEvents.REJECTED_RECIP_NAME, AuditEvents.EVENT_TYPE), contexts);
}
if (isOutgoing)
postProcessOutgoingMessage(result);
else
postProcessIncomingMessage(result);
}
use of org.nhindirect.stagent.OutgoingMessage in project nhin-d by DirectProject.
the class WrappedMessageTest method testCopyNHINDStandard_encyrptMessage_assertPromotedInvalidCCHeaders.
public void testCopyNHINDStandard_encyrptMessage_assertPromotedInvalidCCHeaders() throws Exception {
DefaultNHINDAgent agent = TestUtils.getStockAgent(Arrays.asList(new String[] { "cerner.com" }));
String testMessage = TestUtils.readResource("CCTestMessage.txt");
OutgoingMessage SMIMEenvMessage = agent.processOutgoing(testMessage);
String ccHeader = SMIMEenvMessage.getMessage().getHeader(MailStandard.Headers.CC, ",");
assertNotNull(ccHeader);
assertEquals("User1@Cerner.com", ccHeader);
}
Aggregations