});
for (EtlCounts count : countsObjects) {
String topic = count.getTopic();
if (allCounts.containsKey(topic)) {
EtlCounts existingCounts = allCounts.get(topic);
existingCounts
.setEndTime(Math.max(
existingCounts.getEndTime(),
count.getEndTime()));
existingCounts.setLastTimestamp(Math.max(
existingCounts.getLastTimestamp(),
count.getLastTimestamp()));
existingCounts.setStartTime(Math.min(
existingCounts.getStartTime(),
count.getStartTime()));
existingCounts.setFirstTimestamp(Math.min(
existingCounts.getFirstTimestamp(),
count.getFirstTimestamp()));
existingCounts.setErrorCount(existingCounts
.getErrorCount() + count.getErrorCount());
existingCounts.setGranularity(count.getGranularity());
existingCounts.setTopic(count.getTopic());
for (Entry<String, Source> entry : count.getCounts()
.entrySet()) {
Source source = entry.getValue();
if (existingCounts.getCounts().containsKey(
source.toString())) {
Source old = existingCounts.getCounts().get(
source.toString());
old.setCount(old.getCount() + source.getCount());
existingCounts.getCounts().put(old.toString(),
old);
} else {
existingCounts.getCounts().put(
source.toString(), source);
}
allCounts.put(topic, existingCounts);
}
} else {