public SummaryStatistic getOperationStatHourlySummary(int opId, BAMCalendar startTime, BAMCalendar endTime)
throws BAMException {
BAMServiceSummaryDSClient serviceSummaryDSClient = null;
try {
serviceSummaryDSClient = BAMUtil.getBAMServiceSummaryDSClient();
SummaryStatistic stat = serviceSummaryDSClient.getOperationStatHourlySummary(opId, startTime, endTime);
BAMCalendar prevHourStartTime = BAMCalendar.getInstance(startTime);
prevHourStartTime.add(BAMCalendar.HOUR_OF_DAY, -24);
BAMCalendar prevHourEndTime = BAMCalendar.getInstance(endTime);
prevHourEndTime.add(BAMCalendar.HOUR_OF_DAY, -1);
SummaryStatistic maxStatThisHour = serviceSummaryDSClient.getOperationMaxCounts(opId, startTime, endTime);
SummaryStatistic maxStatPrevHour = serviceSummaryDSClient.getOperationMaxCounts(opId, prevHourStartTime, prevHourEndTime);
int val;
val = maxStatThisHour.getReqCount() - maxStatPrevHour.getReqCount();
stat.setReqCount(val >= 0 ? val : maxStatThisHour.getReqCount());
if (maxStatThisHour.getReqCount() <= 0) {
stat.setAllZeros();
} else {
val = maxStatThisHour.getResCount() - maxStatPrevHour.getResCount();
stat.setResCount(val >= 0 ? val : maxStatThisHour.getResCount());
val = maxStatThisHour.getFaultCount() - maxStatPrevHour.getFaultCount();
stat.setFaultCount(val >= 0? val : maxStatThisHour.getFaultCount());
}
return stat;
} catch (Exception e) {
throw new BAMException("Could not retrieve hourly summary for operation: " + opId