use of eu.etaxonomy.cdm.model.occurrence.GatheringEvent in project cdmlib by cybertaxonomy.
the class FullCoverageDataGenerator method createOccurrence.
private void createOccurrence(List<CdmBase> cdmBases) {
// Collection
Collection collection = Collection.NewInstance();
Collection subCollection = Collection.NewInstance();
subCollection.setSuperCollection(collection);
handleIdentifiableEntity(collection);
handleIdentifiableEntity(subCollection);
cdmBases.add(subCollection);
collection.setCode("coll code");
collection.setCodeStandard("codeStandard");
collection.setName("coll name");
collection.setTownOrLocation("townOrLocation");
Institution institution = Institution.NewInstance();
collection.setInstitute(institution);
// FieldUnit
FieldUnit fieldUnit = FieldUnit.NewInstance();
fieldUnit.setFieldNumber("fieldNumber");
fieldUnit.setFieldNotes("fieldNotes");
Person primaryCollector = Person.NewInstance();
fieldUnit.setPrimaryCollector(primaryCollector);
handleIdentifiableEntity(fieldUnit);
GatheringEvent gatheringEvent = GatheringEvent.NewInstance();
fieldUnit.setGatheringEvent(gatheringEvent);
gatheringEvent.putLocality(Language.ENGLISH(), "locality");
gatheringEvent.setExactLocation(Point.NewInstance(22.4, -34.2, ReferenceSystem.WGS84(), 33));
gatheringEvent.setCountry(Country.GERMANY());
gatheringEvent.addCollectingArea(NamedArea.EUROPE());
gatheringEvent.setCollectingMethod("collectingMethod");
gatheringEvent.setAbsoluteElevation(10);
gatheringEvent.setAbsoluteElevationMax(100);
gatheringEvent.setAbsoluteElevationText("elevation text");
gatheringEvent.setDistanceToGround(10.4);
gatheringEvent.setDistanceToGroundMax(100.3);
gatheringEvent.setDistanceToGroundText("distance to ground text");
gatheringEvent.setDistanceToWaterSurface(10.4);
gatheringEvent.setDistanceToWaterSurfaceMax(100.3);
gatheringEvent.setDistanceToWaterSurfaceText("distance to water text");
handleAnnotatableEntity(gatheringEvent);
handleEventBase(gatheringEvent);
// Derived Unit
MediaSpecimen mediaSpecimen = MediaSpecimen.NewInstance(SpecimenOrObservationType.StillImage);
mediaSpecimen.setCollection(collection);
mediaSpecimen.setCatalogNumber("catalogNumber");
mediaSpecimen.setAccessionNumber("accessionNumber");
// mediaSpecimen.setCollectorsNumber("collectorsNumber");
mediaSpecimen.setBarcode("barcode");
TaxonName storedUnder = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
storedUnder.setTitleCache("Stored under", true);
mediaSpecimen.setStoredUnder(storedUnder);
mediaSpecimen.setExsiccatum("exsiccatum");
PreservationMethod preservation = PreservationMethod.NewInstance(null, "My preservation");
preservation.setTemperature(22.4);
mediaSpecimen.setPreservation(preservation);
mediaSpecimen.setOriginalLabelInfo("Original Label Info");
mediaSpecimen.addStatus(DefinedTerm.getTermByUuid(DefinedTerm.uuidDestroyed), getReference(), "123");
handleIdentifiableEntity(mediaSpecimen);
// DerivationEvent
DerivationEvent event = DerivationEvent.NewInstance(DerivationEventType.ACCESSIONING());
event.addOriginal(fieldUnit);
event.addDerivative(mediaSpecimen);
Institution inst = Institution.NewInstance();
event.setInstitution(inst);
handleAnnotatableEntity(event);
handleEventBase(event);
// SpecOrObservationBase
fieldUnit.setSex(DefinedTerm.SEX_FEMALE());
DefinedTerm lifeStage = DefinedTerm.NewStageInstance("Live stage", "stage", null);
cdmBases.add(lifeStage);
fieldUnit.setLifeStage(lifeStage);
DefinedTerm kindOfUnit = DefinedTerm.NewKindOfUnitInstance("Kind of unit", "Kind of unit", null);
cdmBases.add(kindOfUnit);
fieldUnit.setKindOfUnit(kindOfUnit);
fieldUnit.setIndividualCount("3");
fieldUnit.putDefinition(Language.ENGLISH(), "definition");
fieldUnit.setPublish(true);
handleIdentifiableEntity(fieldUnit);
// Determination
DeterminationEvent determinationEvent = DeterminationEvent.NewInstance(getTaxon(), mediaSpecimen);
determinationEvent.setModifier(DefinedTerm.DETERMINATION_MODIFIER_AFFINIS());
determinationEvent.setPreferredFlag(true);
determinationEvent.addReference(getReference());
handleAnnotatableEntity(determinationEvent);
handleEventBase(determinationEvent);
cdmBases.add(fieldUnit);
cdmBases.add(mediaSpecimen);
cdmBases.add(collection);
}
Aggregations