use of com.adaptris.util.text.mime.MultiPartOutput in project interlok by adaptris.
the class IgnoreOriginalMimeAggregator method createInitialPart.
@Override
protected MultiPartOutput createInitialPart(AdaptrisMessage original) throws MessagingException, IOException {
MultiPartOutput output = new MultiPartOutput(original.getUniqueId(), mimeContentSubType(original));
MetadataCollection metadata = mimeHeaderFilter().filter(original);
metadata.forEach((e) -> {
output.setHeader(e.getKey(), e.getValue());
});
return output;
}
use of com.adaptris.util.text.mime.MultiPartOutput in project interlok by adaptris.
the class MimeAggregator method aggregate.
@Override
public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> msgs) throws CoreException {
try {
MultiPartOutput output = createInitialPart(original);
for (AdaptrisMessage m : msgs) {
if (filter(m)) {
output.addPart(createBodyPart(m), contentId(m));
overwriteMetadata(m, original);
}
}
try (OutputStream out = original.getOutputStream()) {
output.writeTo(out);
}
original.addMetadata(CoreConstants.MSG_MIME_ENCODED, Boolean.TRUE.toString());
} catch (Exception e) {
throw ExceptionHelper.wrapCoreException(e);
}
}
use of com.adaptris.util.text.mime.MultiPartOutput in project interlok by adaptris.
the class MimeAggregator method createInitialPart.
protected MultiPartOutput createInitialPart(AdaptrisMessage original) throws MessagingException, IOException {
MultiPartOutput output = new MultiPartOutput(original.getUniqueId(), mimeContentSubType(original));
MetadataCollection metadata = mimeHeaderFilter().filter(original);
metadata.forEach((e) -> {
output.setHeader(e.getKey(), e.getValue());
});
output.addPart(createBodyPart(original), contentId(original));
return output;
}
Aggregations