1
|
/**
|
2
|
* Copyright (C) 2008 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.jaxb;
|
11
|
|
12
|
import java.io.File;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
|
16
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
17
|
import eu.etaxonomy.cdm.io.common.ExportConfiguratorBase;
|
18
|
import eu.etaxonomy.cdm.io.common.ExportResultType;
|
19
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
|
20
|
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
|
21
|
|
22
|
/**
|
23
|
* @author a.babadshanjan
|
24
|
* @since 03.09.2008
|
25
|
*/
|
26
|
public class JaxbExportConfigurator
|
27
|
extends ExportConfiguratorBase<JaxbExportState, IExportTransformer, File>
|
28
|
implements IExportConfigurator<JaxbExportState, IExportTransformer> {
|
29
|
|
30
|
private static final long serialVersionUID = -3081392679701925440L;
|
31
|
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = Logger.getLogger(JaxbExportConfigurator.class);
|
34
|
|
35
|
private int maxRows = 0;
|
36
|
private boolean formattedOutput = Boolean.TRUE;
|
37
|
private String encoding = "UTF-8";
|
38
|
|
39
|
private boolean doUsers = true;
|
40
|
private boolean doAgentData = true;
|
41
|
private boolean doLanguageData = true;
|
42
|
private boolean doFeatureData = true;
|
43
|
private boolean doDescriptions = true;
|
44
|
private boolean doMedia = true;
|
45
|
private boolean doOccurrence = true;
|
46
|
// private boolean doReferences = true;
|
47
|
private boolean doReferencedEntities = true;
|
48
|
// private boolean doRelationships = true;
|
49
|
private boolean doSynonyms = true;
|
50
|
// private boolean doTaxonNames = true;
|
51
|
// private boolean doTaxa = true;
|
52
|
private boolean doTerms = true;
|
53
|
private boolean doTermVocabularies = true;
|
54
|
private boolean doHomotypicalGroups = true;
|
55
|
|
56
|
private boolean doTypeDesignations = true;
|
57
|
private boolean doClassificationData = true;
|
58
|
|
59
|
//TODO
|
60
|
private static IExportTransformer defaultTransformer = null;
|
61
|
|
62
|
/**
|
63
|
*
|
64
|
*/
|
65
|
public JaxbExportConfigurator() {
|
66
|
super(null);
|
67
|
this.setResultType(ExportResultType.BYTE_ARRAY);
|
68
|
}
|
69
|
|
70
|
/* (non-Javadoc)
|
71
|
* @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
|
72
|
*/
|
73
|
@Override
|
74
|
public JaxbExportState getNewState() {
|
75
|
return new JaxbExportState(this);
|
76
|
}
|
77
|
|
78
|
public int getMaxRows() {
|
79
|
return maxRows;
|
80
|
}
|
81
|
|
82
|
public void setMaxRows(int maxRows) {
|
83
|
this.maxRows = maxRows;
|
84
|
}
|
85
|
|
86
|
public boolean isFormattedOutput() {
|
87
|
return formattedOutput;
|
88
|
}
|
89
|
|
90
|
public void setFormattedOutput(boolean formattedOutput) {
|
91
|
this.formattedOutput = formattedOutput;
|
92
|
}
|
93
|
|
94
|
public String getEncoding() {
|
95
|
return encoding;
|
96
|
}
|
97
|
|
98
|
public void setEncoding(String encoding) {
|
99
|
this.encoding = encoding;
|
100
|
}
|
101
|
|
102
|
public boolean isDoAgentData() {
|
103
|
return doAgentData;
|
104
|
}
|
105
|
|
106
|
public void setDoAgentData(boolean doAgentData) {
|
107
|
this.doAgentData = doAgentData;
|
108
|
}
|
109
|
|
110
|
public boolean isDoLanguageData() {
|
111
|
return doLanguageData;
|
112
|
}
|
113
|
|
114
|
|
115
|
public void setDoLanguageData(boolean doLanguageData) {
|
116
|
this.doLanguageData = doLanguageData;
|
117
|
}
|
118
|
|
119
|
public boolean isDoFeatureData() {
|
120
|
return doFeatureData;
|
121
|
}
|
122
|
|
123
|
public void setDoFeatureData(boolean doFeatureData) {
|
124
|
this.doFeatureData = doFeatureData;
|
125
|
}
|
126
|
|
127
|
public boolean isDoClassificationData() {
|
128
|
return doClassificationData;
|
129
|
}
|
130
|
public void setDoClassificationData(boolean doClassificationData) {
|
131
|
this.doClassificationData = doClassificationData;
|
132
|
}
|
133
|
public boolean isDoDescriptions() {
|
134
|
return doDescriptions;
|
135
|
}
|
136
|
|
137
|
public void setDoDescriptions(boolean doDescriptions) {
|
138
|
this.doDescriptions = doDescriptions;
|
139
|
}
|
140
|
|
141
|
public boolean isDoMedia() {
|
142
|
return doMedia;
|
143
|
}
|
144
|
|
145
|
public void setDoMedia(boolean doMedia) {
|
146
|
this.doMedia = doMedia;
|
147
|
}
|
148
|
|
149
|
public boolean isDoReferencedEntities() {
|
150
|
return doReferencedEntities;
|
151
|
}
|
152
|
|
153
|
public void setDoReferencedEntities(boolean doReferencedEntities) {
|
154
|
this.doReferencedEntities = doReferencedEntities;
|
155
|
}
|
156
|
|
157
|
|
158
|
public boolean isDoSynonyms() {
|
159
|
return doSynonyms;
|
160
|
}
|
161
|
public boolean isDoUsers() {
|
162
|
return doUsers;
|
163
|
}
|
164
|
|
165
|
public void setDoSynonyms(boolean doSynonyms) {
|
166
|
this.doSynonyms = doSynonyms;
|
167
|
}
|
168
|
|
169
|
|
170
|
public boolean isDoTerms() {
|
171
|
return doTerms;
|
172
|
}
|
173
|
|
174
|
public void setDoTerms(boolean doTerms) {
|
175
|
this.doTerms = doTerms;
|
176
|
}
|
177
|
|
178
|
public boolean isDoTermVocabularies() {
|
179
|
return doTermVocabularies;
|
180
|
}
|
181
|
|
182
|
public void setDoTermVocabularies(boolean doTermVocabularies) {
|
183
|
this.doTermVocabularies = doTermVocabularies;
|
184
|
}
|
185
|
|
186
|
public boolean isDoHomotypicalGroups() {
|
187
|
return doHomotypicalGroups;
|
188
|
}
|
189
|
|
190
|
public void setDoHomotypicalGroups(boolean doHomotypicalGroups) {
|
191
|
this.doHomotypicalGroups = doHomotypicalGroups;
|
192
|
}
|
193
|
|
194
|
|
195
|
// @SuppressWarnings("unchecked")
|
196
|
@Override
|
197
|
protected void makeIoClassList() {
|
198
|
ioClassList = new Class[] {
|
199
|
JaxbExport.class,
|
200
|
};
|
201
|
};
|
202
|
|
203
|
|
204
|
public static JaxbExportConfigurator NewInstance(ICdmDataSource source, File uri) {
|
205
|
return new JaxbExportConfigurator(source, uri);
|
206
|
}
|
207
|
|
208
|
|
209
|
/**
|
210
|
* @param url
|
211
|
* @param destination
|
212
|
*/
|
213
|
private JaxbExportConfigurator(ICdmDataSource source, File uri) {
|
214
|
super(defaultTransformer);
|
215
|
setDestination(uri);
|
216
|
setSource(source);
|
217
|
}
|
218
|
|
219
|
|
220
|
@Override
|
221
|
public File getDestination() {
|
222
|
return super.getDestination();
|
223
|
}
|
224
|
|
225
|
@Override
|
226
|
public void setDestination(File uri) {
|
227
|
super.setDestination(uri);
|
228
|
}
|
229
|
|
230
|
@Override
|
231
|
public String getDestinationNameString() {
|
232
|
if (this.getDestination() == null) {
|
233
|
return null;
|
234
|
} else {
|
235
|
return this.getDestination().toString();
|
236
|
}
|
237
|
}
|
238
|
|
239
|
public boolean isDoTypeDesignations() {
|
240
|
return doTypeDesignations;
|
241
|
}
|
242
|
|
243
|
public void setDoTypeDesignations(boolean doTypeDesignations) {
|
244
|
this.doTypeDesignations = doTypeDesignations;
|
245
|
}
|
246
|
|
247
|
public boolean isDoOccurrence() {
|
248
|
return doOccurrence;
|
249
|
}
|
250
|
public void setDoOccurrence(boolean doOccurrence) {
|
251
|
this.doOccurrence = doOccurrence;
|
252
|
}
|
253
|
|
254
|
private boolean doAuthors = true;
|
255
|
//references
|
256
|
private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
257
|
//names
|
258
|
private boolean doTaxonNames = true;
|
259
|
//taxa
|
260
|
private boolean doTaxa = true;
|
261
|
|
262
|
public boolean isDoAuthors() {
|
263
|
return doAuthors;
|
264
|
}
|
265
|
public void setDoAuthors(boolean doAuthors) {
|
266
|
this.doAuthors = doAuthors;
|
267
|
}
|
268
|
|
269
|
public DO_REFERENCES getDoReferences() {
|
270
|
return doReferences;
|
271
|
}
|
272
|
public void setDoReferences(DO_REFERENCES doReferences) {
|
273
|
this.doReferences = doReferences;
|
274
|
}
|
275
|
|
276
|
public boolean isDoTaxonNames() {
|
277
|
return doTaxonNames;
|
278
|
}
|
279
|
public void setDoTaxonNames(boolean doTaxonNames) {
|
280
|
this.doTaxonNames = doTaxonNames;
|
281
|
}
|
282
|
|
283
|
public boolean isDoTaxa() {
|
284
|
return doTaxa;
|
285
|
}
|
286
|
public void setDoTaxa(boolean doTaxa) {
|
287
|
this.doTaxa = doTaxa;
|
288
|
}
|
289
|
|
290
|
|
291
|
|
292
|
}
|