adding map to ReferenceSystem
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / specimen / excel / in / SpecimenSynthesysExcelImportConfigurator.java
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.specimen.excel.in;
11
12
13 import java.net.URI;
14 import java.util.HashMap;
15 import java.util.Map;
16 import java.util.UUID;
17
18 import org.apache.log4j.Logger;
19
20 import eu.etaxonomy.cdm.database.ICdmDataSource;
21 import eu.etaxonomy.cdm.io.common.IImportConfigurator;
22 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
23 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
24 import eu.etaxonomy.cdm.model.agent.Person;
25 import eu.etaxonomy.cdm.model.agent.Team;
26 import eu.etaxonomy.cdm.model.reference.Reference;
27 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
28
29 /**
30 * @author p.kelbert
31 * @created 29.10.2008
32 * @version 1.0
33 */
34 public class SpecimenSynthesysExcelImportConfigurator extends ImportConfiguratorBase<SpecimenSynthesysExcelImportState, URI> implements IImportConfigurator {
35 private static final Logger logger = Logger.getLogger(SpecimenSynthesysExcelImportConfigurator.class);
36 private boolean doParsing = false;
37 private boolean reuseMetadata = false;
38 private boolean reuseTaxon = false;
39 private String taxonReference = null;
40 private boolean askForDate = false;
41 private Map<String, Team> titleCacheTeam;
42 private Map<String, Person> titleCachePerson;
43 private String defaultAuthor="";
44
45 private Map<String,UUID> namedAreaDecisions = new HashMap<String,UUID>();
46 private Reference<?> dataReference;
47 private boolean debugInstitutionOnly = false;
48
49
50 /**
51 * @return the debugInstitutionOnly
52 */
53 public boolean isDebugInstitutionOnly() {
54 return debugInstitutionOnly;
55 }
56
57 //TODO
58 private static IInputTransformer defaultTransformer = null;
59
60
61 @Override
62 @SuppressWarnings("unchecked")
63 protected void makeIoClassList(){
64 ioClassList = new Class[]{
65 SpecimenSythesysExcelImport.class,
66 };
67 };
68
69 public static SpecimenSynthesysExcelImportConfigurator NewInstance(URI uri, ICdmDataSource destination){
70 return new SpecimenSynthesysExcelImportConfigurator(uri, destination);
71 }
72
73 public static SpecimenSynthesysExcelImportConfigurator NewInstance(URI uri, ICdmDataSource destination, boolean interact){
74 return new SpecimenSynthesysExcelImportConfigurator(uri, destination,interact);
75 }
76
77
78 /**
79 * @param berlinModelSource
80 * @param sourceReference
81 * @param destination
82 */
83 private SpecimenSynthesysExcelImportConfigurator(URI uri, ICdmDataSource destination) {
84 super(defaultTransformer);
85 setSource(uri);
86 setDestination(destination);
87 }
88
89
90 /**
91 * @param berlinModelSource
92 * @param sourceReference
93 * @param destination
94 */
95 private SpecimenSynthesysExcelImportConfigurator(URI uri, ICdmDataSource destination, boolean interact) {
96 super(defaultTransformer);
97 setSource(uri);
98 setDestination(destination);
99 setInteractWithUser(interact);
100 }
101
102
103
104 /* (non-Javadoc)
105 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
106 */
107 @Override
108 public SpecimenSynthesysExcelImportState getNewState() {
109 return new SpecimenSynthesysExcelImportState(this);
110 }
111
112
113 /* (non-Javadoc)
114 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
115 */
116 @Override
117 public Reference getSourceReference() {
118 //TODO
119 if (this.sourceReference == null){
120 logger.warn("getSource Reference not yet fully implemented");
121 sourceReference = ReferenceFactory.newDatabase();
122 sourceReference.setTitleCache("Specimen import", true);
123 }
124 return sourceReference;
125 }
126
127 public void setTaxonReference(String taxonReference) {
128 this.taxonReference = taxonReference;
129 }
130
131 public Reference getTaxonReference() {
132 //TODO
133 if (this.taxonReference == null){
134 logger.info("getTaxonReference not yet fully implemented");
135 }
136 return sourceReference;
137 }
138
139
140 /* (non-Javadoc)
141 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
142 */
143 @Override
144 public String getSourceNameString() {
145 if (this.getSource() == null){
146 return null;
147 }else{
148 return this.getSource().toString();
149 }
150 }
151
152 public void setDoAutomaticParsing(boolean doParsing){
153 this.doParsing=doParsing;
154 }
155
156 public boolean getDoAutomaticParsing(){
157 return this.doParsing;
158 }
159
160 public void setReUseExistingMetadata(boolean reuseMetadata){
161 this.reuseMetadata = reuseMetadata;
162 }
163
164 public boolean getReUseExistingMetadata(){
165 return this.reuseMetadata;
166 }
167
168 public void setReUseTaxon(boolean reuseTaxon){
169 this.reuseTaxon = reuseTaxon;
170 }
171
172 public boolean getDoReUseTaxon(){
173 return this.reuseTaxon;
174 }
175
176 public boolean doAskForDate() {
177 return askForDate;
178 }
179
180 public void setAskForDate(boolean askForDate) {
181 this.askForDate = askForDate;
182 }
183
184 /**
185 * @param titleCacheTeam
186 */
187 public void setTeams(Map<String, Team> titleCacheTeam) {
188 this.titleCacheTeam = titleCacheTeam;
189 System.out.println(titleCacheTeam);
190
191 }
192
193 /**
194 * @param titleCachePerson
195 */
196 public void setPersons(Map<String, Person> titleCachePerson) {
197 this.titleCachePerson=titleCachePerson;
198 System.out.println(titleCachePerson);
199
200 }
201
202 public Map<String, Team> getTeams() {
203 return titleCacheTeam;
204 }
205
206
207 public Map<String, Person> getPersons() {
208 return titleCachePerson;
209 }
210
211 /**
212 * @param string
213 */
214 public void setDefaultAuthor(String string) {
215 defaultAuthor=string;
216
217 }
218
219 public String getDefaultAuthor(){
220 return defaultAuthor;
221 }
222
223
224 public Map<String,UUID> getNamedAreaDecisions() {
225 return namedAreaDecisions;
226 }
227
228 public void setNamedAreaDecisions(Map<String,UUID> namedAreaDecisions) {
229 this.namedAreaDecisions = namedAreaDecisions;
230 }
231
232 public void putNamedAreaDecision(String areaStr,UUID uuid){
233 this.namedAreaDecisions.put(areaStr,uuid);
234 }
235
236 public UUID getNamedAreaDecision(String areaStr){
237 return namedAreaDecisions.get(areaStr);
238 }
239
240 /**
241 * @param ref
242 */
243 public void setDataReference(Reference<?> ref) {
244 this.dataReference=ref;
245
246 }
247
248 public Reference<?> getDataReference() {
249 return dataReference;
250 }
251
252 /**
253 * @param b
254 */
255 public void setDebugInstitutionOnly(boolean b) {
256 this.debugInstitutionOnly=b;
257
258 }
259
260
261
262 }