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