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