1
|
/**
|
2
|
* Copyright (C) 2007 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.excel.taxa;
|
10
|
|
11
|
import java.util.HashMap;
|
12
|
import java.util.HashSet;
|
13
|
import java.util.Map;
|
14
|
import java.util.Set;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
|
19
|
import eu.etaxonomy.cdm.io.excel.common.ExcelImportState;
|
20
|
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
|
21
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
22
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
23
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
24
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
25
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
26
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
27
|
|
28
|
/**
|
29
|
* @author a.mueller
|
30
|
* @since 11.05.2009
|
31
|
*/
|
32
|
public class TaxonExcelImportState
|
33
|
extends ExcelImportState<ExcelImportConfiguratorBase, ExcelRowBase>{
|
34
|
|
35
|
@SuppressWarnings("unused")
|
36
|
private static final Logger logger = Logger.getLogger(TaxonExcelImportState.class);
|
37
|
|
38
|
/** Already processed authors */
|
39
|
private Set<String> authors = new HashSet<>();
|
40
|
|
41
|
private Map<String, TaxonBase> taxonMap= new HashMap<String, TaxonBase>();
|
42
|
/**
|
43
|
* @return the taxonMap
|
44
|
*/
|
45
|
public Map<String, TaxonBase> getTaxonMap() {
|
46
|
return taxonMap;
|
47
|
}
|
48
|
|
49
|
/**
|
50
|
* @param taxonMap the taxonMap to set
|
51
|
*/
|
52
|
public void setTaxonMap(Map<String, TaxonBase> taxonMap) {
|
53
|
this.taxonMap = taxonMap;
|
54
|
}
|
55
|
|
56
|
private Map<String, TeamOrPersonBase> authorMap= new HashMap<String, TeamOrPersonBase>();
|
57
|
private Map<String, TaxonName> nameMap;
|
58
|
private Map<String, Reference> referenceMap= new HashMap<String, Reference>();
|
59
|
private Taxon parent;
|
60
|
private Classification classification;
|
61
|
|
62
|
public TaxonExcelImportState(ExcelImportConfiguratorBase config) {
|
63
|
super(config);
|
64
|
}
|
65
|
|
66
|
public Set<String> getAuthors() {
|
67
|
return authors;
|
68
|
}
|
69
|
public void setAuthors(Set<String> authors) {
|
70
|
this.authors = authors;
|
71
|
}
|
72
|
|
73
|
public Taxon getParent(){
|
74
|
return parent;
|
75
|
}
|
76
|
public void setParent(Taxon parent){
|
77
|
this.parent = parent;
|
78
|
}
|
79
|
|
80
|
public TaxonBase getTaxonBase(String taxonId) {
|
81
|
return taxonMap.get(taxonId);
|
82
|
}
|
83
|
|
84
|
public void putTaxon(String taxonId, TaxonBase taxonBase) {
|
85
|
taxonMap.put(taxonId, taxonBase);
|
86
|
}
|
87
|
|
88
|
public Classification getClassification() {
|
89
|
return classification;
|
90
|
}
|
91
|
public void setClassification(Classification classification) {
|
92
|
this.classification = classification;
|
93
|
}
|
94
|
|
95
|
public Reference getReference(String key) {
|
96
|
return referenceMap.get(key);
|
97
|
}
|
98
|
|
99
|
public void putReference(String key, Reference reference) {
|
100
|
this.referenceMap.put(key, reference);
|
101
|
}
|
102
|
|
103
|
public Map<String, TaxonName> getNameMap() {
|
104
|
return nameMap;
|
105
|
}
|
106
|
|
107
|
public void setNameMap(Map<String, TaxonName> nameMap) {
|
108
|
this.nameMap = nameMap;
|
109
|
}
|
110
|
|
111
|
public void putName(String titleCache, TaxonName name) {
|
112
|
if (nameMap == null){
|
113
|
nameMap = new HashMap<>();
|
114
|
}
|
115
|
nameMap.put(titleCache, name);
|
116
|
}
|
117
|
}
|