Project

General

Profile

« Previous | Next » 

Revision 0873eb1c

Added by Patrick Plitzner about 8 years ago

Import taxa separately into checklist classification and GesamtListe
classification

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java
36 36
import eu.etaxonomy.cdm.model.taxon.Synonym;
37 37
import eu.etaxonomy.cdm.model.taxon.Taxon;
38 38
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
39
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
40
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
39 41

  
40 42
/**
41 43
 *
......
249 251
            RedListUtil.logMessage(id, "Taxon for name "+name+" could not be created.", logger);
250 252
            return;
251 253
        }
252

  
253 254
        taxaToSave.add(taxonBase);
254 255

  
256
        /*check if taxon/synonym is also in checklist
257
         * 1. create new taxon with the same name (in the checklist classification)
258
         * 2. create congruent concept relationship between both
259
         */
260
        String clTaxonString = rs.getString(RedListUtil.CL_TAXON);
261
        if(CdmUtils.isNotBlank(clTaxonString) && !clTaxonString.trim().equals("-")){
262
            TaxonBase clone = (TaxonBase) taxonBase.clone();
263
            clone.setName(name);
264
            if(taxonBase.isInstanceOf(Taxon.class)){
265
                TaxonRelationship taxonRelation = ((Taxon) taxonBase).addTaxonRelation((Taxon) clone, TaxonRelationshipType.CONGRUENT_TO(), null, null);
266
                taxonRelation.setDoubtful(true);//TODO Ist das mit " mit Fragezeichen" gemeint?
267
            }
268
            ImportHelper.setOriginalSource(clone, state.getTransactionalSourceReference(), id, RedListUtil.TAXON_CHECKLISTE_NAMESPACE);
269
            state.getTaxonMap().put(id, clone.getUuid());
270
            taxaToSave.add(clone);
271
        }
272

  
255 273
        //id
256
        ImportHelper.setOriginalSource(taxonBase, state.getTransactionalSourceReference(), id, RedListUtil.TAXON_NAMESPACE);
274
        ImportHelper.setOriginalSource(taxonBase, state.getTransactionalSourceReference(), id, RedListUtil.TAXON_GESAMTLISTE_NAMESPACE);
257 275
        state.getTaxonMap().put(id, taxonBase.getUuid());
258 276
    }
259 277

  

Also available in: Unified diff