// evaluator with the highest priority
measurementsToEval.clear();
measurementsToEval.addAll(allMeasurementsToEval);
// prepare sample object with data
SampleObject sample = samples.get(i);
String samplePid = sample.getPid();
if (samplePid != null) {
sample.getData().setData(bytestreamManager.load(samplePid));
}
DigitalObject r = alternative.getExperiment().getResults().get(sample);
if ((r != null) && (r.getPid() != null)) {
r = digitalObjectManager.getCopyOfDataFilledDigitalObject(r);
}
try {
for (IObjectEvaluator evaluator : objEvaluators) {
// DigitalObject r2 = (r == null ? null :
// em.merge(r));
try {
Map<String, Value> results = evaluator.evaluate(alternative, sample, r,
measurementsToEval, statusListener);
// apply all results
for (String m : results.keySet()) {
Value value = results.get(m);
if (value != null) {
Leaf l = measurementOfLeaf.get(m);
value.setScale(l.getScale());
// add evaluation result for the current
// result-object!
l.getValues(alternative.getName()).setValue(i, value);
}
}
// exclude evaluated leaves from further
// evaluation
measurementsToEval.removeAll(results.keySet());
} catch (Exception e) {
log.error("evaluator failed: " + e.getMessage(), e);
continue;
}
}
} finally {
// free the bytestream data
sample.getData().releaseData();
}
}
}
} catch (Exception e) {
throw new PlanningException("Automated evaluation failed", e);