@Test public void testCopySpecimen() { 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); Monomial monomial = new Monomial(); monomial.setName("Plantae"); monomial.setRank("kingdom"); DefaultClassification defaultClassification = new DefaultClassification(); defaultClassification.set(monomial); SpecimenTypeStatus typeStatus = SpecimenTypeStatus.ISOLECTOTYPE; TaxonomicEnrichment taxonomicEnrichments = new TaxonomicEnrichment(); taxonomicEnrichments.setTaxonId("L.1911711@BRAHMS"); List<TaxonomicEnrichment> enrichments = new ArrayList<>(); enrichments.add(taxonomicEnrichments); SpecimenIdentification identification = new SpecimenIdentification(); identification.setScientificName(scientificName); identification.setDefaultClassification(defaultClassification); identification.setTypeStatus(typeStatus); identification.setTaxonomicEnrichments(enrichments); SourceSystem sourceSystem = SourceSystem.getInstance("COL", "Species 2000 - Catalogue Of Life"); Sex sex = Sex.MIXED; String phaseOrStage = "pupa"; OffsetDateTime time = OffsetDateTime.parse("2011-12-03T10:15:30Z"); Organization org = new Organization(); org.setName("Naturalis"); List<Organization> gatheringOrganizations = new ArrayList<>(); gatheringOrganizations.add(org); Person person = new Person(); person.setFullName("Plabon Kakoti"); person.setOrganization(org); person.setAgentText("test"); List<Person> gatheringPersons = new ArrayList<>(); gatheringPersons.add(person); GatheringSiteCoordinates siteCoordinates = new GatheringSiteCoordinates(); siteCoordinates.setLongitudeDecimal(5.016667); siteCoordinates.setLatitudeDecimal(51.433333); List<GatheringSiteCoordinates> coordinates = new ArrayList<>(); coordinates.add(siteCoordinates); GatheringEvent gatheringEvent = new GatheringEvent(); gatheringEvent.setDateTimeBegin(time); gatheringEvent.setGatheringOrganizations(gatheringOrganizations); gatheringEvent.setGatheringPersons(gatheringPersons); gatheringEvent.setLocality("Amsterdam"); gatheringEvent.setSiteCoordinates(coordinates); Specimen specimen = new Specimen(); specimen.addIndentification(identification); specimen.setId("L.1911711@BRAHMS"); specimen.setCollectorsFieldNumber("Wiesbaur, SJ s.n. "); specimen.setAssemblageID(""); specimen.setCollectionType("Botany"); specimen.setSex(sex); specimen.setPhaseOrStage(phaseOrStage); specimen.setSourceSystem(sourceSystem); specimen.setGatheringEvent(gatheringEvent); SummarySpecimen summarySpecimen = SummaryObjectUtil.copySpecimen(specimen, "bombus affinis"); summarySpecimen.getCollectorsFieldNumber(); summarySpecimen.getCollectionType(); summarySpecimen.getPhaseOrStage(); summarySpecimen.getGatheringEvent().getLocalityText(); summarySpecimen.getMatchingIdentifications().get(0).getScientificName().getFullScientificName(); assertNotNull(summarySpecimen); assertEquals("01", "L.1911711@BRAHMS", summarySpecimen.getId()); assertEquals("02", "COL", summarySpecimen.getSourceSystem().getCode()); assertEquals("03", "Wiesbaur, SJ s.n. ", summarySpecimen.getCollectorsFieldNumber()); assertEquals("04", "2011-12-03T10:15:30Z", summarySpecimen.getGatheringEvent().getDateTimeBegin().toString()); assertEquals("05", "pupa", summarySpecimen.getPhaseOrStage().toString()); assertEquals("06", "Botany", summarySpecimen.getCollectionType()); assertEquals("07", "Bombus affinis Cresson, 1863", summarySpecimen.getMatchingIdentifications() .get(0).getScientificName().getFullScientificName()); }
public static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup) { SummarySpecimen summary = new SummarySpecimen(); summary.setId(specimen.getId()); summary.setSourceSystem(copySourceSystem(specimen.getSourceSystem())); summary.setUnitID(specimen.getUnitID()); summary.setCollectorsFieldNumber(specimen.getCollectorsFieldNumber()); summary.setAssemblageID(specimen.getAssemblageID()); summary.setCollectionType(specimen.getCollectionType()); summary.setSex(specimen.getSex()); summary.setPhaseOrStage(specimen.getPhaseOrStage()); summary.setGatheringEvent(copyGatheringEvent(specimen.getGatheringEvent())); for (SpecimenIdentification si : specimen.getIdentifications()) { if (si.getScientificName().getScientificNameGroup().equals(nameGroup)) { summary.addMatchingIdentification(copyIdentification(si)); } else { summary.addOtherIdentification(copyIdentification(si)); } } return summary; }
SummaryObjectUtil { public static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup) { SummarySpecimen summary = new SummarySpecimen(); summary.setId(specimen.getId()); summary.setSourceSystem(copySourceSystem(specimen.getSourceSystem())); summary.setUnitID(specimen.getUnitID()); summary.setCollectorsFieldNumber(specimen.getCollectorsFieldNumber()); summary.setAssemblageID(specimen.getAssemblageID()); summary.setCollectionType(specimen.getCollectionType()); summary.setSex(specimen.getSex()); summary.setPhaseOrStage(specimen.getPhaseOrStage()); summary.setGatheringEvent(copyGatheringEvent(specimen.getGatheringEvent())); for (SpecimenIdentification si : specimen.getIdentifications()) { if (si.getScientificName().getScientificNameGroup().equals(nameGroup)) { summary.addMatchingIdentification(copyIdentification(si)); } else { summary.addOtherIdentification(copyIdentification(si)); } } return summary; } }
SummaryObjectUtil { public static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup) { SummarySpecimen summary = new SummarySpecimen(); summary.setId(specimen.getId()); summary.setSourceSystem(copySourceSystem(specimen.getSourceSystem())); summary.setUnitID(specimen.getUnitID()); summary.setCollectorsFieldNumber(specimen.getCollectorsFieldNumber()); summary.setAssemblageID(specimen.getAssemblageID()); summary.setCollectionType(specimen.getCollectionType()); summary.setSex(specimen.getSex()); summary.setPhaseOrStage(specimen.getPhaseOrStage()); summary.setGatheringEvent(copyGatheringEvent(specimen.getGatheringEvent())); for (SpecimenIdentification si : specimen.getIdentifications()) { if (si.getScientificName().getScientificNameGroup().equals(nameGroup)) { summary.addMatchingIdentification(copyIdentification(si)); } else { summary.addOtherIdentification(copyIdentification(si)); } } return summary; } private  SummaryObjectUtil(); }
SummaryObjectUtil { public static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup) { SummarySpecimen summary = new SummarySpecimen(); summary.setId(specimen.getId()); summary.setSourceSystem(copySourceSystem(specimen.getSourceSystem())); summary.setUnitID(specimen.getUnitID()); summary.setCollectorsFieldNumber(specimen.getCollectorsFieldNumber()); summary.setAssemblageID(specimen.getAssemblageID()); summary.setCollectionType(specimen.getCollectionType()); summary.setSex(specimen.getSex()); summary.setPhaseOrStage(specimen.getPhaseOrStage()); summary.setGatheringEvent(copyGatheringEvent(specimen.getGatheringEvent())); for (SpecimenIdentification si : specimen.getIdentifications()) { if (si.getScientificName().getScientificNameGroup().equals(nameGroup)) { summary.addMatchingIdentification(copyIdentification(si)); } else { summary.addOtherIdentification(copyIdentification(si)); } } return summary; } private  SummaryObjectUtil(); static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup); static SummaryTaxon copyTaxon(Taxon taxon); static SummaryScientificName copyScientificName(ScientificName sn); static SummaryVernacularName copySummaryVernacularName(VernacularName vn); static SummarySourceSystem copySourceSystem(SourceSystem ss); }
SummaryObjectUtil { public static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup) { SummarySpecimen summary = new SummarySpecimen(); summary.setId(specimen.getId()); summary.setSourceSystem(copySourceSystem(specimen.getSourceSystem())); summary.setUnitID(specimen.getUnitID()); summary.setCollectorsFieldNumber(specimen.getCollectorsFieldNumber()); summary.setAssemblageID(specimen.getAssemblageID()); summary.setCollectionType(specimen.getCollectionType()); summary.setSex(specimen.getSex()); summary.setPhaseOrStage(specimen.getPhaseOrStage()); summary.setGatheringEvent(copyGatheringEvent(specimen.getGatheringEvent())); for (SpecimenIdentification si : specimen.getIdentifications()) { if (si.getScientificName().getScientificNameGroup().equals(nameGroup)) { summary.addMatchingIdentification(copyIdentification(si)); } else { summary.addOtherIdentification(copyIdentification(si)); } } return summary; } private  SummaryObjectUtil(); static SummarySpecimen copySpecimen(Specimen specimen, String nameGroup); static SummaryTaxon copyTaxon(Taxon taxon); static SummaryScientificName copyScientificName(ScientificName sn); static SummaryVernacularName copySummaryVernacularName(VernacularName vn); static SummarySourceSystem copySourceSystem(SourceSystem ss);  }