use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class RemoveAllMetadataFilterTest method testFilterMessage.
@Test
public void testFilterMessage() throws Exception {
RemoveAllMetadataFilter filter = new RemoveAllMetadataFilter();
MetadataCollection c = filter.filter(createMessage());
assertEquals(0, c.size());
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class ReformatMetadataKey method buildReplacements.
private MetadataCollection buildReplacements(MetadataCollection toFilter) throws ServiceException {
MetadataCollection replacements = new MetadataCollection();
for (MetadataElement e : toFilter) {
String newKey = reformatKey(e.getKey());
replacements.add(new MetadataElement(newKey, e.getValue()));
}
return replacements;
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataFilterService method doService.
@Override
public void doService(AdaptrisMessage msg) {
log.trace("Filtering metadata using [{}]", filter.getClass().getCanonicalName());
MetadataCollection filtered = filter.filter(msg);
msg.clearMetadata();
msg.setMetadata(filtered.toSet());
logMetadata("Metadata preserved : {}", filtered);
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class HttpProducer method getAdditionalHeaders.
/**
* Get any additional items that need to be added as HTTP Headers.
*
* @param msg the AdaptrisMessage
* @return a set of properties that contain the required items.
* @see #setAdditionalHeaders(KeyValuePairSet)
* @see #setMetadataFilter(MetadataFilter)
*/
protected Properties getAdditionalHeaders(AdaptrisMessage msg) {
Properties result = new Properties();
for (Iterator i = additionalHeaders.getKeyValuePairs().iterator(); i.hasNext(); ) {
KeyValuePair kp = (KeyValuePair) i.next();
result.setProperty(kp.getKey(), kp.getValue());
}
MetadataCollection metadataSubset = getMetadataFilter().filter(msg);
for (MetadataElement me : metadataSubset) {
result.setProperty(me.getKey(), me.getValue());
}
return result;
}
use of com.adaptris.core.MetadataCollection 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;
}
Aggregations