Cleanup
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / specimen / SpecimenImportConfiguratorBase.java
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.specimen;
10
11 import java.net.URI;
12 import java.util.HashMap;
13 import java.util.Map;
14 import java.util.UUID;
15
16 import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
17 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
18 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
19 import eu.etaxonomy.cdm.model.agent.Person;
20 import eu.etaxonomy.cdm.model.agent.Team;
21 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
22
23 /**
24 * @author k.luther
25 * @date 15.07.2016
26 *
27 */
28 public abstract class SpecimenImportConfiguratorBase<CONFIG extends SpecimenImportConfiguratorBase, STATE extends SpecimenImportStateBase<CONFIG,STATE>, InputStream>
29 extends ImportConfiguratorBase<STATE, InputStream> {
30
31 private static final long serialVersionUID = 4741134251527063988L;
32
33 /**
34 * @param transformer
35 */
36 public SpecimenImportConfiguratorBase(IInputTransformer transformer) {
37 super(transformer);
38
39 }
40
41 private boolean ignoreImportOfExistingSpecimen = true;
42 private boolean reuseExistingTaxaWhenPossible = true;
43 private final Map<UUID, UUID> taxonToDescriptionMap = new HashMap<UUID, UUID>();
44
45 private Map<String, Team> titleCacheTeam;
46 private Map<String, Person> titleCachePerson;
47 private boolean ignoreAuthorship = false;
48 private boolean removeCountryFromLocalityText = false;
49 protected OccurenceQuery query ;
50
51 private boolean addMediaAsMediaSpecimen = false;
52 private boolean reuseExistingMetaData = true;
53
54 private static String sourceReferenceTitle = null;
55
56 private String taxonReference = null;
57 private boolean addIndividualsAssociationsSuchAsSpecimenAndObservations = true;
58 private boolean reuseExistingDescriptiveGroups = false;
59
60
61 private String defaultAuthor="";
62 private boolean allowReuseOtherClassifications =true;
63
64 private boolean deduplicateReferences = false;
65 private boolean deduplicateClassifications = false;
66
67 private boolean moveNewTaxaToDefaultClassification = true;
68
69 private boolean mapUnitIdToCatalogNumber = true;
70 private boolean mapUnitIdToAccessionNumber = false;
71 private boolean mapUnitIdToBarcode = false;
72
73 private boolean overwriteExistingSpecimens = false;
74
75 private SpecimenOrObservationType type;
76
77
78 /**
79 * @return the type
80 */
81 public SpecimenOrObservationType getType() {
82 return type;
83 }
84
85 /**
86 * @param type the type to set
87 */
88 public void setType(SpecimenOrObservationType type) {
89 this.type = type;
90 }
91
92 private final SpecimenUserInteraction specimenUserInteraction = new SpecimenUserInteraction();
93
94 protected Map<String,UUID> namedAreaDecisions = new HashMap<String,UUID>();
95
96 private URI reportUri;
97
98
99 public boolean isIgnoreImportOfExistingSpecimen() {
100 return ignoreImportOfExistingSpecimen;
101 }
102
103 public void setIgnoreImportOfExistingSpecimen(boolean ignoreImportOfExistingSpecimen) {
104 this.ignoreImportOfExistingSpecimen = ignoreImportOfExistingSpecimen;
105 }
106
107 public Map<String, Team> getTitleCacheTeam() {
108 return titleCacheTeam;
109 }
110
111 public void setTitleCacheTeam(Map<String, Team> titleCacheTeam) {
112 this.titleCacheTeam = titleCacheTeam;
113 }
114
115 public Map<String, Person> getTitleCachePerson() {
116 return titleCachePerson;
117 }
118
119 public void setTitleCachePerson(Map<String, Person> titleCachePerson) {
120 this.titleCachePerson = titleCachePerson;
121 }
122
123 public OccurenceQuery getQuery() {
124 return query;
125 }
126
127 public void setQuery(OccurenceQuery query) {
128 this.query = query;
129 }
130
131
132
133
134
135 public String getTaxonReference() {
136 return taxonReference;
137 }
138
139 public void setTaxonReference(String taxonReference) {
140 this.taxonReference = taxonReference;
141 }
142
143 public boolean isAddIndividualsAssociationsSuchAsSpecimenAndObservations() {
144 return addIndividualsAssociationsSuchAsSpecimenAndObservations;
145 }
146
147 public void setAddIndividualsAssociationsSuchAsSpecimenAndObservations(
148 boolean addIndividualsAssociationsSuchAsSpecimenAndObservations) {
149 this.addIndividualsAssociationsSuchAsSpecimenAndObservations = addIndividualsAssociationsSuchAsSpecimenAndObservations;
150 }
151
152 public boolean isReuseExistingDescriptiveGroups() {
153 return reuseExistingDescriptiveGroups;
154 }
155
156 public void setReuseExistingDescriptiveGroups(boolean reuseExistingDescriptiveGroups) {
157 this.reuseExistingDescriptiveGroups = reuseExistingDescriptiveGroups;
158 }
159
160 public String getDefaultAuthor() {
161 return defaultAuthor;
162 }
163
164 public void setDefaultAuthor(String defaultAuthor) {
165 this.defaultAuthor = defaultAuthor;
166 }
167
168 public boolean isAllowReuseOtherClassifications() {
169 return allowReuseOtherClassifications;
170 }
171
172 public void setAllowReuseOtherClassifications(boolean allowReuseOtherClassifications) {
173 this.allowReuseOtherClassifications = allowReuseOtherClassifications;
174 }
175
176 public boolean isDeduplicateReferences() {
177 return deduplicateReferences;
178 }
179
180 public void setDeduplicateReferences(boolean deduplicateReferences) {
181 this.deduplicateReferences = deduplicateReferences;
182 }
183
184 public boolean isDeduplicateClassifications() {
185 return deduplicateClassifications;
186 }
187
188 public void setDeduplicateClassifications(boolean deduplicateClassifications) {
189 this.deduplicateClassifications = deduplicateClassifications;
190 }
191
192 public boolean isMoveNewTaxaToDefaultClassification() {
193 return moveNewTaxaToDefaultClassification;
194 }
195
196 public void setMoveNewTaxaToDefaultClassification(boolean moveNewTaxaToDefaultClassification) {
197 this.moveNewTaxaToDefaultClassification = moveNewTaxaToDefaultClassification;
198 }
199
200 public boolean isMapUnitIdToCatalogNumber() {
201 return mapUnitIdToCatalogNumber;
202 }
203
204 public void setMapUnitIdToCatalogNumber(boolean mapUnitIdToCatalogNumber) {
205 this.mapUnitIdToCatalogNumber = mapUnitIdToCatalogNumber;
206 }
207
208 public boolean isMapUnitIdToAccessionNumber() {
209 return mapUnitIdToAccessionNumber;
210 }
211
212 public void setMapUnitIdToAccessionNumber(boolean mapUnitIdToAccessionNumber) {
213 this.mapUnitIdToAccessionNumber = mapUnitIdToAccessionNumber;
214 }
215
216 public boolean isMapUnitIdToBarcode() {
217 return mapUnitIdToBarcode;
218 }
219
220 public void setMapUnitIdToBarcode(boolean mapUnitIdToBarcode) {
221 this.mapUnitIdToBarcode = mapUnitIdToBarcode;
222 }
223
224 public Map<String, UUID> getNamedAreaDecisions() {
225 return namedAreaDecisions;
226 }
227
228
229 public void setNamedAreaDecisions(Map<String,UUID> namedAreaDecisions) {
230 this.namedAreaDecisions = namedAreaDecisions;
231 }
232
233 public void putNamedAreaDecision(String areaStr,UUID uuid){
234 this.namedAreaDecisions.put(areaStr,uuid);
235 }
236
237 public UUID getNamedAreaDecision(String areaStr){
238 return namedAreaDecisions.get(areaStr);
239 }
240
241 public Map<UUID, UUID> getTaxonToDescriptionMap() {
242 return taxonToDescriptionMap;
243 }
244
245
246
247 public SpecimenUserInteraction getSpecimenUserInteraction() {
248 return specimenUserInteraction;
249 }
250
251 public void setReuseExistingTaxaWhenPossible(boolean reuseExistingTaxaWhenPossible) {
252 this.reuseExistingTaxaWhenPossible = reuseExistingTaxaWhenPossible;
253 }
254
255 public void setIgnoreAuthorship(boolean ignoreAuthorship) {
256 this.ignoreAuthorship = ignoreAuthorship;
257 }
258
259 public void setRemoveCountryFromLocalityText(boolean removeCountryFromLocalityText) {
260 this.removeCountryFromLocalityText = removeCountryFromLocalityText;
261 }
262
263 public void setAddMediaAsMediaSpecimen(boolean addMediaAsMediaSpecimen) {
264 this.addMediaAsMediaSpecimen = addMediaAsMediaSpecimen;
265 }
266
267 public void setOverwriteExistingSpecimens(boolean overwriteExistingSpecimens) {
268 this.overwriteExistingSpecimens = overwriteExistingSpecimens;
269 }
270
271 public boolean isOverwriteExistingSpecimens(){
272 return overwriteExistingSpecimens;
273 }
274
275
276
277
278 /**
279 * @return
280 */
281 public boolean isReuseExistingTaxaWhenPossible() {
282
283 return reuseExistingTaxaWhenPossible;
284 }
285
286 /**
287 * @param titleCacheTeam
288 */
289 public void setTeams(Map<String, Team> titleCacheTeam) {
290 this.titleCacheTeam = titleCacheTeam;
291
292 }
293
294 public Team getTeam(String titleCache){
295 return titleCacheTeam.get(titleCache);
296 }
297
298 public Map<String, Team> getTeams(){
299 return titleCacheTeam;
300 }
301 /**
302 * @param titleCachePerson
303 */
304 public void setPersons(Map<String, Person> titleCachePerson) {
305 this.titleCachePerson = titleCachePerson;
306 }
307
308 public Map<String, Person> getPersons(){
309 return titleCachePerson;
310 }
311
312 public Person getPerson(String titleCache){
313 return titleCachePerson.get(titleCache);
314 }
315
316 public boolean isAddMediaAsMediaSpecimen(){
317 return addMediaAsMediaSpecimen;
318 }
319
320 public void addMediaAsMediaSpecimen(boolean addMediaAsMediaSpecimen){
321 this.addMediaAsMediaSpecimen = addMediaAsMediaSpecimen;
322 }
323
324
325 /**
326 * @return
327 */
328 public boolean isIgnoreAuthorship() {
329 return ignoreAuthorship;
330 }
331
332 /**
333 * @return
334 */
335 public boolean isRemoveCountryFromLocalityText() {
336 return removeCountryFromLocalityText;
337 }
338
339 public OccurenceQuery getOccurenceQuery(){
340 return query;
341 }
342
343 public void setOccurenceQuery(OccurenceQuery query){
344 this.query = query;
345 }
346
347
348
349 /**
350 * @return the reuseExistingMetaData
351 */
352 public boolean isReuseExistingMetaData() {
353 return reuseExistingMetaData;
354 }
355
356 /**
357 * @param reuseExistingMetaData the reuseExistingMetaData to set
358 */
359 public void setReuseExistingMetaData(boolean reuseExistingMetaData) {
360 this.reuseExistingMetaData = reuseExistingMetaData;
361 }
362
363 public void setReportUri(URI reportUri) {
364 this.reportUri = reportUri;
365 }
366
367 public URI getReportUri() {
368 return reportUri;
369 }
370
371 @Override
372 public String getSourceReferenceTitle(){
373 return this.sourceReferenceTitle;
374 }
375
376 @Override
377 public void setSourceReferenceTitle(String name){
378 this.sourceReferenceTitle=name;
379 }
380
381 @Override
382 public boolean isValid(){
383 return true;
384 }
385
386
387
388 }