Package org.cipres.treebase.domain.taxon

Examples of org.cipres.treebase.domain.taxon.Taxon


      } catch ( NumberFormatException e ) {
        LOGGER.info("NumberFormatException, user supplied taxon variant id was probably null: "+tvId);
      }
    }
    else {
      Taxon taxon = null;
      taxon = getTaxonHome().findByUBIOTaxId(manualId);
      if ( taxon != null ) {
        // 2a
        Collection<TaxonVariant> variants = getTaxonHome().findVariantsByTaxon(taxon);
        variant = variants.iterator().next();
      }
      else {
        // 2b
        TaxonLabelService taxonLabelService = getTaxonLabelService();
        Integer ncbiId = taxonLabelService.findNcbiTaxIdByUBIOTaxId(manualId)
        Taxon newTaxon = null;
        TaxonVariant newVariant = null;
        if ( null != ncbiId ) {
          String ncbiPreferredName = taxonLabelService.getNCBIPreferredName(ncbiId.toString());
          newTaxon = new Taxon(ncbiPreferredName,manualId,ncbiId);
          newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),ncbiPreferredName,"canonical form");         
        }       
        else {
          newTaxon = new Taxon();
          newTaxon.setName(taxonLabel.getTaxonLabel());
          newTaxon.setUBioNamebankId(manualId);         
          newVariant = new TaxonVariant(manualId,taxonLabel.getTaxonLabel(),taxonLabel.getTaxonLabel(),"canonical form");
        }
        newVariant.setTaxon(newTaxon);
        getTaxonHome().store(newTaxon);
        getTaxonHome().store(newVariant);
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.taxon.Taxon

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.