Project

General

Profile

Download (2.74 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.reference.Reference;
22
import eu.etaxonomy.cdm.model.taxon.Taxon;
23

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

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

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

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

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

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

    
44

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

    
53
 //************************ PUTTER / GETTER *****************************/
54
    public void putReference(String title, Reference ref){
55
        refMap.put(title, ref);
56
    }
57
    public Reference getReference(String title){
58
        return refMap.get(title);
59
    }
60

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

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

    
82
    //names
83
    public void putName(String titleCache, INonViralName name){
84
        nameMap.put(titleCache, name);
85
    }
86
    public INonViralName getName(String titleCache){
87
        return nameMap.get(titleCache);
88
    }
89

    
90
}
(9-9/9)