ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
log.info("ExpBean: "+expBean.getEname()+" : "+expBean.getEsummary());
// Get the Experiment description objects
Experiment exp = expBean.getExperiment();
BasicProperties props = exp.getExperimentSetup().getBasicProperties();
log.info("Setting the experimental properties, "+props.getExperimentName()+" : "+props.getSummary());
// If the experiment already existed, check for valid name changes:
try {
props.setExperimentName(expBean.getEname());
} catch (InvalidInputException e1) {
e1.printStackTrace();
}
//set the experiment information
props.setSummary(expBean.getEsummary());
props.setConsiderations(expBean.getEconsiderations());
props.setPurpose(expBean.getEpurpose());
props.setFocus(expBean.getEfocus());
props.setScope(expBean.getEscope());
props.setContact(expBean.getEcontactname(),expBean.getEcontactemail(),expBean.getEcontacttel(),expBean.getEcontactaddress());
props.setExperimentFormal(expBean.getFormality());
log.info("Set the experimental properties, "+props.getExperimentName()+" : "+props.getSummary());
String partpnts = expBean.getEparticipants();
String[] partpntlist = partpnts.split(",");
for(int i=0;i<partpntlist.length;i++){
partpntlist[i] = partpntlist[i].trim();
if( partpntlist[i] != "" ) {
props.addInvolvedUser(partpntlist[i]);
}
}
props.setExternalReferenceID(expBean.getExid());
ArrayList<String> litRefDesc = expBean.getLitRefDesc();
ArrayList<String> litRefURI = expBean.getLitRefURI();
ArrayList<String> litRefTitle = expBean.getLitRefTitle();
ArrayList<String> litRefAuthor = expBean.getLitRefAuthor();
if (litRefDesc != null && !litRefDesc.equals("")) {
for( int i = 0; i < litRefDesc.size(); i++ ) {
if( ! "".equals(litRefDesc.get(i).trim()) &&
! "".equals(litRefURI.get(i).trim()) )//author etc. can be empty
props.addLiteratureReference( litRefDesc.get(i).trim(),
litRefURI.get(i).trim(), litRefTitle.get(i).trim(), litRefAuthor.get(i).trim() );
}
}
List<Long> refs = new ArrayList<Long>();
if (expBean.getEref() != null && !expBean.getEref().equals("")) {
for( int i = 0; i < expBean.getEref().size(); i++)
refs.add(Long.parseLong( (expBean.getEref().get(i)) ));
}
props.setExperimentReferences(refs);
/*
props.setDigiTypes(expBean.getDtype());
log.debug("Checking the experiment type.");
// Set the experiment type:
try {
//check if the experiment type has changed. If yes we need to remove the already chosen
log.info("Current type: '"+exp.getExperimentSetup().getExperimentTypeID()+"' versus '"+expBean.getEtype()+"'.");
//selection from step2, to properly reload all available serivces + operations
if(!exp.getExperimentSetup().getExperimentTypeID().equals(expBean.getEtype())){
//exp. type was reselected - remove all chosen template information
expBean.removeSelectedServiceTemplate();
//set step2 to substep1
changeAlreadySelectedSerOps();
}
// This is what throws the error:
exp.getExperimentSetup().setExperimentType(expBean.getEtype());
} catch (InvalidInputException e) {
FacesContext ctx = FacesContext.getCurrentInstance();
FacesMessage tfmsg = new FacesMessage();
tfmsg.setSummary("No experiment type specified!");
tfmsg.setDetail("You must select an experiment type.");
tfmsg.setSeverity(FacesMessage.SEVERITY_ERROR);
ctx.addMessage("etype",tfmsg);
validForm = false;
log.error("Got error on Etype: "+e);
}
*/
// Exit with failure condition if no valid experiment could be constructed.
if( ! validForm && ! validExperiment ) {
log.debug("Exiting with failure.");
return "failure";
}
// Exit with failure condition if the form submission was not valid.
exp.getExperimentSetup().setState(Experiment.STATE_IN_PROGRESS);
exp.getExperimentSetup().setSubStage(1);
//testbedMan.updateExperiment(exp);
if( validForm ) {
exp.getExperimentSetup().setSubStage(2);
expBean.setCurrentStage(ExperimentBean.PHASE_EXPERIMENTSETUP_2);
log.debug("Exiting in success.");
return "success";
} else {
log.debug("Exiting in failure - invalid form.");