byte[] messageByteArray = ((ByteArrayOutputStream) byteOutput) .toByteArray(); RawMessage message = new RawMessage(); message.setData(ByteBuffer.wrap(messageByteArray)); req.setRawMessage(message); return req;
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSource() == null) ? 0 : getSource().hashCode()); hashCode = prime * hashCode + ((getDestinations() == null) ? 0 : getDestinations().hashCode()); hashCode = prime * hashCode + ((getRawMessage() == null) ? 0 : getRawMessage().hashCode()); hashCode = prime * hashCode + ((getFromArn() == null) ? 0 : getFromArn().hashCode()); hashCode = prime * hashCode + ((getSourceArn() == null) ? 0 : getSourceArn().hashCode()); hashCode = prime * hashCode + ((getReturnPathArn() == null) ? 0 : getReturnPathArn().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getConfigurationSetName() == null) ? 0 : getConfigurationSetName().hashCode()); return hashCode; }
private RawMessage createRawMessage(MimeMessage mimeMessage) { ByteArrayOutputStream out; try { out = new ByteArrayOutputStream(); mimeMessage.writeTo(out); } catch (IOException e) { throw new MailPreparationException(e); } catch (MessagingException e) { throw new MailParseException(e); } return new RawMessage(ByteBuffer.wrap(out.toByteArray())); } }
RawMessage mail2Content(Email email) throws IOException, MessagingException, EmailException { email.buildMimeMessage(); ByteArrayOutputStream out = new ByteArrayOutputStream(); email.getMimeMessage().writeTo(out); return new RawMessage().withData(ByteBuffer.wrap(out.toByteArray())); }
if (other.getRawMessage() == null ^ this.getRawMessage() == null) return false; if (other.getRawMessage() != null && other.getRawMessage().equals(this.getRawMessage()) == false) return false; if (other.getFromArn() == null ^ this.getFromArn() == null)
private RawMessage createRawMessage(MimeMessage mimeMessage) { ByteArrayOutputStream out; try { out = new ByteArrayOutputStream(); mimeMessage.writeTo(out); } catch (IOException e) { throw new MailPreparationException(e); } catch (MessagingException e) { throw new MailParseException(e); } return new RawMessage(ByteBuffer.wrap(out.toByteArray())); } }
setData(data); return this;
return false; if (other.getRawMessage() != null && other.getRawMessage().equals(this.getRawMessage()) == false) return false; if (other.getFromArn() == null ^ this.getFromArn() == null)
public RawMessage unmarshall(StaxUnmarshallerContext context) throws Exception { RawMessage rawMessage = new RawMessage(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return rawMessage; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Data", targetDepth)) { rawMessage.setData(ByteBufferStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return rawMessage; } } } }
RawMessage rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray()));
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof RawMessage == false) return false; RawMessage other = (RawMessage) obj; if (other.getData() == null ^ this.getData() == null) return false; if (other.getData() != null && other.getData().equals(this.getData()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSource() == null) ? 0 : getSource().hashCode()); hashCode = prime * hashCode + ((getDestinations() == null) ? 0 : getDestinations().hashCode()); hashCode = prime * hashCode + ((getRawMessage() == null) ? 0 : getRawMessage().hashCode()); hashCode = prime * hashCode + ((getFromArn() == null) ? 0 : getFromArn().hashCode()); hashCode = prime * hashCode + ((getSourceArn() == null) ? 0 : getSourceArn().hashCode()); hashCode = prime * hashCode + ((getReturnPathArn() == null) ? 0 : getReturnPathArn().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getConfigurationSetName() == null) ? 0 : getConfigurationSetName().hashCode()); return hashCode; }
if (other.getRawMessage() == null ^ this.getRawMessage() == null) return false; if (other.getRawMessage() != null && other.getRawMessage().equals(this.getRawMessage()) == false) return false; if (other.getFromArn() == null ^ this.getFromArn() == null)
public RawMessage unmarshall(StaxUnmarshallerContext context) throws Exception { RawMessage rawMessage = new RawMessage(); 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("Data", targetDepth)) { rawMessage .setData(ByteBufferStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return rawMessage; }
/** * 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 (getData() != null) sb.append("Data: ").append(getData()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSource() == null) ? 0 : getSource().hashCode()); hashCode = prime * hashCode + ((getDestinations() == null) ? 0 : getDestinations().hashCode()); hashCode = prime * hashCode + ((getRawMessage() == null) ? 0 : getRawMessage().hashCode()); hashCode = prime * hashCode + ((getFromArn() == null) ? 0 : getFromArn().hashCode()); hashCode = prime * hashCode + ((getSourceArn() == null) ? 0 : getSourceArn().hashCode()); hashCode = prime * hashCode + ((getReturnPathArn() == null) ? 0 : getReturnPathArn().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getConfigurationSetName() == null) ? 0 : getConfigurationSetName().hashCode()); return hashCode; }