Unifiy name and taxon creation
[cdmlib-apps.git] / app-import / src / main / java / eu / etaxonomy / cdm / io / cuba / CubaImportState.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.cdm.io.cuba;
12
13 import java.util.HashMap;
14 import java.util.Map;
15 import java.util.UUID;
16
17 import org.apache.log4j.Logger;
18
19 import eu.etaxonomy.cdm.io.excel.common.ExcelImportState;
20 import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
21 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
22 import eu.etaxonomy.cdm.model.name.BotanicalName;
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.TaxonNode;
27
28 /**
29 * @author a.mueller
30 * @created 11.05.2009
31 */
32 public class CubaImportState extends ExcelImportState<CubaImportConfigurator, ExcelRowBase>{
33 @SuppressWarnings("unused")
34 private static final Logger logger = Logger.getLogger(CubaImportState.class);
35
36 private final Map<String, Taxon> higherTaxonTaxonMap = new HashMap<String, Taxon>();
37
38 private final Map<String, UUID> higherTaxonUuidMap = new HashMap<String, UUID>();
39
40 private final Map<String, BotanicalName> familyNameMap = new HashMap<String, BotanicalName>();
41
42
43
44 //classification
45 private Classification classification;
46 public Classification getClassification() {return classification;}
47 public void setClassification(Classification classification) {this.classification = classification;}
48
49 //current taxon
50 private Taxon currentTaxon;
51 public Taxon getCurrentTaxon() {return currentTaxon;}
52 public void setCurrentTaxon(Taxon currentTaxon) {this.currentTaxon = currentTaxon;}
53
54 //rootNode
55 private TaxonNode rootNode;
56 public void setRootNode(TaxonNode rootNode) {this.rootNode = rootNode;}
57 public TaxonNode getRootNode() { return rootNode;}
58
59 private Reference<?> secReference;
60 public Reference<?> getSecReference() {return secReference;}
61 public void setSecReference(Reference<?> secReference) {this.secReference = secReference;}
62
63 private PresenceAbsenceTerm highestStatusForTaxon;
64 public PresenceAbsenceTerm getHighestStatusForTaxon(){return highestStatusForTaxon;}
65 public void setHighestStatusForTaxon(PresenceAbsenceTerm highestStatusForTaxon){this.highestStatusForTaxon = highestStatusForTaxon;}
66
67 private boolean isCubanProvince;
68 public void setCubanProvince(boolean cubanProvince) {this.isCubanProvince = cubanProvince;}
69 public boolean isCubanProvince(){return isCubanProvince;}
70
71 //Constructor
72 public CubaImportState(CubaImportConfigurator config) {
73 super(config);
74 }
75
76
77 //higher taxon
78 public Taxon getHigherTaxon(String higherName) {
79 return higherTaxonTaxonMap.get(higherName);
80 }
81 public Taxon putHigherTaxon(String higherName, Taxon taxon) {
82 return higherTaxonTaxonMap.put(higherName, taxon);
83 }
84 public Taxon removeHigherTaxon(String higherName) {
85 return higherTaxonTaxonMap.remove(higherName);
86 }
87 public boolean containsHigherTaxon(String higherName) {
88 return higherTaxonTaxonMap.containsKey(higherName);
89 }
90
91 //higher taxon uuid
92 public UUID getHigherTaxonUuid(String higherName) {
93 return higherTaxonUuidMap.get(higherName);
94 }
95 public UUID putHigherTaxon(String higherName, UUID uuid) {
96 return higherTaxonUuidMap.put(higherName, uuid);
97 }
98 public UUID removeHigherTaxonUuid(String higherName) {
99 return higherTaxonUuidMap.remove(higherName);
100 }
101 public boolean containsHigherTaxonUuid(String higherName) {
102 return higherTaxonUuidMap.containsKey(higherName);
103 }
104
105 //family names
106 public BotanicalName getFamilyName(String familyStr) {
107 return familyNameMap.get(familyStr);
108 }
109 public void putFamilyName(String familyStr, BotanicalName name) {
110 familyNameMap.put(familyStr, name);
111 }
112
113
114 Map<UUID, Reference<?>> refMap = new HashMap<UUID, Reference<?>>();
115 //reference
116 public Reference<?> getReference(UUID uuidRef) {
117 return refMap.get(uuidRef);
118 }
119 public void putReference(UUID uuidRef, Reference<?> ref) {
120 refMap.put(uuidRef, ref);
121 }
122
123
124
125 }