Project

General

Profile

Download (3.21 KB) Statistics
| Branch: | Revision:
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.io.mexico;
10

    
11
import java.util.HashMap;
12
import java.util.Map;
13

    
14
import org.apache.log4j.Logger;
15

    
16
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
17
import eu.etaxonomy.cdm.io.excel.common.ExcelImportState;
18
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
19
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
20
import eu.etaxonomy.cdm.model.name.INonViralName;
21
import eu.etaxonomy.cdm.model.name.TaxonName;
22
import eu.etaxonomy.cdm.model.reference.Reference;
23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24

    
25
/**
26
 * @author a.mueller
27
 * @date 16.06.2016
28
 *
29
 */
30
public class SimpleExcelTaxonImportState<CONFIG extends ExcelImportConfiguratorBase>
31
        extends ExcelImportState<CONFIG, ExcelRowBase>{
32

    
33
    @SuppressWarnings("unused")
34
    private static final Logger logger = Logger.getLogger(SimpleExcelTaxonImportState.class);
35

    
36
    private final Map<String, Reference> refMap = new HashMap<>();
37

    
38
    private final Map<String, TeamOrPersonBase<?>> agentMap = new HashMap<>();
39

    
40
    private final Map<String, Taxon> higherTaxonTaxonMap = new HashMap<>();
41

    
42
    //using titleCache
43
    private Map<String, TaxonName> nameMap = new HashMap<>();
44

    
45
    private final Map<String, Taxon> taxonMap = new HashMap<>();
46

    
47
// ************************* CONSTRUCTUR *******************************/
48
    /**
49
     * @param config
50
     */
51
    public SimpleExcelTaxonImportState(CONFIG config) {
52
        super(config);
53
    }
54

    
55
 //************************ PUTTER / GETTER *****************************/
56

    
57
    public void putReference(String title, Reference ref){
58
        refMap.put(title, ref);
59
    }
60
    public Reference getReference(String title){
61
        return refMap.get(title);
62
    }
63

    
64
    public void putAgentBase(String title, TeamOrPersonBase<?> agent){
65
        agentMap.put(title, agent);
66
    }
67
    public TeamOrPersonBase<?> getAgentBase(String title){
68
        return agentMap.get(title);
69
    }
70

    
71
    //higher taxon
72
    public Taxon getHigherTaxon(String higherName) {
73
        return higherTaxonTaxonMap.get(higherName);
74
    }
75
    public Taxon putHigherTaxon(String higherName, Taxon taxon) {
76
        return higherTaxonTaxonMap.put(higherName, taxon);
77
    }
78
    public Taxon removeHigherTaxon(String higherName) {
79
        return higherTaxonTaxonMap.remove(higherName);
80
    }
81
    public boolean containsHigherTaxon(String higherName) {
82
        return higherTaxonTaxonMap.containsKey(higherName);
83
    }
84

    
85
    //names
86
    public void putName(String titleCache, TaxonName name){
87
        nameMap.put(titleCache, name);
88
    }
89
    public INonViralName getName(String titleCache){
90
        return nameMap.get(titleCache);
91
    }
92

    
93
    //higher taxon
94
    public Taxon getTaxon(String key) {
95
        return taxonMap.get(key);
96
    }
97
    public Taxon putTaxon(String key, Taxon taxon) {
98
        return taxonMap.put(key, taxon);
99
    }
100
    public Taxon removeTaxon(String key) {
101
        return taxonMap.remove(key);
102
    }
103
    public boolean containsTaxon(String key) {
104
        return taxonMap.containsKey(key);
105
    }
106

    
107
}
(9-9/9)