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