use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MetadataAppenderService method doService.
@Override
public void doService(AdaptrisMessage msg) {
StringBuffer result = new StringBuffer();
for (String key : appendKeys) {
if (msg.getMetadataValue(key) != null) {
result.append(msg.getMetadataValue(key));
}
}
MetadataElement e = new MetadataElement(resultKey, result.toString());
logMetadata("Added {}", e);
msg.addMetadata(e);
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class CompareTimestamps method compare.
@Override
public MetadataElement compare(MetadataElement firstItem, MetadataElement secondItem) throws ServiceException {
MetadataElement result = new MetadataElement();
result.setKey(getResultKey());
try {
result.setValue(String.valueOf(compareFormattedDates(firstItem.getValue(), secondItem.getValue())));
} catch (ParseException e) {
throw ExceptionHelper.wrapServiceException(e);
}
return result;
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class ConfiguredXpathQuery method resolveXpath.
@Override
public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception {
String result;
if (asXmlString()) {
Node node = XpathQueryHelper.resolveSingleNode(doc, xpath, expr, allowEmptyResults());
result = XmlHelper.nodeToString(node);
} else {
result = XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults());
}
return new MetadataElement(getMetadataKey(), result);
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MultiItemConfiguredXpathQuery method resolveXpath.
@Override
public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws CoreException {
String items = "";
if (asXmlString()) {
NodeList nodes = XpathQueryHelper.resolveNodeList(doc, xpath, expr, allowEmptyResults());
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
items += XmlHelper.nodeToString(node) + "\n";
}
} else {
items = XpathQueryHelper.resolveMultipleTextItems(doc, xpath, expr, allowEmptyResults(), getSeparator());
}
return new MetadataElement(getMetadataKey(), items);
}
use of com.adaptris.core.MetadataElement in project interlok by adaptris.
the class MultiItemMetadataXpathQuery method resolveXpath.
@Override
public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws CoreException {
String items = "";
if (asXmlString()) {
NodeList nodes = XpathQueryHelper.resolveNodeList(doc, xpath, expr, allowEmptyResults());
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
items += XmlHelper.nodeToString(node) + "\n";
}
} else {
items = XpathQueryHelper.resolveMultipleTextItems(doc, xpath, expr, allowEmptyResults(), getSeparator());
}
return new MetadataElement(getMetadataKey(), items);
}
Aggregations