Project

General

Profile

Download (2.79 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 eu.etaxonomy.cdm.model.taxon.Classification;
15
import org.apache.log4j.Logger;
16

    
17
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
18
import eu.etaxonomy.cdm.io.excel.common.ExcelImportState;
19
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
20
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
21
import eu.etaxonomy.cdm.model.name.NonViralName;
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 Map<String, Reference> refMap = new HashMap<>();
37

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

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

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

    
45

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

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

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

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

    
83
    //names
84
    public void putName(String titleCache, NonViralName<?> name){
85
        nameMap.put(titleCache, name);
86
    }
87
    public NonViralName<?> getName(String titleCache){
88
        return nameMap.get(titleCache);
89
    }
90

    
91
}
(9-9/9)