Package org.cipres.treebase.domain.study

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


    private Map getRecordMap(Submission submission){
     
      Map map= new HashMap();
     
      Study study=submission.getStudy();
      Citation citation=study.getCitation();
      String publisher=null;
      if(!study.isPublished())return null;
     
      //System.out.println("ctype: "+citation.getCitationType());
      try{
      if(citation.getCitationType().toUpperCase().contains("BOOK"))
           publisher=((BookCitation)citation).getPublisher();
      else publisher=((ArticleCitation)citation).getJournal();
     
     
      List<Person> authors=citation.getAuthors();
      
   
      map.put("title", citation.getTitle());
      map.put("creator", authors);     
      map.put("subject", citation.getKeywords());
        if(study.getName()!=null&study.getNotes()!=null)     
          map.put("description", study.getName()+" "+study.getNotes());
        else if(study.getNotes()==null)
          map.put("description",study.getName());
        else
          map.put("description",study.getNotes());
      map.put("publisher", publisher);           
      map.put("date", citation.getPublishYear());
      map.put("identifier", "TreeBASE.org/study/TB2:s"+study.getId());
      map.put("datestamp", study.getReleaseDate());
     
      }catch(NullPointerException e){
        //study 253 citation= null, data should be fixed
View Full Code Here


      .append(
        "[!This data set was downloaded from TreeBASE, a relational database of phylogenetic knowledge. TreeBASE has been supported by the NSF, Harvard University, Yale University, SDSC and UC Davis. Please do not remove this acknowledgment from the Nexus file.\n\n\nGenerated on "
          + getTimeAndDateAtGMT()).append(TreebaseUtil.LINESEP).append(
        "\nTreeBASE (cc) 1994-2008").append(TreebaseUtil.LINESEP);

    Citation cit = pStudy.getCitation();
    pBuilder.append(TreebaseUtil.LINESEP).append("Study reference:").append(
      TreebaseUtil.LINESEP);

    if (cit != null) {
      String citationString = cit.getAuthorsCitationStyleWithoutHtml();

      int citationLength = citationString.length();
      int splitPoint = 80;

      if (citationLength > splitPoint) {
View Full Code Here

    // 1. create a new study:
    String newName = testName + " test " + Math.random();
    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
View Full Code Here

    // 1. create a new study:
    String newName = testName + " test " + Math.random();
    StudyStatus inprogress = getStudyStatusHome().findStatusInProgress();

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

    Study s = new Study();
    s.setName(newName);
    s.setStudyStatus(inprogress);
    s.setCitation(c);
    c.setStudy(s);
    getStudyHome().store(s);

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

    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);
View Full Code Here

    // 1. create a new study:
    String newName = testName + " test " + Math.random();
    StudyStatus inprogress = getStudyStatusHome().findStatusInProgress();

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

    Study s = new Study();
    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);

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

    ContextManager.getStudyService().save(theStudy);
   
    Submission theSubmission = theStudy.getSubmission();
    ContextManager.getSubmissionService().save(theSubmission);

    Citation theCitation = theStudy.getCitation();
    if (theCitation == null) {
      theCitation = ContextManager.getCitationService().createCitation("TB1");
      theCitation.setStudy(theStudy);
      theStudy.setCitation(theCitation);
      ContextManager.getStudyService().save(theStudy);
    }
   
    { // Truncate extremely long abstracts
      String theAbstract = aux.getString(null, "abstract");
      if (theAbstract.length() > citationMaxLength - 4) {
        theAbstract = theAbstract.substring(0, citationMaxLength - 4) + "...";
      }
      theCitation.setAbstract(theAbstract);
    }
    // this next isn't quite right, because TB1 "citation" contains title, author, publisher, etc.
    // nothing to be done here, I think.  20080229 MJD
    // We can postprocess the citation data with Perl or something
    // to break it up into its component parts. 20080605 MJD
    // Piel says that Rod Page already did this. 20080702 MJD

    // Rutger has a program in util.CitationDataImporter that should do it 20090220 MJD
    {
      String citation = aux.getString(null, "citation");
      if (citation.length() > 250) {
        // It won't all fit into the "title" field of the database
        citation = citation.substring(0, 250); // XXX
      }
      theCitation.setTitle(citation); // XXX
   
    ContextManager.getCitationService().save(theCitation);
 
    // Create or link authors
    for (ValueSection a : aux.getSections("AUTHOR")) {
      Person theAuthor = new Person();
      theAuthor.setFirstName(a.getsval("first_name"));
      theAuthor.setLastName(a.getsval("last_name"));
      theAuthor.setMiddleName("");
//      ContextManager.getPersonService().save(theAuthor);
      // TB1 "author_id" ??
      Person oldAuthor = ContextManager.getPersonService().findByExactMatch(theAuthor);
      if (oldAuthor != null) {
        theAuthor = oldAuthor;
      } else {
        ContextManager.getPersonService().createPerson(theAuthor);
        theAuthor = ContextManager.getPersonService().findByExactMatch(theAuthor);
      }

      String oldEmail = theAuthor.getEmailAddressString();
      if (oldEmail == null || oldEmail.equals("")) {
        theAuthor.setEmailAddressString(a.getsval("email"));
     

      ContextManager.getPersonService().save(theAuthor);
      theCitation.addAuthor(theAuthor);
    }
    ContextManager.getCitationHome().flush();
    ContextManager.getCitationService().save(theCitation);

    // TODO: submission.setSubmitter
View Full Code Here

      out.println("Processing study " + studyId);
    }
   
    Transaction t = session.beginTransaction();
   
    Citation cit = s.getCitation();
    cit.setAuthors(new ArrayList<Person>());
    ContextManager.getCitationHome().flush();
   
    for (ValueSection authorSection : aux.getSections("AUTHOR")) {
      Person theAuthor = new Person();
      theAuthor.setFirstName(authorSection.getsval("first_name"));
      theAuthor.setLastName(authorSection.getsval("last_name"));
      Person oldAuthor = ContextManager.getPersonService().findByExactMatch(theAuthor);
      if (oldAuthor == null) {
        out.println("Can't find person " + theAuthor.getFullName() + "; skipping");
        t.rollback();
        return new ValueNone();
      }
      out.println("  Adding author " + oldAuthor.getFullName() + "(" + oldAuthor.getId() + ")");
      cit.addAuthor(oldAuthor);
    }
    t.commit();
    return v;
  }
View Full Code Here

      // have to after delete all taxonLabel sets:
      getDomainHome().flush();
      getTaxonLabelHome().deleteByStudy(s);

      Citation c = s.getCitation();

      getStudyHome().deletePersist(s);

      // Notes: must delete study first before delete the citation, not-null constraint!
      if (c != null) {
View Full Code Here

   *
   * @param pStudy
   * @param pPublished
   */
  private void updatePublishedFlag(Study pStudy, boolean pPublished) {
    Citation citation = pStudy.getCitation();
    // study might not yet have a citation associated with it.
    if ( citation != null ) {
      citation.setPublished(pPublished);
    }
    getPhyloTreeHome().updatePublishedFlagByStudy(pStudy, pPublished);
    getMatrixHome().updatePublishedFlagByStudy(pStudy, pPublished);
  }
View Full Code Here

    // 1. create a new study:
    String newName = testName + " test " + Math.random();
    StudyStatus inprogress = getStudyStatusHome().findStatusInProgress();

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

    Study s = new Study();
    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();
View Full Code Here

TOP

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

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.