Package eu.planets_project.tb.gui.backing

Examples of eu.planets_project.tb.gui.backing.ExperimentBean


                log.error("Could not parse experiment id "+experimentId);
            }
        }
       
        // Check if there is an experiment bean already, and persist changes.
        ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
        if( expBean != null ) {
            log.info("Experiment Bean found: "+expBean.getEname());
        }
       
        // Load it:
        ExperimentPersistencyRemote edao = ExperimentPersistencyImpl.getInstance();
        if( edao != null && eid != null ) {
            exp = edao.findExperiment(eid);
        }

        // Also look for an experiment bean in the session:
        FacesContext ctx = FacesContext.getCurrentInstance();
        ExperimentBean sessExpBean = (ExperimentBean) ctx.getExternalContext().getSessionMap().get(ExperimentInspector.EXP_BEAN_IN_SESSION_DEPRECATED);
       
        // Experiment exp should work:
        if( exp != null ) {
            log.info("Experiment found: "+exp.getExperimentSetup().getBasicProperties().getExperimentName());
            experimentBean = new ExperimentBean();
            experimentBean.fill(exp);
            ExperimentInspector.putExperimentIntoRequestExperimentBean(exp);
        }
        // If not, use the one in the session:
        else if( sessExpBean != null ) {
            log.info("Experiment found in session: "+sessExpBean.getEname());
            if( sessExpBean.getExperiment() != null ) {
                this.experimentId = ""+sessExpBean.getExperiment().getEntityID();
            }
            this.experimentBean = sessExpBean;
            ctx.getExternalContext().getRequestMap().put(ExperimentInspector.EXP_BEAN_IN_REQUEST, sessExpBean);
        }
        // Otherwise, treat as a new experiment:
        else {
            log.info("No experiment found: make a new one.");
            exp = new ExperimentImpl();
            this.experimentId = null;
            experimentBean = new ExperimentBean();
            experimentBean.fill(exp);
            ExperimentInspector.putExperimentIntoRequestExperimentBean(exp);
        }

    }
View Full Code Here


    /**
     * Persist any changes
     */
    public static void persistExperiment() {
        ExperimentInspector ei = (ExperimentInspector)JSFUtil.getManagedObject("ExperimentInspector");
        ExperimentBean expBean = ei.getExperimentBean();
        if(expBean != null ) expBean.updateExperiment();
        new Exception("Who is the caller?").printStackTrace();
    }
View Full Code Here

    /**
     * @param exp
     * @return
     */
    public static ExperimentBean putExperimentIntoSessionExperimentBean( Experiment exp ) {
        ExperimentBean expBean = new ExperimentBean();
        if( exp != null ){
          expBean.fill(exp);
        }
        else{
          //in this case we're having a request for a new experiment
          resetExpTypeBeanForExperimentInSession();
        }
        //Store selected Experiment Row accessible later as #{Experiment}
        FacesContext ctx = FacesContext.getCurrentInstance();
        ctx.getExternalContext().getSessionMap().put(EXP_BEAN_IN_SESSION_DEPRECATED, expBean);
        // This overrides the experimental behaviour and returns to the default logic.
        ctx.getExternalContext().getSessionMap().put(EXP_BEAN_IN_REQUEST, expBean);
        updateExpTypeBeanForExperimentInSession(expBean.getEtype());
        return expBean;
    }
View Full Code Here

    /**
     * @param exp
     * @return
     */
    public static ExperimentBean putExperimentIntoRequestExperimentBean( Experiment exp ) {
        ExperimentBean expBean = new ExperimentBean();
        if( exp != null ) expBean.fill(exp);
        //Store selected Experiment Row accessible later as #{ExperimentBean}
        FacesContext ctx = FacesContext.getCurrentInstance();
        ctx.getExternalContext().getRequestMap().put(EXP_BEAN_IN_REQUEST, expBean);
        //finally update the experiment-type specific bean for this expBean
        updateExpTypeBeanForExperimentInSession(expBean.getEtype());
        return expBean;
    }
View Full Code Here

        log.info("Got class: "+tmpRowData.getClass().getCanonicalName());
       
        if (tmpRowData instanceof ResultsForDigitalObjectBean ) {
          targetBean = (ResultsForDigitalObjectBean) tmpRowData;

          ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
          expBean.setSelectedDigitalObject( targetBean.getDigitalObject() );
         
        }
       
      }
View Full Code Here

     */
    public void deleteMeasurementEvent() {
        log.info("Deleting MeasurementEvent "+this.getId());
        TestbedManagerImpl tbm = (TestbedManagerImpl) JSFUtil.getManagedObject("TestbedManager");
        // Now update experiment.
        ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
        BatchExecutionRecordImpl batch = expBean.getExperiment().getExperimentExecutable().getBatchExecutionRecords().iterator().next();
        ExecutionRecordImpl run = batch.getRuns().iterator().next();
       
        // Remove the Event itself:
        ExperimentPersistencyRemote db = tbm.getExperimentPersistencyRemote();
        setTargetInvocation(null);
View Full Code Here

        String sInExperimentStage = null;
        if(o1!=null){
        sInExperimentStage = (String)o1;
        }

          ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
          if((sInExperimentStage==null)||(sInExperimentStage.equals("design experiment"))){
            expBean.removeExperimentInputData(targetBean.get("inputID"));
            log.info("Removed: "+targetBean.get("inputID")+"in design experiment stage");
          }
          if((sInExperimentStage!=null)&&(sInExperimentStage.equals("evaluate experiment"))){
            expBean.removeEvaluationExternalDigoRef(targetBean.get("inputID"));
            log.info("Removed: "+targetBean.get("inputID")+"in evaluate experiment stage");
          }
        }
      }
View Full Code Here

    public ResultsForDigitalObjectBean( String input ) {
      super(input);
    }
   
    private BatchExecutionRecordImpl getBatch(){
        ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
        Set<BatchExecutionRecordImpl> batchExecutionRecords = expBean.getExperiment().getExperimentExecutable().getBatchExecutionRecords();
        if( batchExecutionRecords != null && batchExecutionRecords.size() > 0 )
            return batchExecutionRecords.iterator().next();
        return null;
    }
View Full Code Here

    /**
     * returns the ExecutionRecords for a given input digital object reference
     * @return the executionRecords
     */
    public List<ExecutionRecordImpl> getExecutionRecords() {
        ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
        List<ExecutionRecordImpl> executionRecords = new ArrayList<ExecutionRecordImpl>();
        // Loop over results and patch them in:
        if( this.getBatch() != null  && this.getBatch().getRuns() != null ) {
            for( ExecutionRecordImpl run : this.getBatch().getRuns() ) {
                if( this.getDigitalObject().equals( run.getDigitalObjectReferenceCopy() ) ) {
View Full Code Here

     * HashMap<StageName,List<MeasurementsBeans>>
     * @return
     */
    public HashMap<ExperimentStageBean,List<MeasurementBean>> getManualObservablesPerStage(){
      HashMap<ExperimentStageBean,List<MeasurementBean>> ret = new HashMap<ExperimentStageBean, List<MeasurementBean>>();
      ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
      for(ExperimentStageBean stage : expBean.getStages()){
         ret.put(stage,getObservablesForEtype(expBean.getEtype(), expBean.getExperiment(), stage.getName(), true));
      }
      return ret;
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.gui.backing.ExperimentBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.