Revision bb38665e
Added by Andreas Müller over 10 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/synthesysImport/SynthesysCacheActivator.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
36 | 36 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
37 | 37 |
import eu.etaxonomy.cdm.model.location.Point; |
38 |
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
|
|
38 |
import eu.etaxonomy.cdm.model.location.Country; |
|
39 | 39 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
40 | 40 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
41 | 41 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent; |
42 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
|
|
42 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
|
43 | 43 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
44 |
import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
|
|
44 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
|
45 | 45 |
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent; |
46 |
import eu.etaxonomy.cdm.model.occurrence.LivingBeing; |
|
47 |
import eu.etaxonomy.cdm.model.occurrence.Observation; |
|
48 |
import eu.etaxonomy.cdm.model.occurrence.Specimen; |
|
46 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
|
49 | 47 |
import eu.etaxonomy.cdm.model.reference.Reference; |
50 | 48 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
51 | 49 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
152 | 150 |
/** |
153 | 151 |
* SPECIMEN OR OBSERVATION OR LIVING |
154 | 152 |
*/ |
155 |
DerivedUnitBase<?> derivedThing = null;
|
|
153 |
DerivedUnit derivedThing = null; |
|
156 | 154 |
//create specimen |
157 | 155 |
if (this.recordBasis != null){ |
158 | 156 |
if (this.recordBasis.toLowerCase().startsWith("s")) {//specimen |
159 |
derivedThing = Specimen.NewInstance();
|
|
157 |
derivedThing = DerivedUnit.NewPreservedSpecimenInstance();
|
|
160 | 158 |
} |
161 | 159 |
else if (this.recordBasis.toLowerCase().startsWith("o")) {//observation |
162 |
derivedThing = Observation.NewInstance();
|
|
160 |
derivedThing = DerivedUnit.NewInstance(SpecimenOrObservationType.Observation);
|
|
163 | 161 |
} |
164 | 162 |
else if (this.recordBasis.toLowerCase().startsWith("l")) {//living -> fossil, herbarium sheet....??? |
165 |
derivedThing = LivingBeing.NewInstance();
|
|
163 |
derivedThing = DerivedUnit.NewInstance(SpecimenOrObservationType.LivingSpecimen);
|
|
166 | 164 |
} |
167 | 165 |
} |
168 |
if (derivedThing == null) derivedThing = Observation.NewInstance(); |
|
166 |
if (derivedThing == null){ |
|
167 |
derivedThing = DerivedUnit.NewInstance(SpecimenOrObservationType.Observation); |
|
168 |
} |
|
169 | 169 |
|
170 | 170 |
TaxonNameBase<?,?> taxonName = null; |
171 | 171 |
Taxon taxon = null; |
... | ... | |
322 | 322 |
NamedArea area = NamedArea.NewInstance(); |
323 | 323 |
|
324 | 324 |
|
325 |
WaterbodyOrCountry country = null;
|
|
325 |
Country country = null; |
|
326 | 326 |
// System.out.println("isocountry "+this.isocountry); |
327 | 327 |
if (this.isocountry != null) |
328 | 328 |
country = app.getOccurrenceService().getCountryByIso(this.isocountry); |
... | ... | |
336 | 336 |
// System.out.println(iter.next().toString()); |
337 | 337 |
|
338 | 338 |
if (country != null){ |
339 |
area.addWaterbodyOrCountry(country);
|
|
339 |
area.addCountry(country); |
|
340 | 340 |
System.out.println("country not null!"); |
341 | 341 |
} |
342 | 342 |
// else{ |
343 | 343 |
// if (this.country != null){ |
344 |
// List<WaterbodyOrCountry>countries = app.getOccurrenceService().getWaterbodyOrCountryByName(this.country);
|
|
344 |
// List<Country>countries = app.getOccurrenceService().getCountryByName(this.country);
|
|
345 | 345 |
// if (countries.size() >0) |
346 |
// area.addWaterbodyOrCountry(countries.get(0));
|
|
346 |
// area.addCountry(countries.get(0)); |
|
347 | 347 |
// else |
348 | 348 |
// System.out.println("NO COUNTRY");//TODO need to add a new country! |
349 | 349 |
// } |
... | ... | |
371 | 371 |
} |
372 | 372 |
|
373 | 373 |
//create field/observation |
374 |
FieldObservation fieldObservation = FieldObservation.NewInstance();
|
|
374 |
FieldUnit fieldUnit = FieldUnit.NewInstance();
|
|
375 | 375 |
//add fieldNumber |
376 |
fieldObservation.setFieldNumber(this.fieldNumber);
|
|
376 |
fieldUnit.setFieldNumber(this.fieldNumber);
|
|
377 | 377 |
|
378 | 378 |
//join gatheringEvent to fieldObservation |
379 |
fieldObservation.setGatheringEvent(gatheringEvent);
|
|
379 |
fieldUnit.setGatheringEvent(gatheringEvent);
|
|
380 | 380 |
|
381 | 381 |
|
382 | 382 |
// //link fieldObservation and specimen |
383 | 383 |
DerivationEvent derivationEvent = DerivationEvent.NewInstance(); |
384 |
derivationEvent.addOriginal(fieldObservation);
|
|
384 |
derivationEvent.addOriginal(fieldUnit);
|
|
385 | 385 |
derivedThing.addDerivationEvent(derivationEvent); |
386 | 386 |
// derivationEvent.addDerivative(derivedThing); |
387 | 387 |
|
Also available in: Unified diff
reintegrate cdmlib-app-3.3 branch into trunk