Package org.cipres.treebase.domain.study

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


    }

    // better to refresh:
    Submission sub = update(pSubmission);

    Study study = sub.getStudy();

    NexusDataSet data = getNexusService().parseNexus(study, pNexusFiles, pListener);
    NexusDataSetJDBC dataJDBC = null;

    if (data != null) {
View Full Code Here


      throw new IllegalArgumentException(
        "Failed to request publishing a study. The submission is not found:"
          + pSubmissionID);
    }

    Study study = sub.getStudy();

    if (study == null) {
      throw new IllegalArgumentException(
        "Failed to request publishing a study. The study is not found for submission id:"
          + pSubmissionID);
    }

    if (study.isInProgress()) {
      // show err
      throw new IllegalArgumentException(
        "Failed to publish a study. study is not ready for publishing for submission id:"
          + pSubmissionID);
    }

    if (study.isReady()) {
      StudyStatus status = getStudyStatusHome().findStatusPublished();
      study.setStudyStatus(status);
      Date today = new Date();
      study.setReleaseDate(today);
      study.setLastModifiedDate(today);
    }

    updatePublishedFlag(study, true);
  }
View Full Code Here

      // show err
      throw new IllegalArgumentException(
        "Failed to make a study in progress. The submission is not found:" + pSubmissionID);
    }

    Study study = sub.getStudy();
    if (study == null) {
      throw new IllegalArgumentException(
        "Failed to make a study in progress. The study is not found for submission id:"
          + pSubmissionID);
    }

    if (!study.isInProgress()) {
      StudyStatus status = getStudyStatusHome().findStatusInProgress();
      study.setStudyStatus(status);
      study.setLastModifiedDate(new Date());
     
      updatePublishedFlag(study, false);
    }
  }
View Full Code Here

      Long id = Long.parseLong(arg);
      PhyloTree t = ContextManager.getPhyloTreeService().findByID(id);
      if (t == null) {
        System.err.println(id + ": no tree found");
      } else {
        Study s = t.getStudy();
        if (s == null) {
          System.err.println(id + ": no study");
        } else {
          tlService.updateStudyForAllLabels(t, s);
          System.err.println(id + ": done");
View Full Code Here

      throw new IllegalArgumentException(
        "Failed to request making a study ready. The submission is not found:"
          + pSubmissionID);
    }

    Study study = sub.getStudy();

    if (study == null) {
      throw new IllegalArgumentException(
        "Failed to request making a study ready. The study is not found for submission id:"
          + pSubmissionID);
    }

    if (!study.isReady()) {
      StudyStatus readyStatus = getStudyStatusHome().findStatusReady();
      study.setStudyStatus(readyStatus);
      study.setLastModifiedDate(new Date());
    }

  }
View Full Code Here

        pseudoSubmission = ss.createSubmission(null, null);
        pseudoSubmission.getStudy().setName(name);
        ss.save(pseudoSubmission.getStudy());
        sh.flush();
      } else if (pseudoStudies.size() == 1) {
        Study pseudoStudy = pseudoStudies.iterator().next();
        pseudoSubmission = pseudoStudy.getSubmission();
      } else {
        return null;
      }
    }
    return pseudoSubmission;
View Full Code Here

  public static void main(String[] args) {
    DeleteStudy ds = new DeleteStudy();
    ds.setupContext();
    for (String argStr : args) {
      Long studyID = Long.parseLong(argStr);
      Study s = ContextManager.getStudyService().findByID(studyID);
      if (s == null) continue;
     
      Submission sub = s.getSubmission();
      Boolean destroyed = false;
     
      if (sub != null) {
        Transaction t = ds.beginTransaction();
        try {
View Full Code Here

    if (args.length > 0) {
      minStudyId = Long.parseLong(args[0]);
    }
   
    for (TBPersistable tbS : ContextManager.getStudyHome().findAll(Study.class)) {
      Study s = (Study) tbS;
      if (s.getId() < minStudyId) { continue; }
      Submission sub = s.getSubmission();
      Collection<TreeBlock> tbs = sub.getSubmittedTreeBlocksReadOnly();
      Collection<Matrix> ms = sub.getSubmittedMatricesReadOnly();
      System.err.println("Study " + s.getId() + ": ");
      for (Analysis an : s.getAnalyses()) {
        for (AnalysisStep as : an.getAnalysisStepsReadOnly()) {
          Transaction tr = null;

          for (AnalyzedData ad : as.getDataSetReadOnly()) {
            if (tr == null) {
              tr = rt.beginTransaction();
            }
            Matrix m = ad.getMatrixData();
            PhyloTree t = ad.getTreeData();
            if (m != null) {
              System.err.println("  Repatriating matrix " + m.getId()
                  + " to study " + s.getId() + " submission " + sub.getId());
             
              if (m.getStudy() != s) {
                String nexusFileName = m.getNexusFileName();
                Map<String,String> nexusMap = m.getStudy().getNexusFiles();
                String nexusFile = nexusMap.remove(nexusFileName);
                s.getNexusFiles().put(nexusFileName, nexusFile);
                m.setStudy(s);
              }
             
              if (! ms.contains(m)) {
                Submission oldSub = sh.findByMatrix(m);
                if (oldSub != null) {
                  oldSub.removeMatrix(m);
                  sh.flush();
                }
                sub.addMatrix(m);
              }
            } else if (t != null) {
              System.err.println("  Repatriating tree " + t.getId()
                  + " to study " + s.getId() + " submission " + sub.getId());
              if (t.getStudy() != s) {
                String nexusFileName = t.getNexusFileName();
                Map<String,String> nexusMap = t.getStudy().getNexusFiles();
                String nexusFile = nexusMap.remove(nexusFileName);
                s.getNexusFiles().put(nexusFileName, nexusFile);
                t.setStudy(s);
              }
              TreeBlock tb = t.getTreeBlock();
              if (tb == null) {
                System.err.println("  No tree block!");
View Full Code Here

    return true;
  }

  public boolean deleteStudy(Long studyID) {
    Study s = findByID(studyID);
    if (s == null) return false;
    else return deleteStudy(s);
  }
View Full Code Here

    if (pStudy == null || pNexusFiles == null || pNexusFiles.isEmpty()) {
      return;
    }

    // better to refresh:
    Study s = update(pStudy);

    Iterator<File> fileIter = pNexusFiles.iterator();
    while (fileIter.hasNext()) {
      File element = (File) fileIter.next();
      String fileName = element.getName();                                 
      s.addNexusFile(fileName, TreebaseUtil.readFileToString(element));
    }
  }
View Full Code Here

TOP

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

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.