Examples of ExperimentImpl


Examples of eu.planets_project.tb.impl.model.ExperimentImpl

            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

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

     */
    public static ExperimentImpl deepCopy( ExperimentImpl exp ) {
        try {
            File temp = File.createTempFile("tb-experiment", ".xml");
            ExperimentViaJAXB.writeToFile(exp, temp);
            ExperimentImpl exp2 = ExperimentViaJAXB.readFromFile(temp);
            temp.delete();
            return exp2;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

     */
    private static ExperimentImpl readFromInputStream( InputStream in ) {
        try {
            JAXBContext jc = JAXBContext.newInstance( PACKAGE_CONTEXT );
            Unmarshaller u = jc.createUnmarshaller();
            ExperimentImpl exp = (ExperimentImpl) u.unmarshal( in );
            return exp;
        } catch (JAXBException e) {
            log.fatal("Reading Experiment from XML failed: "+e);
            return null;
        }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

     * @param uploaded The File containing the experiment XML.
     * @return the ID of the new experiment.
     */
    private static long storeNewExperiment(File uploaded) {
        log.info("Importing experiment from file: "+uploaded.getPath());
        ExperimentImpl exp = ExperimentViaJAXB.readFromFile(uploaded);
        log.info("Parsed into Experiment: "+exp.getExperimentSetup().getBasicProperties().getExperimentName());
        return storeExperiment(exp);
    }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

        Experiment exp = expBean.getExperiment();
        // if not yet created, create new Experiment object and new Bean
        if ((expBean.getID() <= 0)) {
            // Create new Experiment if necessary
            if( exp == null )
                exp = new ExperimentImpl();
            // Get userid info from managed bean
            UserBean currentUser = (UserBean) JSFUtil.getManagedObject("UserBean");
            // set current User as experimenter
            exp.getExperimentSetup().getBasicProperties().setExperimenter(currentUser.getUserid());
            try {
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.TestbedManager#createNewExperiment()
   */
  public Experiment createNewExperiment() {
    ExperimentImpl exp = new ExperimentImpl();
    //Should this be added in a transaction?
    long lExpID = edao.persistExperiment(exp);
   
    //should now already contain a container injected EntityID;
    exp = (ExperimentImpl)edao.findExperiment(lExpID);
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

      //it's not possible to register a previously registered experiment
      //as the container cannot inject a valid ID
      return -1;
    }else{
      long lExpID = edao.persistExperiment(experimentBean);
      ExperimentImpl exp = (ExperimentImpl)edao.findExperiment(lExpID);
     
      //now register experimentRefID in Phases
      this.setExperimentRefInPhase(exp);
     
      //finally return the entityID
      return exp.getEntityID();
    }
     //End Transaction
  }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

  public void updateExperiment(Experiment experiment) {
      log.debug("Updating experiment "+experiment+" using dao "+edao);
    if( edao.findExperiment(experiment.getEntityID()) != null ){
      //Should this be added in a transaction?
        edao.updateExperiment(experiment);
      ExperimentImpl exp = (ExperimentImpl)edao.findExperiment(experiment.getEntityID());
        // Also update the Experiment backing beans to reflect the changes:
          ExperimentInspector ei = (ExperimentInspector)JSFUtil.getManagedObject("ExperimentInspector");
          ei.setExperimentId(""+exp.getEntityID());
         
          //End Transaction
    } else {
        log.error("updateExperiment Failed: No Entity ID for experiment: "+experiment.getExperimentSetup().getBasicProperties().getExperimentName());
    }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

  public void testExperimentNameUnique(){
    TestbedManager manager = TestbedManagerImpl.getInstance();
   
    BasicProperties props = new BasicPropertiesImpl();
    ExperimentSetup expSetup = new ExperimentSetupImpl();
    Experiment exp1 = new ExperimentImpl();
   
  //Test1:
    long expID = manager.registerExperiment(exp1);
    exp1 = manager.getExperiment(expID);

    String sTestname= "TestName12334234445";
    boolean bUnique = manager.isExperimentNameUnique(sTestname);
    //check if the two methods deliver the same results
    assertEquals(bUnique, props.checkExperimentNameUnique(sTestname));
   
    try {
      props.setExperimentName(sTestname);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
    assertEquals(sTestname,props.getExperimentName());
    expSetup.setBasicProperties(props);
    exp1.setExperimentSetup(expSetup);
    manager.updateExperiment(exp1);
   
    assertEquals(false, props.checkExperimentNameUnique(sTestname));
    assertEquals(false, manager.isExperimentNameUnique(sTestname));
   
  //Test2:
    try {
      //although experimentname already exists, if the name stays the same no exception should be thrown
      props.setExperimentName(sTestname);
      assertEquals(true,true);
    } catch (InvalidInputException e) {
      assertEquals(true,false);
    }
   
    //clean up the mess
    manager.removeExperiment(exp1.getEntityID());
  }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.ExperimentImpl

      assertEquals(true,false);
    }
   
    //Test4:
    try {
      props.setExperimentStructureReference(new ExperimentImpl());
      assertEquals(true,false);
    } catch (InvalidInputException e) {
      assertEquals(true,true);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.