if( exp.getCurrentPhase() != null )
log.debug("Experiment Current Phase Stage is " + exp.getCurrentPhase().getState());
this.exp = exp;
ExperimentSetup expsetup = exp.getExperimentSetup();
BasicProperties props = expsetup.getBasicProperties();
this.id = exp.getEntityID();
this.ename =(props.getExperimentName());
this.escope=(props.getScope());
this.econsiderations=(props.getConsiderations());
this.econtactaddress=(props.getContactAddress());
this.econtactemail=(props.getContactMail());
this.econtacttel=(props.getContactTel());
this.econtactname=(props.getContactName());
// references
this.exid=props.getExternalReferenceID();
List<String[]> lit = props.getAllLiteratureReferences();
if (lit != null && !lit.isEmpty()) {
this.litrefdesc = new ArrayList<String>(lit.size());
this.litrefuri = new ArrayList<String>(lit.size());
this.litreftitle = new ArrayList<String>(lit.size());
this.litrefauthor = new ArrayList<String>(lit.size());
for( int i = 0; i < lit.size(); i++ ) {
this.litrefdesc.add(i, lit.get(i)[0]);
this.litrefuri.add(i,lit.get(i)[1]);
this.litreftitle.add(i,lit.get(i)[2]);
this.litrefauthor.add(i,lit.get(i)[3]);
}
}
List<Long> refs = props.getExperimentReferences();
if (refs != null && !refs.isEmpty()) {
this.eref = new ArrayList<String>(refs.size());
for( int i = 0; i < refs.size(); i++ )
this.eref.add(i, ""+refs.get(i) );
}
List<String> involvedUsers = props.getInvolvedUserIds();
String partpnts = " ";
for(int i=0;i<involvedUsers.size();i++) {
partpnts +=involvedUsers.get(i);
if( i < involvedUsers.size()-1 ) partpnts += ", ";
}
this.eparticipants = partpnts;
String Test = props.getExternalReferenceID();
this.exid=(Test);
this.efocus=(props.getFocus());
this.epurpose=(props.getPurpose());
this.esummary=(props.getSummary());
this.formality = props.isExperimentFormal();
//get already added TestbedServiceTemplate data
log.debug("fill expBean: executable = "+exp.getExperimentExecutable());
if(exp.getExperimentExecutable()!=null){
ExperimentExecutable executable = exp.getExperimentExecutable();
this.selSerTemplate = executable.getServiceTemplate();
if( selSerTemplate != null )
this.sSelSerTemplateID = selSerTemplate.getUUID();
this.sSelSerOperationName = executable.getSelectedServiceOperationName();
this.bOperationSelectionCompleted = true;
helperLoadInputData(executable.getInputData());
if(executable.isExecutionSuccess()){
//uses the executable to get the data
this.outputData = exp.getExperimentExecutable().getOutputDataEntries();
}
}
//fill the file benchmarks
log.info("Looking for BMGs... ");
try {
if (exp.getCurrentPhase() instanceof ExperimentEvaluation) {
if (this.inputData != null) {
//iterate over all input files
for(String localFileRef : this.inputData.values()) {
// Clean up the localFileRef, so that the TB can cope with it's data store being moved.
//store a set of file BMGoals for every record item
DataHandler dh = new DataHandlerImpl();
DigitalObjectRefBean dorb = dh.get(localFileRef);
if( dorb != null ) {
URI inputFileURI = dorb.getDownloadUri();
Collection<BenchmarkGoal> colFileBMGoals = exp.getExperimentEvaluation().getEvaluatedFileBenchmarkGoals(inputFileURI);
if(colFileBMGoals==null)
throw new Exception("Exception while setting file benchmarks for record: "+inputFileURI);
for(BenchmarkGoal bmg : colFileBMGoals){
log.info("Found fileBMG: " + bmg.getName());
log.info("Found fileBMG.id: " + bmg.getID());
//now crate the bmb out of the bmg
BenchmarkBean bmb = new BenchmarkBean(bmg);
bmb.setSourceValue(bmg.getSourceValue());
bmb.setTargetValue(bmg.getTargetValue());
bmb.setEvaluationValue(bmg.getEvaluationValue());
bmb.setWeight(String.valueOf(bmg.getWeight()));
bmb.setSelected(true);
if((bmb.getSourceValue()==null)||(bmb.getSourceValue().equals("")))
bmb.setSrcError(true);
if((bmb.getTargetValue()==null)||(bmb.getTargetValue().equals("")))
bmb.setTarError(true);
//now add the file bmbs for this experimentbean
fileBenchmarks.put(inputFileURI+bmb.getID(), bmb);
}
}
}
}
}
//fill the experiment overall benchmarks
Collection<BenchmarkGoal> lbmbs;
if (exp.getCurrentPhase() instanceof ExperimentEvaluation){
//get the data from the evaluation phase
lbmbs = exp.getExperimentEvaluation().getEvaluatedExperimentBenchmarkGoals();
log.info("Found eval #BMGs = " + lbmbs.size());
log.info("Found pre-eval #BMGs = " + exp.getExperimentSetup().getAllAddedBenchmarkGoals().size());
// if none, get the data from the setup phase
if( lbmbs.size() == 0 )
lbmbs = exp.getExperimentSetup().getAllAddedBenchmarkGoals();
}
else{
//get the data from the setup phase
lbmbs = exp.getExperimentSetup().getAllAddedBenchmarkGoals();
log.info("Found pre-eval #BMGs = " + lbmbs.size());
}
for(BenchmarkGoal bmg : lbmbs){
log.info("Found BMG: " + bmg.getName());
log.info("Found BMG.id: " + bmg.getID());
BenchmarkBean bmb = new BenchmarkBean(bmg);
bmb.setSourceValue(bmg.getSourceValue());
bmb.setTargetValue(bmg.getTargetValue());
bmb.setEvaluationValue(bmg.getEvaluationValue());
bmb.setWeight(String.valueOf(bmg.getWeight()));
bmb.setSelected(true);
experimentBenchmarks.put(bmg.getID(), bmb);
}
}catch (Exception e) {
log.error("Exception during attempt to create ExperimentBean for: "+e.toString());
if( log.isDebugEnabled() ) e.printStackTrace();
}
String intensity = Integer.toString(exp.getExperimentSetup().getExperimentResources().getIntensity());
if (intensity != null && intensity != "-1")
this.intensity = intensity;
// determine current Stage
ExperimentPhase currPhaseObj = exp.getCurrentPhase();
if (currPhaseObj != null) {
String currPhase = currPhaseObj.getPhaseName();
if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTSETUP)) {
this.currStage = exp.getExperimentSetup().getSubStage();
} else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTAPPROVAL)) {
this.currStage = ExperimentBean.PHASE_EXPERIMENTAPPROVAL;
} else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTEXECUTION)) {
this.currStage = ExperimentBean.PHASE_EXPERIMENTEXECUTION;
} else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTEVALUATION)) {
this.currStage = ExperimentBean.PHASE_EXPERIMENTEVALUATION;
} else if (currPhase.equals(ExperimentPhase.PHASENAME_EXPERIMENTFINALIZED)) {
this.currStage = ExperimentBean.PHASE_EXPERIMENTFINALIZED;
}
}
if(currStage>ExperimentBean.PHASE_EXPERIMENTSETUP_3) {
approved=true;
} else {
approved=false;
}
this.dtype = props.getDigiTypes();
// Set the report up:
this.ereportTitle = exp.getExperimentEvaluation().getExperimentReport().getHeader();
this.ereportBody = exp.getExperimentEvaluation().getExperimentReport().getBodyText();
this.evaluationData = exp.getExperimentEvaluation().getExternalEvaluationDocuments();