this.setServer(server);
}
protected void summarizeHourly(BAMCalendar loHour, BAMCalendar hiHour) {
try {
SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();
HourDimension hd = spm.getHourDimension(loHour);
if (hd == null) {
spm.addHourDimension(loHour);
hd = spm.getHourDimension(loHour);
}
//TODO: flag
MediationSummaryStatistic stat = spm.getProxyServiceStatHourlySummary(getServer().getId(),
getProxyService().getName(), getProxyService().getDirection(), loHour, hiHour);
stat.setName(getProxyService().getName());
stat.setTimeDimensionId(hd.getId());
stat.setServerId(getServer().getId());
stat.setDirection(getProxyService().getDirection());
SummaryPersistenceManager.getInstance().addProxyServiceStatHourlySummary(stat);
TimeRange retention = BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).getDataRetentionPeriod();
// do not delete anything if the retention period specified is 0.
if (retention.getValue() != 0) {
BAMCalendar delLoHour = BAMCalendar.getInstance(loHour);
BAMCalendar delHiHour = BAMCalendar.getInstance(hiHour);
delHiHour.add(retention.getType(), -1 * retention.getValue());
delLoHour.add(retention.getType(), -1 * retention.getValue());
spm.deleteServerProxyServiceUserData(getServer().getId(),
getProxyService().getName(), getProxyService().getDirection(), delLoHour, delHiHour);
}
} catch (BAMException e) {
if (log.isErrorEnabled()) {
log.error("Error while running hourly summary generator for proxyService: " + getProxyService()