Package org.cipres.treebase.domain.study

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


  /**
   *
   * @see org.cipres.treebase.domain.study.SubmissionService#updateStudyStatusInProgress(java.lang.Long)
   */
  public void updateStudyStatusInProgress(Long pSubmissionID) {
    Submission sub = findSubmissionByID(pSubmissionID);
    if (sub == null) {
      // 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);
    }
View Full Code Here


  /**
   *
   * @see org.cipres.treebase.domain.study.SubmissionService#updateStudyStatusReady(java.lang.Long)
   */
  public void updateStudyStatusReady(Long pSubmissionID) {
    Submission sub = findSubmissionByID(pSubmissionID);
    if (sub == null) {
      // show err
      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);
View Full Code Here

  /**
   *
   * @see org.cipres.treebase.domain.study.SubmissionService#deleteSubmission(java.lang.Long)
   */
  public boolean deleteSubmission(Long pSubId) {
    Submission sub = findSubmissionByID(pSubId);

    return deleteSubmission(sub);
  }
View Full Code Here

    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

  /**
   *
   * @see org.cipres.treebase.domain.study.StudyService#findBySubmissionNumber(java.lang.String)
   */
  public Study findBySubmissionNumber(String pSubmissionNumber) {
    Submission sub = getSubmissionHome().findBySubmissionNumber(pSubmissionNumber);
    if (sub != null) {
      return sub.getStudy();
    }
    return null;
  }
View Full Code Here

  /**
   *
   * @see org.cipres.treebase.domain.study.StudyService#findBySubmissionID(java.lang.Long)
   */
  public Study findBySubmissionID(Long pSubmissionID) {
    Submission sub = getSubmissionHome().findPersistedObjectByID(
      Submission.class,
      pSubmissionID);

    if (sub != null) {
      return sub.getStudy();
    }
    return null;
  }
View Full Code Here

    }
   
    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!");
              } else if (! tbs.contains(tb)) {
                Submission oldSub = sh.findByTreeBlock(tb);
                if (oldSub != null) {
                  oldSub.removePhyloTreeBlock(tb);
                  sh.flush();
                }
                sub.addPhyloTreeBlock(tb);
              }
            }
View Full Code Here

    // getAnalysisService().deleteAnalyses(pStudy.getAnalyses());

    // FIXME getAnalysisService().deleteAnalyses(pStudy.getAnalysesReadOnly());

    Submission sub = pStudy.getSubmission();
    if (sub != null) {

      // Important: to avoid looping:
      sub.setStudy(null);

      // delete submission, with matrices, trees, and taxonlabels.
      getSubmissionHome().deletePersist(sub);

      pStudy.setSubmission(null);
View Full Code Here

  public void cascadeDelete(CharacterMatrix pMatrix) {
   
    // bi-directional relationships:
    // * delete submission-> matrix
    // * delete analyzedData -> matrix
    Submission sub = getSubmissionHome().findByMatrix(pMatrix);
    if (sub != null) {
      sub.removeMatrix(pMatrix);
    }

    Collection<AnalyzedData> dataLink = getAnalyzedDataHome().findByMatrix(pMatrix);
    for (AnalyzedData data : dataLink) {
      data.getAnalysisStep().removeAnalyzedData(data);
View Full Code Here

   *      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;
    }
    User user = getUserHome().findByUserName(pUsername);

    return sub.getPermission(user);
  }
View Full Code Here

TOP

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

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.