Iterator<AlertCondition> condsIterator = conds.iterator();
Iterator<AlertConditionLog> condLogsIterator = condLogs.iterator();
for (AlertConditionBean alertCondBean : alertCondBeans) {
AlertCondition cond = condsIterator.next();
AlertConditionLog condLog = condLogsIterator.next();
AlertConditionCategory category = cond.getCategory();
if (category == AlertConditionCategory.CONTROL) {
alertCondBean.setActualValue(RequestUtils.message(request, "alert.current.list.ControlActualValue"));
} else if ((category == AlertConditionCategory.THRESHOLD) || (category == AlertConditionCategory.BASELINE)
|| (category == AlertConditionCategory.CHANGE)) {
// Format threshold and value.
MeasurementDefinition definition = condLog.getCondition().getMeasurementDefinition();
String firedValue;
try {
firedValue = MeasurementConverter.format(Double.valueOf(condLog.getValue()), definition.getUnits(),
true);
} catch (Exception e) {
// check if this is Calltime data
if (definition.getDataType() == DataType.CALLTIME)
firedValue = condLog.getValue();
else
firedValue = "??";
}
alertCondBean.setActualValue(firedValue);
} else if ((category == AlertConditionCategory.RESOURCE_CONFIG)
|| (category == AlertConditionCategory.EVENT)) {
// TODO: jmarques - add validation to make sure condition is a valid regex Pattern
alertCondBean.setActualValue(condLog.getValue());
} else if (category == AlertConditionCategory.TRAIT) {
alertCondBean.setActualValue(condLog.getValue());
} else {
alertCondBean.setActualValue("??");
}
}