public void ensureRecipientsCategorizedByDomain(Collection<String> domains) { if (hasDomainRecipients() || hasOtherRecipients()) { return; } categorizeRecipients(domains); }
/** * The collection of message recipients. * @return Collection of message recipients. */ public NHINDAddressCollection getRecipients() { if (this.recipients == null) { this.collectRecipients(); } return recipients; }
/** * 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. * @param message The incoming message. * @param recipients A collection of addresses that denote the recipients of the message. * @param sender The original sender of the message. */ public DefaultMessageEnvelope(String rawMessage, NHINDAddressCollection recipients, NHINDAddress sender) { this(fromStringToMessage(rawMessage), recipients, sender); }
/** * Gets a list of recipients in the message that are part of the agent's domain. * @return A list of recipients in the agent's domain. */ public NHINDAddressCollection getDomainRecipients() { if (this.domainRecipients == null) { categorizeRecipients(getAgent().getDomains()); } return domainRecipients; }
if (this.getTo() != null) this.getTo().removeAll(rejectedRecipients); if(this.getTo().isEmpty()) { this.getMessage().removeHeader(MailStandard.Headers.To); this.getMessage().setHeader(MailStandard.Headers.To, this.getTo().toString()); if (this.getCC() != null) this.getCC().removeAll(rejectedRecipients); if(this.getCC().isEmpty()) { this.getMessage().removeHeader(MailStandard.Headers.CC); this.getMessage().setHeader(MailStandard.Headers.CC, this.getCC().toString()); if (this.getBCC() != null) this.getBCC().removeAll(rejectedRecipients); if(this.getBCC().isEmpty()) { this.getMessage().removeHeader(MailStandard.Headers.BCC); this.getMessage().setHeader(MailStandard.Headers.BCC, this.getBCC().toString());
/** * Creates a collection of recipients based on the TO, CC, and BCC headers in the wrapped message. * @return A collection of recipients. */ protected NHINDAddressCollection collectRecipients() { NHINDAddressCollection addresses = new NHINDAddressCollection(); if (this.getTo() != null) { addresses.addAll(this.getTo()); } if (this.getCC() != null) { addresses.addAll(this.getCC()); } if (this.getBCC() != null) { addresses.addAll(this.getBCC()); } return addresses; }
/** * Constructs an envelope from a message. * @param message The mime message. */ public DefaultMessageEnvelope(Message message) { if (message == null) throw new IllegalArgumentException(); this.message = message; this.setRecipients(this.collectRecipients()); try { if (message.getFrom() == null || message.getFrom().length == 0) throw new AgentException(AgentError.MissingFrom); this.setSender(new NHINDAddress((InternetAddress)message.getFrom()[0], AddressSource.From)); } catch (MessagingException e) { throw new AgentException(AgentError.MissingFrom, e); } }
try envelopeToProcess = new DefaultMessageEnvelope(new Message(message), recipients, sender); envelopeToProcess.setAgent(agent);
/** * Indicates if the message has recipients that are not in the agent's domain. * @return True if the message has recipients that are not in the agent's domain. False otherwise. */ public boolean hasOtherRecipients() { Collection<NHINDAddress> oRecipients = this.getOtherRecipients(); return (oRecipients != null && oRecipients.size() > 0); }
private Collection<AuditContext> createContextCollectionFromMessage(Message msg, Collection<String> headers) { return createContextCollectionFromMessage(new DefaultMessageEnvelope(msg), headers); }
/** * Serializes the wrapped message to a raw string representation. * @return The wrapped message to as a raw string representation. */ public String serializeMessage() { return EntitySerializer.Default.serialize(this.getMessage()); }
/** * Indicates if the message has recipients that are in the agent's domain. * @return True if the message has recipients that are in the agent's domain. False otherwise. */ public boolean hasDomainRecipients() { NHINDAddressCollection dRecipients = this.getDomainRecipients(); return (dRecipients != null && dRecipients.size() > 0); }
@Override /** * {@inheritDoc} */ protected void categorizeRecipients(TrustEnforcementStatus minTrustStatus) { super.categorizeRecipients(minTrustStatus); this.getDomainRecipients().removeUntrusted(minTrustStatus); } }
/** * Gets a list of recipients in the message that are not part of the agent's domain. * @return A list of recipients that are not in the agent's domain. */ public Collection<NHINDAddress> getOtherRecipients() { if (this.otherRecipients == null) { categorizeRecipients(getAgent().getDomains()); } return this.otherRecipients; }
/** * Constructs an envelope from a message represented by a raw string.. * @param rawMessage The mime message. */ public DefaultMessageEnvelope(String rawMessage) { this(fromStringToMessage(rawMessage)); }