Merge branch 'release/5.1.0'
[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 * @since 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 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 private boolean downloadSequenceData = false;
75
76 private SpecimenOrObservationType type;
77
78
79 /**
80 * @return the type
81 */
82 public SpecimenOrObservationType getType() {
83 return type;
84 }
85
86 /**
87 * @param type the type to set
88 */
89 public void setType(SpecimenOrObservationType type) {
90 this.type = type;
91 }
92
93 private final SpecimenUserInteraction specimenUserInteraction = new SpecimenUserInteraction();
94
95 protected Map<String,UUID> namedAreaDecisions = new HashMap<String,UUID>();
96
97 private URI reportUri;
98
99
100 public boolean isIgnoreImportOfExistingSpecimen() {
101 return ignoreImportOfExistingSpecimen;
102 }
103
104 public void setIgnoreImportOfExistingSpecimen(boolean ignoreImportOfExistingSpecimen) {
105 this.ignoreImportOfExistingSpecimen = ignoreImportOfExistingSpecimen;
106 }
107
108 public Map<String, Team> getTitleCacheTeam() {
109 return titleCacheTeam;
110 }
111
112 public void setTitleCacheTeam(Map<String, Team> titleCacheTeam) {
113 this.titleCacheTeam = titleCacheTeam;
114 }
115
116 public Map<String, Person> getTitleCachePerson() {
117 return titleCachePerson;
118 }
119
120 public void setTitleCachePerson(Map<String, Person> titleCachePerson) {
121 this.titleCachePerson = titleCachePerson;
122 }
123
124 public OccurenceQuery getQuery() {
125 return query;
126 }
127
128 public void setQuery(OccurenceQuery query) {
129 this.query = query;
130 }
131
132
133
134
135
136 public String getTaxonReference() {
137 return taxonReference;
138 }
139
140 public void setTaxonReference(String taxonReference) {
141 this.taxonReference = taxonReference;
142 }
143
144 public boolean isAddIndividualsAssociationsSuchAsSpecimenAndObservations() {
145 return addIndividualsAssociationsSuchAsSpecimenAndObservations;
146 }
147
148 public void setAddIndividualsAssociationsSuchAsSpecimenAndObservations(
149 boolean addIndividualsAssociationsSuchAsSpecimenAndObservations) {
150 this.addIndividualsAssociationsSuchAsSpecimenAndObservations = addIndividualsAssociationsSuchAsSpecimenAndObservations;
151 }
152
153 public boolean isReuseExistingDescriptiveGroups() {
154 return reuseExistingDescriptiveGroups;
155 }
156
157 public void setReuseExistingDescriptiveGroups(boolean reuseExistingDescriptiveGroups) {
158 this.reuseExistingDescriptiveGroups = reuseExistingDescriptiveGroups;
159 }
160
161 public String getDefaultAuthor() {
162 return defaultAuthor;
163 }
164
165 public void setDefaultAuthor(String defaultAuthor) {
166 this.defaultAuthor = defaultAuthor;
167 }
168
169 public boolean isAllowReuseOtherClassifications() {
170 return allowReuseOtherClassifications;
171 }
172
173 public void setAllowReuseOtherClassifications(boolean allowReuseOtherClassifications) {
174 this.allowReuseOtherClassifications = allowReuseOtherClassifications;
175 }
176
177 public boolean isDeduplicateReferences() {
178 return deduplicateReferences;
179 }
180
181 public void setDeduplicateReferences(boolean deduplicateReferences) {
182 this.deduplicateReferences = deduplicateReferences;
183 }
184
185 public boolean isDeduplicateClassifications() {
186 return deduplicateClassifications;
187 }
188
189 public void setDeduplicateClassifications(boolean deduplicateClassifications) {
190 this.deduplicateClassifications = deduplicateClassifications;
191 }
192
193 public boolean isMoveNewTaxaToDefaultClassification() {
194 return moveNewTaxaToDefaultClassification;
195 }
196
197 public void setMoveNewTaxaToDefaultClassification(boolean moveNewTaxaToDefaultClassification) {
198 this.moveNewTaxaToDefaultClassification = moveNewTaxaToDefaultClassification;
199 }
200
201 public boolean isMapUnitIdToCatalogNumber() {
202 return mapUnitIdToCatalogNumber;
203 }
204
205 public void setMapUnitIdToCatalogNumber(boolean mapUnitIdToCatalogNumber) {
206 this.mapUnitIdToCatalogNumber = mapUnitIdToCatalogNumber;
207 }
208
209 public boolean isMapUnitIdToAccessionNumber() {
210 return mapUnitIdToAccessionNumber;
211 }
212
213 public void setMapUnitIdToAccessionNumber(boolean mapUnitIdToAccessionNumber) {
214 this.mapUnitIdToAccessionNumber = mapUnitIdToAccessionNumber;
215 }
216
217 public boolean isMapUnitIdToBarcode() {
218 return mapUnitIdToBarcode;
219 }
220
221 public void setMapUnitIdToBarcode(boolean mapUnitIdToBarcode) {
222 this.mapUnitIdToBarcode = mapUnitIdToBarcode;
223 }
224
225 public Map<String, UUID> getNamedAreaDecisions() {
226 return namedAreaDecisions;
227 }
228
229
230 public void setNamedAreaDecisions(Map<String,UUID> namedAreaDecisions) {
231 this.namedAreaDecisions = namedAreaDecisions;
232 }
233
234 public void putNamedAreaDecision(String areaStr,UUID uuid){
235 this.namedAreaDecisions.put(areaStr,uuid);
236 }
237
238 public UUID getNamedAreaDecision(String areaStr){
239 return namedAreaDecisions.get(areaStr);
240 }
241
242 public Map<UUID, UUID> getTaxonToDescriptionMap() {
243 return taxonToDescriptionMap;
244 }
245
246
247
248 public SpecimenUserInteraction getSpecimenUserInteraction() {
249 return specimenUserInteraction;
250 }
251
252 public void setReuseExistingTaxaWhenPossible(boolean reuseExistingTaxaWhenPossible) {
253 this.reuseExistingTaxaWhenPossible = reuseExistingTaxaWhenPossible;
254 }
255
256 public void setIgnoreAuthorship(boolean ignoreAuthorship) {
257 this.ignoreAuthorship = ignoreAuthorship;
258 }
259
260 public void setRemoveCountryFromLocalityText(boolean removeCountryFromLocalityText) {
261 this.removeCountryFromLocalityText = removeCountryFromLocalityText;
262 }
263
264 public void setAddMediaAsMediaSpecimen(boolean addMediaAsMediaSpecimen) {
265 this.addMediaAsMediaSpecimen = addMediaAsMediaSpecimen;
266 }
267
268 public void setOverwriteExistingSpecimens(boolean overwriteExistingSpecimens) {
269 this.overwriteExistingSpecimens = overwriteExistingSpecimens;
270 }
271
272 public boolean isOverwriteExistingSpecimens(){
273 return overwriteExistingSpecimens;
274 }
275
276
277
278
279 /**
280 * @return
281 */
282 public boolean isReuseExistingTaxaWhenPossible() {
283
284 return reuseExistingTaxaWhenPossible;
285 }
286
287 /**
288 * @param titleCacheTeam
289 */
290 public void setTeams(Map<String, Team> titleCacheTeam) {
291 this.titleCacheTeam = titleCacheTeam;
292
293 }
294
295 public Team getTeam(String titleCache){
296 return titleCacheTeam.get(titleCache);
297 }
298
299 public Map<String, Team> getTeams(){
300 return titleCacheTeam;
301 }
302 /**
303 * @param titleCachePerson
304 */
305 public void setPersons(Map<String, Person> titleCachePerson) {
306 this.titleCachePerson = titleCachePerson;
307 }
308
309 public Map<String, Person> getPersons(){
310 return titleCachePerson;
311 }
312
313 public Person getPerson(String titleCache){
314 return titleCachePerson.get(titleCache);
315 }
316
317 public boolean isAddMediaAsMediaSpecimen(){
318 return addMediaAsMediaSpecimen;
319 }
320
321 public void addMediaAsMediaSpecimen(boolean addMediaAsMediaSpecimen){
322 this.addMediaAsMediaSpecimen = addMediaAsMediaSpecimen;
323 }
324
325
326 /**
327 * @return
328 */
329 public boolean isIgnoreAuthorship() {
330 return ignoreAuthorship;
331 }
332
333 /**
334 * @return
335 */
336 public boolean isRemoveCountryFromLocalityText() {
337 return removeCountryFromLocalityText;
338 }
339
340 public OccurenceQuery getOccurenceQuery(){
341 return query;
342 }
343
344 public void setOccurenceQuery(OccurenceQuery query){
345 this.query = query;
346 }
347
348
349
350 /**
351 * @return the reuseExistingMetaData
352 */
353 public boolean isReuseExistingMetaData() {
354 return reuseExistingMetaData;
355 }
356
357 /**
358 * @param reuseExistingMetaData the reuseExistingMetaData to set
359 */
360 public void setReuseExistingMetaData(boolean reuseExistingMetaData) {
361 this.reuseExistingMetaData = reuseExistingMetaData;
362 }
363
364 public void setReportUri(URI reportUri) {
365 this.reportUri = reportUri;
366 }
367
368 public URI getReportUri() {
369 return reportUri;
370 }
371
372 @Override
373 public String getSourceReferenceTitle(){
374 return this.sourceReferenceTitle;
375 }
376
377 @Override
378 public void setSourceReferenceTitle(String name){
379 this.sourceReferenceTitle=name;
380 }
381
382 @Override
383 public boolean isValid(){
384 return true;
385 }
386
387 public boolean isDownloadSequenceData() {
388 return downloadSequenceData;
389 }
390
391 public void setDownloadSequenceData(boolean downloadSequenceData) {
392 this.downloadSequenceData = downloadSequenceData;
393 }
394
395
396
397 }