uoa-validator-api/src/main/java/eu/dnetlib/validatorapi/utils/ListSetAggregationStrategy....

35 lines
1.1 KiB
Java

package eu.dnetlib.validatorapi.utils;
import org.apache.camel.AggregationStrategy;
import org.apache.camel.Exchange;
public class ListSetAggregationStrategy implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
String oldBody = oldExchange.getIn().getBody(String.class);
String newBody = newExchange.getIn().getBody(String.class);
oldExchange.getIn().setBody(oldBody + newBody);
return oldExchange;
}
/* public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
newExchange.getIn().setBody("skata", String.class);
return newExchange;
}
oldExchange.getIn().setBody("skatakia", String.class);
String oldBody = oldExchange.getIn().getBody(String.class);
String newBody = newExchange.getIn().getBody(String.class);
oldExchange.getIn().setBody(oldBody + newBody);
return oldExchange;
}*/
}