use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class RegexMetadataFilter method exclude.
/**
* Take a collection of metadata items and filter that collection based on the list of excluding
* regular expression patterns.
*
* @param metadataCollection the <code>MetadataCollection</code>
* @return A new modified collection.
*/
private MetadataCollection exclude(MetadataCollection metadataCollection) {
if (getExcludePatterns().size() == 0) {
return metadataCollection;
}
initialisePatterns();
MetadataCollection toBeRemoved = new MetadataCollection();
toBeRemoved.addAll(metadataCollection.stream().filter(e -> matches(e, patternExcludes)).collect(Collectors.toList()));
metadataCollection.removeAll(toBeRemoved);
return metadataCollection;
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class DiscardValuesTooLongFilter method filter.
@Override
public MetadataCollection filter(MetadataCollection original) {
MetadataCollection result = new MetadataCollection();
int maxLen = maxLength();
result.addAll(original.stream().filter(e -> e.getValue().length() <= maxLen).collect(Collectors.toList()));
return result;
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class StringMetadataParameter method createParameters.
@Override
public Map createParameters(AdaptrisMessage msg, Map existingParams) {
MetadataCollection metadataToInclude = metadataFilter.filter(msg);
if (metadataToInclude.size() == 0) {
return existingParams;
}
Map params = existingParams == null ? new HashMap() : new HashMap(existingParams);
for (MetadataElement e : metadataToInclude) {
params.put(e.getKey(), e.getValue());
}
log.trace("Stylesheet parameters: {}", params);
return params;
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MultipartMessageBuilder method createOutputPart.
protected MultiPartOutput createOutputPart(AdaptrisMessage msg) throws Exception {
MultiPartOutput output = new MultiPartOutput(contentId(msg), mimeContentSubType(msg));
MetadataCollection metadata = mimeHeaderFilter().filter(msg);
metadata.forEach((e) -> {
output.setHeader(e.getKey(), e.getValue());
});
return output;
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataResponseHeaderProvider method addHeaders.
@Override
public HttpServletResponse addHeaders(AdaptrisMessage msg, HttpServletResponse target) {
MetadataCollection subset = getFilter().filter(msg);
for (MetadataElement me : subset) {
log.trace("Adding Response Header [{}: {}]", me.getKey(), me.getValue());
target.addHeader(me.getKey(), me.getValue());
}
return target;
}
Aggregations