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