@Test public void testCreateEnrichments() { VernacularName name = new VernacularName(); name.setName("testVernecularName"); name.setLanguage("English"); List<VernacularName> vernacularNames = new ArrayList<>(); vernacularNames.add(name); ScientificName scientificName = new ScientificName(); scientificName.setFullScientificName("Bombus affinis Cresson, 1863"); scientificName.setScientificNameGroup("bombus affinis"); scientificName.setAuthorshipVerbatim("Cresson, 1863"); scientificName.setGenusOrMonomial("Larus"); scientificName.setSpecificEpithet("affinis"); scientificName.setInfraspecificEpithet(""); scientificName.setTaxonomicStatus(TaxonomicStatus.ACCEPTED_NAME); List<ScientificName> synomyms = new ArrayList<>(); synomyms.add(scientificName); SourceSystem sourceSystem = SourceSystem.getInstance("COL", "Species 2000 - Catalogue Of Life"); Taxon taxon = new Taxon(); taxon.setVernacularNames(vernacularNames); taxon.setSynonyms(synomyms); taxon.setSourceSystem(sourceSystem); taxon.setId("6931870@COL"); List<Taxon> taxonList = new ArrayList<>(); taxonList.add(taxon); List<TaxonomicEnrichment> result = EnrichmentUtil.createEnrichments(taxonList); TaxonomicEnrichment actual = result.get(0); assertNotNull("01", actual); assertEquals("02", "COL", actual.getSourceSystem().getCode()); assertEquals("03", "6931870@COL", actual.getTaxonId()); assertEquals("04", "English", actual.getVernacularNames().get(0).getLanguage()); assertEquals("05", "testVernecularName", actual.getVernacularNames().get(0).getName()); assertEquals("06", "Bombus affinis Cresson, 1863", actual.getSynonyms().get(0).getFullScientificName()); assertEquals("07", "Larus", actual.getSynonyms().get(0).getGenusOrMonomial()); assertEquals("08", "affinis", actual.getSynonyms().get(0).getSpecificEpithet()); assertEquals("09", "accepted name", actual.getSynonyms().get(0).getTaxonomicStatus().toString()); }
public static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa) { List<TaxonomicEnrichment> enrichments = new ArrayList<>(taxa.size()); for (Taxon taxon : taxa) { if (taxon.getVernacularNames() == null && taxon.getSynonyms() == null && taxon.getDefaultClassification() == null) { continue; } if (taxon.getSourceSystem() != SourceSystem.COL && taxon.getVernacularNames() == null && taxon.getSynonyms() == null) { continue; } TaxonomicEnrichment enrichment = new TaxonomicEnrichment(); if (taxon.getVernacularNames() != null) { for (VernacularName vn : taxon.getVernacularNames()) { enrichment.addVernacularName(copySummaryVernacularName(vn)); } } if (taxon.getSynonyms() != null) { for (ScientificName sn : taxon.getSynonyms()) { enrichment.addSynonym(copyScientificName(sn)); } } if (taxon.getDefaultClassification() != null && taxon.getSourceSystem() == SourceSystem.COL) { enrichment.setDefaultClassification(taxon.getDefaultClassification()); } enrichment.setSourceSystem(copySourceSystem(taxon.getSourceSystem())); enrichment.setTaxonId(taxon.getId()); enrichments.add(enrichment); } return enrichments; }
EnrichmentUtil { public static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa) { List<TaxonomicEnrichment> enrichments = new ArrayList<>(taxa.size()); for (Taxon taxon : taxa) { if (taxon.getVernacularNames() == null && taxon.getSynonyms() == null && taxon.getDefaultClassification() == null) { continue; } if (taxon.getSourceSystem() != SourceSystem.COL && taxon.getVernacularNames() == null && taxon.getSynonyms() == null) { continue; } TaxonomicEnrichment enrichment = new TaxonomicEnrichment(); if (taxon.getVernacularNames() != null) { for (VernacularName vn : taxon.getVernacularNames()) { enrichment.addVernacularName(copySummaryVernacularName(vn)); } } if (taxon.getSynonyms() != null) { for (ScientificName sn : taxon.getSynonyms()) { enrichment.addSynonym(copyScientificName(sn)); } } if (taxon.getDefaultClassification() != null && taxon.getSourceSystem() == SourceSystem.COL) { enrichment.setDefaultClassification(taxon.getDefaultClassification()); } enrichment.setSourceSystem(copySourceSystem(taxon.getSourceSystem())); enrichment.setTaxonId(taxon.getId()); enrichments.add(enrichment); } return enrichments; } }
EnrichmentUtil { public static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa) { List<TaxonomicEnrichment> enrichments = new ArrayList<>(taxa.size()); for (Taxon taxon : taxa) { if (taxon.getVernacularNames() == null && taxon.getSynonyms() == null && taxon.getDefaultClassification() == null) { continue; } if (taxon.getSourceSystem() != SourceSystem.COL && taxon.getVernacularNames() == null && taxon.getSynonyms() == null) { continue; } TaxonomicEnrichment enrichment = new TaxonomicEnrichment(); if (taxon.getVernacularNames() != null) { for (VernacularName vn : taxon.getVernacularNames()) { enrichment.addVernacularName(copySummaryVernacularName(vn)); } } if (taxon.getSynonyms() != null) { for (ScientificName sn : taxon.getSynonyms()) { enrichment.addSynonym(copyScientificName(sn)); } } if (taxon.getDefaultClassification() != null && taxon.getSourceSystem() == SourceSystem.COL) { enrichment.setDefaultClassification(taxon.getDefaultClassification()); } enrichment.setSourceSystem(copySourceSystem(taxon.getSourceSystem())); enrichment.setTaxonId(taxon.getId()); enrichments.add(enrichment); } return enrichments; }  }
EnrichmentUtil { public static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa) { List<TaxonomicEnrichment> enrichments = new ArrayList<>(taxa.size()); for (Taxon taxon : taxa) { if (taxon.getVernacularNames() == null && taxon.getSynonyms() == null && taxon.getDefaultClassification() == null) { continue; } if (taxon.getSourceSystem() != SourceSystem.COL && taxon.getVernacularNames() == null && taxon.getSynonyms() == null) { continue; } TaxonomicEnrichment enrichment = new TaxonomicEnrichment(); if (taxon.getVernacularNames() != null) { for (VernacularName vn : taxon.getVernacularNames()) { enrichment.addVernacularName(copySummaryVernacularName(vn)); } } if (taxon.getSynonyms() != null) { for (ScientificName sn : taxon.getSynonyms()) { enrichment.addSynonym(copyScientificName(sn)); } } if (taxon.getDefaultClassification() != null && taxon.getSourceSystem() == SourceSystem.COL) { enrichment.setDefaultClassification(taxon.getDefaultClassification()); } enrichment.setSourceSystem(copySourceSystem(taxon.getSourceSystem())); enrichment.setTaxonId(taxon.getId()); enrichments.add(enrichment); } return enrichments; }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa); }
EnrichmentUtil { public static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa) { List<TaxonomicEnrichment> enrichments = new ArrayList<>(taxa.size()); for (Taxon taxon : taxa) { if (taxon.getVernacularNames() == null && taxon.getSynonyms() == null && taxon.getDefaultClassification() == null) { continue; } if (taxon.getSourceSystem() != SourceSystem.COL && taxon.getVernacularNames() == null && taxon.getSynonyms() == null) { continue; } TaxonomicEnrichment enrichment = new TaxonomicEnrichment(); if (taxon.getVernacularNames() != null) { for (VernacularName vn : taxon.getVernacularNames()) { enrichment.addVernacularName(copySummaryVernacularName(vn)); } } if (taxon.getSynonyms() != null) { for (ScientificName sn : taxon.getSynonyms()) { enrichment.addSynonym(copyScientificName(sn)); } } if (taxon.getDefaultClassification() != null && taxon.getSourceSystem() == SourceSystem.COL) { enrichment.setDefaultClassification(taxon.getDefaultClassification()); } enrichment.setSourceSystem(copySourceSystem(taxon.getSourceSystem())); enrichment.setTaxonId(taxon.getId()); enrichments.add(enrichment); } return enrichments; }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa);  }