for (Alert alert : alerts) {
Resource res = alert.getAlertDefinition().getResource();
String recoveryInfo = AlertDefUtil.getAlertRecoveryInfo(alert, res.getId());
if (alert.getConditionLogs().size() > 1) {
results.add(new AlertWithLatestConditionLog(alert, "Multiple Conditions", "--", recoveryInfo));
} else if (alert.getConditionLogs().size() == 1) {
AlertConditionLog log = alert.getConditionLogs().iterator().next();
AlertCondition condition = log.getCondition();
String displayText = AlertDefUtil.formatAlertConditionForDisplay(condition, request);
String firedValue = log.getValue();
if (condition.getMeasurementDefinition() != null) {
firedValue = MeasurementConverter.format(Double.valueOf(log.getValue()), condition
.getMeasurementDefinition().getUnits(), true);
}
results.add(new AlertWithLatestConditionLog(alert, displayText, firedValue, recoveryInfo));
} else {
results.add(new AlertWithLatestConditionLog(alert, "No Conditions", "--", recoveryInfo));
}
}
return new PageList<AlertWithLatestConditionLog>(results, alerts.getTotalSize(), pc);