Package org.cipres.treebase.domain.study

Examples of org.cipres.treebase.domain.study.Analysis


    /*
     * retrieve list of anlysisSteps for an analysis
     */
    // TODO: check if value is null
    String analysis_id = ServletRequestUtils.getStringParameter(request, "id", null);
    Analysis analysis = mAnalysisService.findByID(Long.parseLong(analysis_id));
    List<AnalysisStep> steps = analysis.getAnalysisStepsReadOnly();
    // send selected analysis info to session
    ControllerUtil.saveAnalysis(request, analysis);
    /*
     * map AnalysisStep to AnalysisStepCommand so we can print the algorithm type and the order
     */
 
View Full Code Here


    StudyStatus inprogress = getStudyStatusHome().findStatusInProgress();

    Citation c = new ArticleCitation();
    c.setTitle(newName);

    Analysis a1 = new Analysis();
    a1.setName("1 " + newName);
    Analysis a2 = new Analysis();
    a2.setName("2 " + newName);

    Study s = new Study();
    s.setName(newName);
    s.setStudyStatus(inprogress);
    s.setCitation(c);
    c.setStudy(s);
    s.addAnalysis(a1);
    s.addAnalysis(a2);

    TaxonLabel label = new TaxonLabel();
    label.setTaxonLabel(newName);
    label.setStudy(s);

    getStudyHome().store(label);
    getStudyHome().store(s);

    // force commit immeidately, important:
    setComplete();
    endTransaction();

    onSetUp();

    // Notes: this is important: why?? there are two copies of s in the same session.
    // how???
    s = (Study) hibernateTemplate.merge(s);

    Long studyID = s.getId();
    Long citationID = c.getId();
    logger.info("study created: " + s.getName() + "id = " + studyID);
    logger.info("citation created: " + c.getTitle() + "id = " + citationID);
    logger.info("analysis created: " + a1.getName() + "id = " + a1.getId());
    logger.info("analysis created: " + a2.getName() + "id = " + a2.getId());
    logger.info("taxonLabel created: " + label.getTaxonLabel() + "id = " + label.getId());

    // 2. verify
    String sqlStr = "select count(*) from Study where study_id=" + s.getId();
    int count = jdbcTemplate.queryForInt(sqlStr);
View Full Code Here

    Long studyID = s.getId();
    Long citationID = c.getId();
    logger.info("study created: " + s.getName() + "id = " + studyID);
    logger.info("citation created: " + c.getTitle() + "id = " + citationID);

    Analysis a1 = new Analysis();
    a1.setName("1 " + newName);
    Analysis a2 = new Analysis();
    a2.setName("2 " + newName);

    // NOTES: this will fail to add analysis to studyu!!
    // s.addAnalysis(a1);
    // s.addAnalysis(a2);

    Analysis updatedA1 = getFixture().update(a1);
    Analysis updatedA2 = getFixture().update(a2);

    s.addAnalysis(updatedA1);
    s.addAnalysis(updatedA2);
    Study updatedS = getFixture().update(s);

    // Note: a1.getID() and a2.getID() will return false.
    logger.info("analysis created: " + a1.getName() + "id = " + updatedA1.getId());
    logger.info("analysis created: " + a2.getName() + "id = " + updatedA2.getId());

    // 2. verify
    String sqlStr = "select count(*) from Study where study_id=" + s.getId();
    int count = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(count == 1);

    // assertTrue("need to return Analysis ID.", a1.getId() != null);

    // 3. delete
    // Note: this one will fail: getFixture().deleteStudy(s);
    getFixture().deleteStudy(updatedS);
    setComplete();

    // 4. verify delete:
    int countVerify = jdbcTemplate.queryForInt(sqlStr);
    assertTrue("Deletion failed.", countVerify == 0);

    String sqlStrAnalysis = "select count(*) from analysis where analysis_id="
      + updatedA2.getId();
    count = jdbcTemplate.queryForInt(sqlStrAnalysis);
    assertTrue("cascade Delete analysis failed.", count == 0);

    if (logger.isInfoEnabled()) {
      logger.info(testName + " - end "); //$NON-NLS-1$
View Full Code Here

    s.setName(newName);
    s.setStudyStatus(inprogress);
    s.setCitation(c);
    c.setStudy(s);

    Analysis a1 = new Analysis();
    a1.setName("1 " + newName);
    Analysis a2 = new Analysis();
    a2.setName("2 " + newName);
    s.addAnalysis(a1);
    s.addAnalysis(a2);

    getStudyHome().store(s);

    // force commit immeidately, important:
    setComplete();
    endTransaction();

    Long studyID = s.getId();
    Long citationID = c.getId();
    Long a1ID = a1.getId();
    Long a2ID = a2.getId();

    logger.info("study created: " + s.getName() + "id = " + studyID);
    logger.info("citation created: " + c.getTitle() + "id = " + citationID);
    logger.info("2 analyses created: id= " + a1ID + ", " + a2ID);
View Full Code Here

        warn("  Couldn't find creation date");
      }
    }

    for (ValueAnalysisSection an : aux.getAnalysisSections()) {
      Analysis theAnalysis = new Analysis();
      theAnalysis.setStudy(theStudy);
      theAnalysis.setName(an.getString("analysis_name"));
     
      // TODO: TB_ANALYSISID

      AnalysisStep theAnalysisStep = new AnalysisStep();
      theAnalysisStep.setAnalysis(theAnalysis);
      theAnalysis.addAnalysisStep(theAnalysisStep);
      ContextManager.getAnalysisService().save(theAnalysis);
      ContextManager.getAnalysisStepService().save(theAnalysisStep);
     
      Algorithm theAlgorithm;
      String tb1Algorithm = an.getString("algorithm");
View Full Code Here

    if (pAnalysisStep == null) {
      return false;
    }

    // manage bi-directional relationships:
    Analysis analysis = pAnalysisStep.getAnalysis();
    if (analysis != null) {
      analysis.removeAnalysisStep(pAnalysisStep);
    }

    // Cascade delete:
    // * software
    // * algorithm:
 
View Full Code Here

    s.setName(newName);
    s.setStudyStatus(inprogress);
    s.setCitation(c);
    c.setStudy(s);

    Analysis a1 = new Analysis();
    a1.setName("1 " + newName);
    Analysis a2 = new Analysis();
    a2.setName("2 " + newName);
    s.addAnalysis(a1);
    s.addAnalysis(a2);

    getStudyHome().store(s);

    // force commit immediately, important:
    setComplete();
    endTransaction();

    Long studyID = s.getId();
    Long citationID = c.getId();
    Long a1ID = a1.getId();
    Long a2ID = a2.getId();

    logger.info("study created: " + s.getName() + "id = " + studyID);
    logger.info("citation created: " + c.getTitle() + "id = " + citationID);
    logger.info("2 analyses created: id= " + a1ID + ", " + a2ID);
    assertTrue("need to return Analysis ID.", a1.getId() != null && a2.getId() != null);

    // 2. verify
    String sqlStr = "select count(*) from analysis where study_id=" + s.getId();
    int count = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(count == 2);
View Full Code Here

    block.addPhyloTree(tree);
    block.addPhyloTree(tree2);

    // Create an analysis step and associate w/ tree.
    Study s = getTestStudy();
    Analysis a1 = new Analysis();
    a1.setName("1 " + newName);
    AnalysisStep step1 = new AnalysisStep();
    step1.setName("step1 " + newName);
    s.addAnalysis(a1);
    a1.addAnalysisStep(step1);

    AnalyzedTree treeData = new AnalyzedTree();
    treeData.setTree(tree);
    treeData.setInput(Boolean.FALSE);
    step1.addAnalyzedData(treeData);

    getFixture().store(tree);
    getFixture().store(tree2);
    getFixture().store(block);

    // force commit immediately, important:
    setComplete();
    endTransaction();
    logger.info("tree1 created: " + tree.getLabel() + "id = " + tree.getId());
    logger.info("tree2 created: " + tree2.getLabel() + "id = " + tree2.getId());
    logger.info("treeBlock created: " + block.getTitle() + "id = " + block.getId());
    logger.info("analysis step created: " + step1.getName() + "id = " + step1.getId()
      + " associated data count=" + step1.getDataSetReadOnly().size());
    // logger.info("treeBlock created: " + block.getTitle() + "id = " + block.getId());

    // 2. verify
    String treeSql = "select count(*) from phylotree where treeBlock_id=" + block.getId();
    String blockSql = "select count(*) from treeblock where treeBlock_id=" + block.getId();
    String analyzedDataSql = "select count(*) from analyzedData where analysisstep_id="
      + step1.getId();
    String a1Sql = "select count(*) from analysis where analysis_id=" + a1.getId();
    int count = jdbcTemplate.queryForInt(treeSql);
    assertTrue(count == 2);
    count = jdbcTemplate.queryForInt(blockSql);
    assertTrue(count == 1);
    count = jdbcTemplate.queryForInt(a1Sql);
    assertTrue(count == 1);
    count = jdbcTemplate.queryForInt(analyzedDataSql);
    assertTrue(count == 1);

    onSetUp();

    // 3. delete
    getFixture().refresh(block);
    getFixture().refresh(a1);
    getFixture().refreshAll(a1.getAnalysisStepsReadOnly());

    getFixture().deleteTreeBlock(block);
    setComplete();
    endTransaction();

    // 3.2: have to separate the deleting of analysis, due to
    // analysisstep -->analyzedData.
    onSetUp();
    // getFixture().refresh(a1);
    a1 = (Analysis) loadObject(Analysis.class, a1.getId());
    getAnalysisService().deleteAnalysis(a1);

    setComplete();
    endTransaction();

View Full Code Here

      return false;
    }

    // Need to make sure the object belongs to the current session:
    // Analysis currentAnalysis = update(pAnalysis);
    Analysis currentAnalysis = pAnalysis;

    // manage bi-directional relationships:
    Study study = currentAnalysis.getStudy();
    if (study != null) {
      study.removeAnalysis(currentAnalysis);
    }

    // Cascade delete:
    // * analysis step:
    getAnalysisStepService().deleteAnalysisSteps(currentAnalysis.getAnalysisStepsReadOnly());

    getAnalysisHome().deletePersist(currentAnalysis);

    return true;
  }
View Full Code Here

   *
   * @see org.cipres.treebase.domain.study.AnalysisService#getPermission(java.lang.String,
   *      java.lang.Long)
   */
  public TBPermission getPermission(String pUsername, Long pAnalysisId) {
    Analysis a = findByID(pAnalysisId);
    // Long submissionID = null;
    Submission sub = null;

    if (a != null) {
      sub = a.getStudy().getSubmission();
    }

    if (sub == null) {
      return TBPermission.NONE;
    }
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.study.Analysis

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.