Project

General

Profile

« Previous | Next » 

Revision e6dcb602

Added by Andreas Müller about 10 years ago

handle inverse and doubtful taxon relations in Berlin Model import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelTaxonRelationImport.java
44 44
import eu.etaxonomy.cdm.model.common.CdmBase;
45 45
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
46 46
import eu.etaxonomy.cdm.model.reference.Reference;
47
import eu.etaxonomy.cdm.model.taxon.Classification;
47 48
import eu.etaxonomy.cdm.model.taxon.Synonym;
48 49
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
49 50
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
50 51
import eu.etaxonomy.cdm.model.taxon.Taxon;
51 52
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
52 53
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
54
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
53 55
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
54
import eu.etaxonomy.cdm.model.taxon.Classification;
55 56
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
56 57

  
57 58
/**
......
317 318
								logger.warn("Proparte/Partial not yet implemented for TaxonRelationShipType " + relQualifierFk);
318 319
							}
319 320
						}else if (isConceptRelationship){
320
							ResultWrapper<Boolean> isInverse = new ResultWrapper<Boolean>();
321
							ResultWrapper<Boolean> isInverse = ResultWrapper.NewInstance(false);
322
							ResultWrapper<Boolean> isDoubtful = ResultWrapper.NewInstance(false);
321 323
							try {
322
								TaxonRelationshipType relType = BerlinModelTransformer.taxonRelId2TaxonRelType(relQualifierFk, isInverse);	
324
								TaxonRelationshipType relType = BerlinModelTransformer.taxonRelId2TaxonRelType(relQualifierFk, isInverse, isDoubtful);	
325

  
323 326
								if (! (taxon1 instanceof Taxon)){
324 327
									success = false;
325 328
									logger.error("TaxonBase (ID = " + taxon1.getId()+ ", RIdentifier = " + taxon1Id + ") can't be casted to Taxon");
326 329
								}else{
327 330
									Taxon fromTaxon = (Taxon)taxon1;
331
									if (isInverse.getValue() == true){
332
										Taxon tmp = fromTaxon;
333
										fromTaxon = toTaxon;
334
										toTaxon = tmp;
335
									}
328 336
									taxonRelationship = fromTaxon.addTaxonRelation(toTaxon, relType, citation, microcitation);
329 337
									handleAllRelatedTaxa(state, toTaxon, classificationMap, treeRefFk);
330 338
									handleAllRelatedTaxa(state, fromTaxon, classificationMap, fromRefFk);
339
									if (isDoubtful.getValue() == true){
340
										((TaxonRelationship)taxonRelationship).setDoubtful(true);
341
									}	
331 342
								}
332 343
							} catch (UnknownCdmTypeException e) {
333 344
								//TODO other relationships
......
381 392
			Classification classification = getClassificationTree(state, classificationMap, secRefFk);
382 393
			classification.addChildTaxon(taxon, null, null);
383 394
		}
384
		
385

  
386
		
387 395
	}
388 396

  
389 397
	@Override

Also available in: Unified diff