AggregateCountsResource result = new AggregateCountsResource(entity.getName());
ReadablePeriod increment = entity.getResolution().unitPeriod;
DateTime end = entity.getInterval().getEnd();
int i = 0;
for (DateTime when = entity.getInterval().getStart(); !when.isAfter(end); when = when.plus(increment)) {
result.addValue(new Date(when.getMillis()), entity.getCounts()[i++]);
}
return result;
}
}