Project

General

Profile

Download (3.68 KB) Statistics
| Branch: | Tag: | Revision:
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

    
10
package eu.etaxonomy.cdm.io.excel.taxa;
11

    
12
import java.util.HashMap;
13
import java.util.HashSet;
14
import java.util.Map;
15
import java.util.Set;
16

    
17
import org.apache.log4j.Logger;
18

    
19
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
20
import eu.etaxonomy.cdm.io.excel.common.ExcelImportState;
21
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
22
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
23
import eu.etaxonomy.cdm.model.name.TaxonName;
24
import eu.etaxonomy.cdm.model.reference.Reference;
25
import eu.etaxonomy.cdm.model.taxon.Classification;
26
import eu.etaxonomy.cdm.model.taxon.Taxon;
27
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
28

    
29
/**
30
 * @author a.mueller
31
 * @created 11.05.2009
32
 */
33
public class TaxonExcelImportState
34
            extends ExcelImportState<ExcelImportConfiguratorBase, ExcelRowBase>{
35

    
36
    @SuppressWarnings("unused")
37
	private static final Logger logger = Logger.getLogger(TaxonExcelImportState.class);
38

    
39
    /** Already processed authors */
40
	private Set<String> authors = new HashSet<String>();
41

    
42
	private Map<String, TaxonBase> taxonMap= new HashMap<String, TaxonBase>();
43
	/**
44
     * @return the taxonMap
45
     */
46
    public Map<String, TaxonBase> getTaxonMap() {
47
        return taxonMap;
48
    }
49

    
50
    /**
51
     * @param taxonMap the taxonMap to set
52
     */
53
    public void setTaxonMap(Map<String, TaxonBase> taxonMap) {
54
        this.taxonMap = taxonMap;
55
    }
56

    
57
    private Map<String, TeamOrPersonBase> authorMap= new HashMap<String, TeamOrPersonBase>();
58
	private Map<String, TaxonName> nameMap;
59
	private Map<String, Reference> referenceMap= new HashMap<String, Reference>();
60
	private Taxon parent;
61
	private Classification classification;
62

    
63

    
64

    
65
	public TaxonExcelImportState(ExcelImportConfiguratorBase config) {
66
		super(config);
67
	}
68

    
69
	/**
70
	 * @return the author
71
	 */
72
	public Set<String> getAuthors() {
73
		return authors;
74
	}
75

    
76
	/**
77
	 * @param author the author to set
78
	 */
79
	public void setAuthors(Set<String> authors) {
80
		this.authors = authors;
81
	}
82

    
83
	public Taxon getParent(){
84
	    return parent;
85
	}
86

    
87
	public void setParent(Taxon parent){
88
	    this.parent = parent;
89
    }
90

    
91
	/**
92
	 * @param parentId
93
	 * @return
94
	 */
95
	public TaxonBase getTaxonBase(String taxonId) {
96
		return taxonMap.get(taxonId);
97
	}
98

    
99

    
100
	/**
101
	 * @param parentId
102
	 * @param taxon
103
	 */
104
	public void putTaxon(String taxonId, TaxonBase taxonBase) {
105

    
106

    
107
	    taxonMap.put(taxonId, taxonBase);
108
	}
109

    
110
    /**
111
     * @return the classification
112
     */
113
    public Classification getClassification() {
114
        return classification;
115
    }
116

    
117
    /**
118
     * @param classification the classification to set
119
     */
120
    public void setClassification(Classification classification) {
121
        this.classification = classification;
122
    }
123

    
124
    public Reference getReference(String key) {
125
        return referenceMap.get(key);
126
    }
127

    
128
    public void putReference(String key, Reference reference) {
129
        this.referenceMap.put(key, reference);
130
    }
131

    
132
    public Map<String, TaxonName> getNameMap() {
133
        return nameMap;
134
    }
135

    
136
    public void setNameMap(Map<String, TaxonName> nameMap) {
137
        this.nameMap = nameMap;
138
    }
139

    
140
    /**
141
     * @param name
142
     * @param name2
143
     */
144
    public void putName(String titleCache, TaxonName name) {
145
        if (nameMap == null){
146
            nameMap = new HashMap<String, TaxonName>();
147
        }
148

    
149
        nameMap.put(titleCache, name);
150
    }
151

    
152

    
153

    
154
}
(5-5/5)