@Test public void enrichSpecimens() { 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); SpecimenIdentification identification = new SpecimenIdentification(); identification.setScientificName(scientificName); Specimen specimen = new Specimen(); specimen.setId("L.1911711@BRAHMS"); specimen.addIndentification(identification); List<Specimen> specimens = new ArrayList<>(); specimens.add(specimen); Object obj = ReflectionUtil.callStatic( SpecimenMultimediaEnricher.class, "enrichSpecimens", new Class[] {List.class}, new Object[] {specimens} ); List<Specimen> enrichedSpecimens = (List<Specimen>) obj; Specimen actual = enrichedSpecimens.get(0); String taxanomicStatus = "accepted name"; String expectedScientificNameGroup = "bombus affinis"; String expectedAuthorshipVerbatim = "Cresson, 1863"; String expectedFullScientificName = "Bombus affinis Cresson, 1863"; String expectedGenus = "Larus"; String expectedSpecificEpethet = "affinis"; ScientificName name = actual.getIdentifications().get(0).getScientificName(); assertEquals("01", taxanomicStatus, name.getTaxonomicStatus().toString()); assertEquals("02", expectedScientificNameGroup, name.getScientificNameGroup()); assertEquals("03", expectedAuthorshipVerbatim, name.getAuthorshipVerbatim()); assertEquals("04", expectedFullScientificName, name.getFullScientificName()); assertEquals("05", expectedGenus, name.getGenusOrMonomial()); assertEquals("06", expectedSpecificEpethet, name.getSpecificEpithet()); }
private static List<Specimen> enrichSpecimens(List<Specimen> specimens) { if (logger.isDebugEnabled()) { logger.debug("Creating multimedia lookup table"); } Map<String, List<ServiceAccessPoint>> multimediaLookupTable; multimediaLookupTable = createMultiMediaLookupTableForSpecimens(specimens); if (multimediaLookupTable.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("No multimedia found for current batch of specimens"); } return Collections.emptyList(); } List<Specimen> enriched = new ArrayList<>(specimens.size()); for (Specimen specimen : specimens) { List<ServiceAccessPoint> uris = multimediaLookupTable.get(specimen.getId()); if (uris != null) { specimen.setAssociatedMultiMediaUris(uris); enriched.add(specimen); } } return enriched; }
SpecimenMultimediaEnricher { private static List<Specimen> enrichSpecimens(List<Specimen> specimens) { if (logger.isDebugEnabled()) { logger.debug("Creating multimedia lookup table"); } Map<String, List<ServiceAccessPoint>> multimediaLookupTable; multimediaLookupTable = createMultiMediaLookupTableForSpecimens(specimens); if (multimediaLookupTable.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("No multimedia found for current batch of specimens"); } return Collections.emptyList(); } List<Specimen> enriched = new ArrayList<>(specimens.size()); for (Specimen specimen : specimens) { List<ServiceAccessPoint> uris = multimediaLookupTable.get(specimen.getId()); if (uris != null) { specimen.setAssociatedMultiMediaUris(uris); enriched.add(specimen); } } return enriched; } }
SpecimenMultimediaEnricher { private static List<Specimen> enrichSpecimens(List<Specimen> specimens) { if (logger.isDebugEnabled()) { logger.debug("Creating multimedia lookup table"); } Map<String, List<ServiceAccessPoint>> multimediaLookupTable; multimediaLookupTable = createMultiMediaLookupTableForSpecimens(specimens); if (multimediaLookupTable.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("No multimedia found for current batch of specimens"); } return Collections.emptyList(); } List<Specimen> enriched = new ArrayList<>(specimens.size()); for (Specimen specimen : specimens) { List<ServiceAccessPoint> uris = multimediaLookupTable.get(specimen.getId()); if (uris != null) { specimen.setAssociatedMultiMediaUris(uris); enriched.add(specimen); } } return enriched; }  }
SpecimenMultimediaEnricher { private static List<Specimen> enrichSpecimens(List<Specimen> specimens) { if (logger.isDebugEnabled()) { logger.debug("Creating multimedia lookup table"); } Map<String, List<ServiceAccessPoint>> multimediaLookupTable; multimediaLookupTable = createMultiMediaLookupTableForSpecimens(specimens); if (multimediaLookupTable.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("No multimedia found for current batch of specimens"); } return Collections.emptyList(); } List<Specimen> enriched = new ArrayList<>(specimens.size()); for (Specimen specimen : specimens) { List<ServiceAccessPoint> uris = multimediaLookupTable.get(specimen.getId()); if (uris != null) { specimen.setAssociatedMultiMediaUris(uris); enriched.add(specimen); } } return enriched; }  static void main(String[] args); void enrich(); void configureWithSystemProperties(); int getReadBatchSize(); void setReadBatchSize(int readBatchSize); int getWriteBatchSize(); void setWriteBatchSize(int writeBatchSize); }
SpecimenMultimediaEnricher { private static List<Specimen> enrichSpecimens(List<Specimen> specimens) { if (logger.isDebugEnabled()) { logger.debug("Creating multimedia lookup table"); } Map<String, List<ServiceAccessPoint>> multimediaLookupTable; multimediaLookupTable = createMultiMediaLookupTableForSpecimens(specimens); if (multimediaLookupTable.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("No multimedia found for current batch of specimens"); } return Collections.emptyList(); } List<Specimen> enriched = new ArrayList<>(specimens.size()); for (Specimen specimen : specimens) { List<ServiceAccessPoint> uris = multimediaLookupTable.get(specimen.getId()); if (uris != null) { specimen.setAssociatedMultiMediaUris(uris); enriched.add(specimen); } } return enriched; }  static void main(String[] args); void enrich(); void configureWithSystemProperties(); int getReadBatchSize(); void setReadBatchSize(int readBatchSize); int getWriteBatchSize(); void setWriteBatchSize(int writeBatchSize);  }