1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.cdm.io.dwca.out;
|
11
|
|
12
|
import java.io.File;
|
13
|
import java.util.ArrayList;
|
14
|
import java.util.List;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
|
18
|
|
19
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
20
|
import eu.etaxonomy.cdm.io.common.ExportResultType;
|
21
|
import eu.etaxonomy.cdm.io.common.XmlExportConfiguratorBase;
|
22
|
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
* @since 18.04.2011
|
27
|
*/
|
28
|
public class DwcaTaxExportConfigurator extends XmlExportConfiguratorBase<DwcaTaxExportState> {
|
29
|
|
30
|
private static final long serialVersionUID = -464609596078614735L;
|
31
|
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = LogManager.getLogger(DwcaTaxExportConfigurator.class);
|
34
|
|
35
|
private String encoding = "UTF-8";
|
36
|
private String linesTerminatedBy = "\r\n";
|
37
|
private String fieldsEnclosedBy = "\"";
|
38
|
private boolean hasHeaderLines = true;
|
39
|
private String fieldsTerminatedBy=",";
|
40
|
|
41
|
|
42
|
private boolean doTaxa = true;
|
43
|
private boolean doResourceRelation = true;
|
44
|
private boolean doTypesAndSpecimen = true;
|
45
|
private boolean doVernacularNames = true;
|
46
|
private boolean doReferences = true;
|
47
|
private boolean doDescriptions = true;
|
48
|
private boolean doDistributions = true;
|
49
|
private boolean doImages = true;
|
50
|
private boolean doMetaData = true;
|
51
|
private boolean doEml = true;
|
52
|
|
53
|
private boolean doSynonyms = true;
|
54
|
private boolean doMisappliedNames = true;
|
55
|
|
56
|
private boolean isUseIdWherePossible = false;
|
57
|
|
58
|
private boolean includeBasionymsInResourceRelations;
|
59
|
private boolean includeMisappliedNamesInResourceRelations;
|
60
|
|
61
|
private String defaultBibliographicCitation = null;
|
62
|
|
63
|
private DwcaEmlRecord emlRecord;
|
64
|
|
65
|
private List<UUID> featureExclusions = new ArrayList<>();
|
66
|
|
67
|
|
68
|
|
69
|
private String defaultTaxonSource;
|
70
|
|
71
|
private boolean withHigherClassification = false;
|
72
|
|
73
|
private String setSeparator = ";";
|
74
|
|
75
|
//TODO
|
76
|
private static DwcaTaxExportTransformer defaultTransformer = null;
|
77
|
|
78
|
|
79
|
public static DwcaTaxExportConfigurator NewInstance(ICdmDataSource source, File destinationFolder, DwcaEmlRecord emlRecord) {
|
80
|
return new DwcaTaxExportConfigurator(source, destinationFolder, emlRecord);
|
81
|
}
|
82
|
|
83
|
|
84
|
@Override
|
85
|
@SuppressWarnings("unchecked")
|
86
|
protected void makeIoClassList() {
|
87
|
ioClassList = new Class[] {
|
88
|
DwcaTaxExport.class
|
89
|
,DwcaMetaDataExport.class
|
90
|
,DwcaEmlExport.class
|
91
|
,DwcaResultWriter.class
|
92
|
};
|
93
|
}
|
94
|
|
95
|
|
96
|
/**
|
97
|
* @param url
|
98
|
* @param destination
|
99
|
*/
|
100
|
private DwcaTaxExportConfigurator(ICdmDataSource source, File destination, DwcaEmlRecord emlRecord) {
|
101
|
super(destination, source, defaultTransformer);
|
102
|
this.resultType = ExportResultType.MAP_BYTE_ARRAY;
|
103
|
this.emlRecord = emlRecord;
|
104
|
this.setDestination(destination);
|
105
|
this.setSource(source);
|
106
|
this.setUserFriendlyIOName("DwC-A Export");
|
107
|
}
|
108
|
|
109
|
@Override
|
110
|
public File getDestination() {
|
111
|
return super.getDestination();
|
112
|
}
|
113
|
|
114
|
@Override
|
115
|
public void setDestination(File fileName) {
|
116
|
super.setDestination(fileName);
|
117
|
}
|
118
|
|
119
|
@Override
|
120
|
public String getDestinationNameString() {
|
121
|
if (this.getDestination() == null) {
|
122
|
return null;
|
123
|
} else {
|
124
|
return this.getDestination().toString();
|
125
|
}
|
126
|
}
|
127
|
|
128
|
@Override
|
129
|
public DwcaTaxExportState getNewState() {
|
130
|
return new DwcaTaxExportState(this);
|
131
|
}
|
132
|
|
133
|
public boolean isDoTaxa() {
|
134
|
return doTaxa;
|
135
|
}
|
136
|
public void setDoTaxa(boolean doTaxa) {
|
137
|
this.doTaxa = doTaxa;
|
138
|
}
|
139
|
|
140
|
public boolean isDoResourceRelation() {
|
141
|
return doResourceRelation;
|
142
|
}
|
143
|
public void setDoResourceRelations(boolean doResourceRelation) {
|
144
|
this.doResourceRelation = doResourceRelation;
|
145
|
}
|
146
|
|
147
|
public boolean isDoTypesAndSpecimen() {
|
148
|
return doTypesAndSpecimen;
|
149
|
}
|
150
|
public void setDoTypesAndSpecimen(boolean doTypesAndSpecimen) {
|
151
|
this.doTypesAndSpecimen = doTypesAndSpecimen;
|
152
|
}
|
153
|
|
154
|
public boolean isDoVernacularNames() {
|
155
|
return doVernacularNames;
|
156
|
}
|
157
|
public void setDoVernacularNames(boolean doVernacularNames) {
|
158
|
this.doVernacularNames = doVernacularNames;
|
159
|
}
|
160
|
|
161
|
public boolean isDoReferences() {
|
162
|
return doReferences;
|
163
|
}
|
164
|
public void setDoReferences(boolean doReferences) {
|
165
|
this.doReferences = doReferences;
|
166
|
}
|
167
|
|
168
|
public boolean isDoDescriptions() {
|
169
|
return doDescriptions;
|
170
|
}
|
171
|
public void setDoDescriptions(boolean doDescriptions) {
|
172
|
this.doDescriptions = doDescriptions;
|
173
|
}
|
174
|
|
175
|
public boolean isDoDistributions() {
|
176
|
return doDistributions;
|
177
|
}
|
178
|
public void setDoDistributions(boolean doDistributions) {
|
179
|
this.doDistributions = doDistributions;
|
180
|
}
|
181
|
|
182
|
public boolean isDoImages() {
|
183
|
return doImages;
|
184
|
}
|
185
|
public void setDoImages(boolean doImages) {
|
186
|
this.doImages = doImages;
|
187
|
}
|
188
|
|
189
|
public void setFeatureExclusions(List<UUID> featureExclusions) {
|
190
|
this.featureExclusions = featureExclusions;
|
191
|
}
|
192
|
public List<UUID> getFeatureExclusions() {
|
193
|
return featureExclusions;
|
194
|
}
|
195
|
|
196
|
public String getEncoding() {
|
197
|
return encoding;
|
198
|
}
|
199
|
public void setEncoding(String encoding) {
|
200
|
this.encoding = encoding;
|
201
|
}
|
202
|
|
203
|
public String getLinesTerminatedBy() {
|
204
|
return linesTerminatedBy;
|
205
|
}
|
206
|
public void setLinesTerminatedBy(String linesTerminatedBy) {
|
207
|
this.linesTerminatedBy = linesTerminatedBy;
|
208
|
}
|
209
|
|
210
|
public String getFieldsEnclosedBy() {
|
211
|
return fieldsEnclosedBy;
|
212
|
}
|
213
|
public void setFieldsEnclosedBy(String fieldsEnclosedBy) {
|
214
|
this.fieldsEnclosedBy = fieldsEnclosedBy;
|
215
|
}
|
216
|
|
217
|
/**
|
218
|
* Equals darwin core archive ignoreHeaderLines attribute.
|
219
|
* <code>true</code> by default.
|
220
|
* @return
|
221
|
*/
|
222
|
public boolean isHasHeaderLines() {
|
223
|
return hasHeaderLines;
|
224
|
}
|
225
|
public void setHasHeaderLines(boolean hasHeaderLines) {
|
226
|
this.hasHeaderLines = hasHeaderLines;
|
227
|
}
|
228
|
|
229
|
public boolean isIncludeBasionymsInResourceRelations() {
|
230
|
return includeBasionymsInResourceRelations;
|
231
|
}
|
232
|
public void setIncludeBasionymsInResourceRelations(boolean includeBasionymsInResourceRelations) {
|
233
|
this.includeBasionymsInResourceRelations = includeBasionymsInResourceRelations;
|
234
|
}
|
235
|
|
236
|
public boolean isIncludeMisappliedNamesInResourceRelations() {
|
237
|
return includeMisappliedNamesInResourceRelations;
|
238
|
}
|
239
|
public void setIncludeMisappliedNamesInResourceRelations(boolean includeMisappliedNamesInResourceRelations) {
|
240
|
this.includeMisappliedNamesInResourceRelations = includeMisappliedNamesInResourceRelations;
|
241
|
}
|
242
|
|
243
|
public void setDoMetaData(boolean doMetaData) {
|
244
|
this.doMetaData = doMetaData;
|
245
|
}
|
246
|
public boolean isDoMetaData() {
|
247
|
return doMetaData;
|
248
|
}
|
249
|
|
250
|
public boolean isUseIdWherePossible() {
|
251
|
return this.isUseIdWherePossible;
|
252
|
}
|
253
|
public void setUseIdWherePossible(boolean isUseIdWherePossible) {
|
254
|
this.isUseIdWherePossible = isUseIdWherePossible;
|
255
|
}
|
256
|
|
257
|
public void setEmlRecord(DwcaEmlRecord emlRecord) {
|
258
|
this.emlRecord = emlRecord;
|
259
|
}
|
260
|
public DwcaEmlRecord getEmlRecord() {
|
261
|
return emlRecord;
|
262
|
}
|
263
|
|
264
|
public void setDoEml(boolean doEml) {
|
265
|
this.doEml = doEml;
|
266
|
}
|
267
|
public boolean isDoEml() {
|
268
|
return doEml;
|
269
|
}
|
270
|
|
271
|
|
272
|
public void setDefaultBibliographicCitation(String defaultBibliographicCitation) {
|
273
|
this.defaultBibliographicCitation = defaultBibliographicCitation;
|
274
|
}
|
275
|
public String getDefaultBibliographicCitation() {
|
276
|
return defaultBibliographicCitation;
|
277
|
}
|
278
|
|
279
|
|
280
|
/**
|
281
|
* The default value for the taxon.source column. This may be a column linking to a url that provides
|
282
|
* data about the given taxon. The id is replaced by a placeholder,
|
283
|
* e.g. http://wp6-cichorieae.e-taxonomy.eu/portal/?q=cdm_dataportal/taxon/{id}.
|
284
|
* NOTE: This may be replaced in future versions by concrete CDM server implementations.
|
285
|
*
|
286
|
* @return the taxonSourceDefault
|
287
|
*/
|
288
|
public String getDefaultTaxonSource() {
|
289
|
return defaultTaxonSource;
|
290
|
}
|
291
|
public void setDefaultTaxonSource(String taxonSourceDefault) {
|
292
|
this.defaultTaxonSource = taxonSourceDefault;
|
293
|
}
|
294
|
|
295
|
|
296
|
public boolean isWithHigherClassification() {
|
297
|
return withHigherClassification;
|
298
|
}
|
299
|
public void setWithHigherClassification(boolean withHigherClassification) {
|
300
|
this.withHigherClassification = withHigherClassification;
|
301
|
}
|
302
|
|
303
|
public String getSetSeparator() {
|
304
|
return setSeparator;
|
305
|
}
|
306
|
public void setSetSeparator(String setSeparator) {
|
307
|
this.setSeparator = setSeparator;
|
308
|
}
|
309
|
|
310
|
public void setFieldsTerminatedBy(String fieldsTerminatedBy) {
|
311
|
this.fieldsTerminatedBy = fieldsTerminatedBy;
|
312
|
}
|
313
|
public String getFieldsTerminatedBy() {
|
314
|
return fieldsTerminatedBy;
|
315
|
}
|
316
|
|
317
|
|
318
|
public boolean isDoSynonyms() {
|
319
|
return doSynonyms;
|
320
|
}
|
321
|
public void setDoSynonyms(boolean doSynonyms) {
|
322
|
this.doSynonyms = doSynonyms;
|
323
|
}
|
324
|
|
325
|
public boolean isDoMisappliedNames() {
|
326
|
return doMisappliedNames;
|
327
|
}
|
328
|
public void setDoMisappliedNames(boolean doMisappliedNames) {
|
329
|
this.doMisappliedNames = doMisappliedNames;
|
330
|
}
|
331
|
|
332
|
}
|