Project

General

Profile

Revision 74d84f79

ID74d84f793d0eb257aea208c042965a735a5ad60d
Parent 658c4382
Child 776a6d47

Added by Andreas Kohlbecker almost 4 years ago

ref #6026 using genera as higher taxon for species

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/iapt/IAPTActivator.java
35 35
public class IAPTActivator {
36 36
    private static final Logger logger = Logger.getLogger(IAPTActivator.class);
37 37

  
38
    public static final String DATA_FILE_0_100 = "iapt-100.xls";
39 38
    public static final String DATA_FILE_FULL = "Registration_DB_from_BGBM17.xls";
39
    public static final String DATA_FILE_0_100 = "iapt-100.xls";
40 40
    public static final String DATA_ENCODING_PROBLEMS = "encoding-problems.xls";
41 41
    public static final String DATA_IAPT_TYPES_100 = "iapt-types-100.xls";
42 42
    public static final String DATA_TYPE_LEG_100 = "iapt-type-leg-100.xls";
43 43
    public static final String DATA_NAME_TYPES = "iapt-name-types.xls";
44 44
    public static final String DATA_SINGLE = "single.xls";
45
    public static final String DATA_FILE = DATA_SINGLE;
45
    public static final String DATA_FILE = DATA_FILE_FULL;
46 46

  
47 47
    //database validation status (create, update, validate ...)
48 48
    static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTExcelImport.java
10 10
package eu.etaxonomy.cdm.io.iapt;
11 11

  
12 12
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
13
import eu.etaxonomy.cdm.api.service.pager.Pager;
13 14
import eu.etaxonomy.cdm.common.CdmUtils;
14 15
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImport;
15 16
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
......
340 341
        }
341 342

  
342 343
        getTaxonService().save(taxon);
344

  
345
        if(taxonName.getRank().equals(Rank.SPECIES()) || taxonName.getRank().isLower(Rank.SPECIES())){
346
            // try to find the genus, it should have been imported already, Genera are coming first in the import file
347
            Taxon genus = ((IAPTImportState)state).getGenusTaxonMap().get(taxonName.getGenusOrUninomial());
348
            if(genus != null){
349
                higherTaxonNode = genus.getTaxonNodes().iterator().next();
350
            } else {
351
                logger.info(csvReportLine(regNumber, "Parent genus not found for", nameStr));
352
            }
353
        }
354

  
343 355
        if(higherTaxonNode != null){
344 356
            higherTaxonNode.addChildTaxon(taxon, null, null);
345 357
            getTaxonNodeService().save(higherTaxonNode);
346 358
        }
347 359

  
360
        if(taxonName.getRank().isGenus()){
361
            ((IAPTImportState)state).getGenusTaxonMap().put(taxonName.getGenusOrUninomial(), taxon);
362
        }
363

  
348 364
        return taxon;
349 365
    }
350 366

  
......
1054 1070
        ((IAPTImportState)state).setCurrentTaxon(taxon);
1055 1071

  
1056 1072

  
1073
        logger.info("#of imported Genera: " + ((IAPTImportState) state).getGenusTaxonMap().size());
1057 1074
		return;
1058 1075
    }
1059 1076

  
app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTImportState.java
38 38

  
39 39
	private final Map<String, UUID> higherTaxonUuidMap = new HashMap<String, UUID>();
40 40

  
41
    private final Map<String, Taxon> genusTaxonMap = new HashMap<String, Taxon>();
42

  
41 43
	private final Map<String, BotanicalName> familyNameMap = new HashMap<String, BotanicalName>();
42 44

  
43 45
	//classification
......
96 98
        return higherTaxonUuidMap.containsKey(higherName);
97 99
    }
98 100

  
99
    //family names
100
    public BotanicalName getFamilyName(String familyStr) {
101
        return familyNameMap.get(familyStr);
102
    }
103
    public void putFamilyName(String familyStr, BotanicalName name) {
104
        familyNameMap.put(familyStr, name);
101
    public Map<String, Taxon> getGenusTaxonMap() {
102
        return genusTaxonMap;
105 103
    }
106 104

  
107

  
108 105
    Map<UUID, Reference> refMap = new HashMap<UUID, Reference>();
109 106
    //reference
110 107
    public Reference getReference(UUID uuidRef) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)