Search in sources :

Example 21 with GatheringEvent

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);
}
Also used : GatheringEvent(eu.etaxonomy.cdm.model.occurrence.GatheringEvent) FieldUnit(eu.etaxonomy.cdm.model.occurrence.FieldUnit) PreservationMethod(eu.etaxonomy.cdm.model.occurrence.PreservationMethod) DerivationEvent(eu.etaxonomy.cdm.model.occurrence.DerivationEvent) MediaSpecimen(eu.etaxonomy.cdm.model.occurrence.MediaSpecimen) Collection(eu.etaxonomy.cdm.model.occurrence.Collection) CommonTaxonName(eu.etaxonomy.cdm.model.description.CommonTaxonName) TaxonName(eu.etaxonomy.cdm.model.name.TaxonName) Institution(eu.etaxonomy.cdm.model.agent.Institution) DeterminationEvent(eu.etaxonomy.cdm.model.occurrence.DeterminationEvent) Person(eu.etaxonomy.cdm.model.agent.Person) DefinedTerm(eu.etaxonomy.cdm.model.term.DefinedTerm)

Aggregations

GatheringEvent (eu.etaxonomy.cdm.model.occurrence.GatheringEvent)21 LanguageString (eu.etaxonomy.cdm.model.common.LanguageString)9 FieldUnit (eu.etaxonomy.cdm.model.occurrence.FieldUnit)9 DerivedUnit (eu.etaxonomy.cdm.model.occurrence.DerivedUnit)8 DerivationEvent (eu.etaxonomy.cdm.model.occurrence.DerivationEvent)6 Institution (eu.etaxonomy.cdm.model.agent.Institution)5 TaxonName (eu.etaxonomy.cdm.model.name.TaxonName)5 Collection (eu.etaxonomy.cdm.model.occurrence.Collection)5 UnitsGatheringEvent (eu.etaxonomy.cdm.io.specimen.UnitsGatheringEvent)4 Person (eu.etaxonomy.cdm.model.agent.Person)4 DeterminationEvent (eu.etaxonomy.cdm.model.occurrence.DeterminationEvent)4 DerivedUnitFacade (eu.etaxonomy.cdm.api.facade.DerivedUnitFacade)3 UnitsGatheringArea (eu.etaxonomy.cdm.io.specimen.UnitsGatheringArea)3 IdentifiableSource (eu.etaxonomy.cdm.model.common.IdentifiableSource)3 TimePeriod (eu.etaxonomy.cdm.model.common.TimePeriod)3 NamedArea (eu.etaxonomy.cdm.model.location.NamedArea)3 Media (eu.etaxonomy.cdm.model.media.Media)3 MediaSpecimen (eu.etaxonomy.cdm.model.occurrence.MediaSpecimen)3 SpecimenOrObservationBase (eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase)3 URI (eu.etaxonomy.cdm.common.URI)2