@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode()); return hashCode; }
/** * <p> * The unique message identifier returned from the <code>SendRawEmail</code> action. * </p> * * @param messageId * The unique message identifier returned from the <code>SendRawEmail</code> action. * @return Returns a reference to this object so that method calls can be chained together. */ public SendRawEmailResult withMessageId(String messageId) { setMessageId(messageId); return this; }
public SendRawEmailResult unmarshall(StaxUnmarshallerContext context) throws Exception { SendRawEmailResult sendRawEmailResult = new SendRawEmailResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return sendRawEmailResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("MessageId", targetDepth)) { sendRawEmailResult.setMessageId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return sendRawEmailResult; } } } }
public SendRawEmailResult unmarshall(StaxUnmarshallerContext context) throws Exception { SendRawEmailResult sendRawEmailResult = new SendRawEmailResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("MessageId", targetDepth)) { sendRawEmailResult.setMessageId(StringStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return sendRawEmailResult; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SendRawEmailResult == false) return false; SendRawEmailResult other = (SendRawEmailResult) obj; if (other.getMessageId() == null ^ this.getMessageId() == null) return false; if (other.getMessageId() != null && other.getMessageId().equals(this.getMessageId()) == false) return false; return true; }
public SendRawEmailResult unmarshall(StaxUnmarshallerContext context) throws Exception { SendRawEmailResult sendRawEmailResult = new SendRawEmailResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return sendRawEmailResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("MessageId", targetDepth)) { sendRawEmailResult.setMessageId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return sendRawEmailResult; } } } }
/** * <p> * The unique message identifier returned from the <code>SendRawEmail</code> action. * </p> * * @param messageId * The unique message identifier returned from the <code>SendRawEmail</code> action. * @return Returns a reference to this object so that method calls can be chained together. */ public SendRawEmailResult withMessageId(String messageId) { setMessageId(messageId); return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMessageId() != null) sb.append("MessageId: ").append(getMessageId()); sb.append("}"); return sb.toString(); }
appendUserAgent(req, USER_AGENT); SendRawEmailResult resp = this.emailService.sendRawEmail(req); lastMessageId = resp.getMessageId(); sent = m.getAllRecipients(); unsent = new Address[0];
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SendRawEmailResult == false) return false; SendRawEmailResult other = (SendRawEmailResult) obj; if (other.getMessageId() == null ^ this.getMessageId() == null) return false; if (other.getMessageId() != null && other.getMessageId().equals(this.getMessageId()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMessageId() != null) sb.append("MessageId: " + getMessageId()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SendRawEmailResult == false) return false; SendRawEmailResult other = (SendRawEmailResult) obj; if (other.getMessageId() == null ^ this.getMessageId() == null) return false; if (other.getMessageId() != null && other.getMessageId().equals(this.getMessageId()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMessageId() != null) sb.append("MessageId: ").append(getMessageId()); sb.append("}"); return sb.toString(); }
@SuppressWarnings("OverloadedVarargsMethod") @Override public void send(MimeMessage... mimeMessages) throws MailException { Map<Object, Exception> failedMessages = new HashMap<>(); for (MimeMessage mimeMessage : mimeMessages) { try { RawMessage rm = createRawMessage(mimeMessage); SendRawEmailResult sendRawEmailResult = getEmailService().sendRawEmail(new SendRawEmailRequest(rm)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Message with id: {} successfully send", sendRawEmailResult.getMessageId()); } mimeMessage.setHeader("Message-ID", sendRawEmailResult.getMessageId()); } catch (Exception e) { //Ignore Exception because we are collecting and throwing all if any //noinspection ThrowableResultOfMethodCallIgnored failedMessages.put(mimeMessage, e); } } if (!failedMessages.isEmpty()) { throw new MailSendException(failedMessages); } }
@SuppressWarnings("OverloadedVarargsMethod") @Override public void send(MimeMessage... mimeMessages) throws MailException { Map<Object, Exception> failedMessages = new HashMap<>(); for (MimeMessage mimeMessage : mimeMessages) { try { RawMessage rm = createRawMessage(mimeMessage); SendRawEmailResult sendRawEmailResult = getEmailService().sendRawEmail(new SendRawEmailRequest(rm)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Message with id: {} successfully send", sendRawEmailResult.getMessageId()); } mimeMessage.setHeader("Message-ID", sendRawEmailResult.getMessageId()); } catch (Exception e) { //Ignore Exception because we are collecting and throwing all if any //noinspection ThrowableResultOfMethodCallIgnored failedMessages.put(mimeMessage, e); } } if (!failedMessages.isEmpty()) { throw new MailSendException(failedMessages); } }
appendUserAgent(req, USER_AGENT); SendRawEmailResult resp = this.emailService.sendRawEmail(req); lastMessageId = resp.getMessageId(); sent = m.getAllRecipients(); unsent = new Address[0];