//2. build the results on a per property basis
if( commonPropIDs != null ) {
for(String propertyID : commonPropIDs){
EvaluationPropertyResultsBean evalPropResBean = new EvaluationPropertyResultsBean(inputDigoRef, propertyID,this.getAllRunDates(),comparedStageNames);
List<String> lStageNames = Arrays.asList(comparedStageNames);
//2a. now iterate over the results and filter out the relevant ones for this property
for(BatchExecutionRecordImpl batchr : this.getExperiment().getExperimentExecutable().getBatchExecutionRecords()){
Calendar runDate = batchr.getEndDate();
for(ExecutionRecordImpl execRec : batchr.getRuns()){
//filter out by the selected inputDigitalObject
if(execRec.getDigitalObjectReferenceCopy().equals(inputDigoRef)){
for(ExecutionStageRecordImpl execStageRec : execRec.getStages()){
//filter out the selected stage
if(lStageNames.contains(execStageRec.getStage())){
/*
* FIXME: change this code - as a MeasurementImpl m
* from execStageRec.getMeasuredObservables()
* already has the value contained - accessible through m.getValue
*/
List<MeasurementImpl> mRecords=null;
if(manualProps){
//fetch the manual properties
mRecords = execStageRec.getManualMeasurements();
}
else{
//fetch the automatically measured properties
mRecords = execStageRec.getMeasurements();
}
for(MeasurementImpl mr : mRecords){
if(mr.getIdentifier().equals(propertyID)){
//found the measurementRecord for this property in this run
evalPropResBean.addMeasurementResult(runDate, execStageRec.getStage(), mr);
}
}
}
}
}
}
}
//2b. now iterate over the evaluation results and filter out the relevant ones
List<PropertyEvaluationRecordImpl> propEvalRecordords = this.getExperiment().getExperimentEvaluation().getPropertyEvaluation(inputDigoRef);
if(propEvalRecordords!=null){
for(PropertyEvaluationRecordImpl propEvalRecordImpl : propEvalRecordords){
//filter by the propertyID we're looking for
if(propEvalRecordImpl.getPropertyID().equals(evalPropResBean.getMeasurementPropertyID())){
//set the line evaluation value
evalPropResBean.setPropertyEvalValue(propEvalRecordImpl.getPropertyEvalValue());
for(Calendar runDate : this.getAllRunDates()){
PropertyRunEvaluationRecordImpl propRunEvalRecImpl = propEvalRecordImpl.getPropertyRunEvalRecord(runDate);
if(propRunEvalRecImpl!=null){
//set the per run evaluation value
evalPropResBean.setEvalResultValue(runDate, comparedStageNames, propRunEvalRecImpl.getRunEvalValue());
}
}
}
}
}
//3.finally add the MeasurementInfo data (name, description, for the propertyID etc.
if(manualProps){
OntologyProperty ontop = OntologyHandlerImpl.getInstance().getProperty(propertyID);
//create a MeasurementImpl from the OntologyProperty
try {
MeasurementImpl measurementinfo = OntoPropertyUtil.createMeasurementFromOntologyProperty(ontop);
evalPropResBean.setMeasurementInfo(measurementinfo);
} catch (Exception e) {
log.debug("Could not retrieve Ontology Property information for propertyID: "+propertyID);
}
}
else{
//TODO: still need to request this information from the workflow authority
MeasurementImpl measurementinfo = helperQueryAutoMeasurementAuthority(propertyID);
evalPropResBean.setMeasurementInfo(measurementinfo);
}
//Finally: check requirements if to add this evalProp item
//if(checkIfToAddEvaluationPropertyBean(evalPropResBean,comparedStageNames)){
ret.add(evalPropResBean);