log.log(Level.WARNING, "value #" + j);
MetricValue value = values.next();
for (int i=0; i< metricGoals.size(); i++) {
String isGoalMet = "N";
MetricGoal goal = metricGoals.get(i);
if (value.getTimeFrame().after(goal.getEffectivityDate()) &&
value.getTimeFrame().before(goal.getExpirationDate())) {
if (goal.getGoalType().equals(MetricGoal.HIGHISBETTER) && goal.getGoal() <= value.getValue()) {
isGoalMet = "Y";
}
else if (goal.getGoalType().equals(MetricGoal.LOWISBETTER) && goal.getGoal() >= value.getValue()) {
isGoalMet = "Y";
}
}
try {
log.log(Level.WARNING, "timeframe: " + value.getTimeFrame());
log.log(Level.WARNING, "value: " + value.getValue());
log.log(Level.WARNING, "goal name: " + goal.getName());
log.log(Level.WARNING, "isGoalMet: " + isGoalMet);
log.log(Level.WARNING, "percent to goal: " + MessageFormat.format("{0,number,#.##%}", value.getValue() / goal.getGoal()));
TableRow row = new TableRow();
row.addCell(new TableCell(new TextValue(value.getTimeFrame().toString())));
row.addCell(new TableCell(new NumberValue(value.getValue())));
row.addCell(new TableCell(new TextValue(goal.getName())));
row.addCell(new TableCell(new TextValue(isGoalMet)));
row.addCell(new TableCell(new TextValue(MessageFormat.format("{0,number,#.##%}", value.getValue() / goal.getGoal()))));
data.addRow(row);
} catch (TypeMismatchException e) {
ExceptionManager.logException(log, e);
return null;