1 |
83863ca3
|
a.babadshanjan
|
/**
|
2 |
|
|
* Copyright (C) 2008 EDIT
|
3 |
03ebde9e
|
Katja Luther
|
* European Distributed Institute of Taxonomy
|
4 |
83863ca3
|
a.babadshanjan
|
* http://www.e-taxonomy.eu
|
5 |
03ebde9e
|
Katja Luther
|
*
|
6 |
33291bc7
|
a.babadshanjan
|
* 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 |
83863ca3
|
a.babadshanjan
|
*/
|
9 |
|
|
|
10 |
|
|
package eu.etaxonomy.cdm.io.jaxb;
|
11 |
|
|
|
12 |
89102b8a
|
Andreas Müller
|
import java.io.File;
|
13 |
4a3dd8c5
|
Andreas Müller
|
|
14 |
83863ca3
|
a.babadshanjan
|
import org.apache.log4j.Logger;
|
15 |
|
|
|
16 |
|
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
17 |
|
|
import eu.etaxonomy.cdm.io.common.ExportConfiguratorBase;
|
18 |
03ebde9e
|
Katja Luther
|
import eu.etaxonomy.cdm.io.common.ExportResultType;
|
19 |
83863ca3
|
a.babadshanjan
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
|
20 |
4a3dd8c5
|
Andreas Müller
|
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
|
21 |
83863ca3
|
a.babadshanjan
|
|
22 |
|
|
/**
|
23 |
|
|
* @author a.babadshanjan
|
24 |
a88578ce
|
Andreas Müller
|
* @since 03.09.2008
|
25 |
83863ca3
|
a.babadshanjan
|
*/
|
26 |
89102b8a
|
Andreas Müller
|
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 |
83863ca3
|
a.babadshanjan
|
private static final Logger logger = Logger.getLogger(JaxbExportConfigurator.class);
|
34 |
|
|
|
35 |
|
|
private int maxRows = 0;
|
36 |
879833a4
|
a.babadshanjan
|
private boolean formattedOutput = Boolean.TRUE;
|
37 |
03ebde9e
|
Katja Luther
|
private String encoding = "UTF-8";
|
38 |
83863ca3
|
a.babadshanjan
|
|
39 |
e106b9a0
|
Katja Luther
|
private boolean doUsers = true;
|
40 |
83863ca3
|
a.babadshanjan
|
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 |
7879071c
|
Andreas Müller
|
private boolean doOccurrence = true;
|
46 |
83863ca3
|
a.babadshanjan
|
// 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 |
08b9a163
|
ben.clark
|
|
56 |
|
|
private boolean doTypeDesignations = true;
|
57 |
1d36aa54
|
Andreas Müller
|
private boolean doClassificationData = true;
|
58 |
03ebde9e
|
Katja Luther
|
|
59 |
4a3dd8c5
|
Andreas Müller
|
//TODO
|
60 |
|
|
private static IExportTransformer defaultTransformer = null;
|
61 |
03ebde9e
|
Katja Luther
|
|
62 |
|
|
/**
|
63 |
|
|
*
|
64 |
|
|
*/
|
65 |
|
|
public JaxbExportConfigurator() {
|
66 |
|
|
super(null);
|
67 |
|
|
this.setResultType(ExportResultType.BYTE_ARRAY);
|
68 |
|
|
}
|
69 |
|
|
|
70 |
6b2cc8fd
|
Andreas Müller
|
/* (non-Javadoc)
|
71 |
|
|
* @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
|
72 |
|
|
*/
|
73 |
03ebde9e
|
Katja Luther
|
@Override
|
74 |
|
|
public JaxbExportState getNewState() {
|
75 |
6b2cc8fd
|
Andreas Müller
|
return new JaxbExportState(this);
|
76 |
|
|
}
|
77 |
|
|
|
78 |
83863ca3
|
a.babadshanjan
|
public int getMaxRows() {
|
79 |
|
|
return maxRows;
|
80 |
|
|
}
|
81 |
03ebde9e
|
Katja Luther
|
|
82 |
83863ca3
|
a.babadshanjan
|
public void setMaxRows(int maxRows) {
|
83 |
|
|
this.maxRows = maxRows;
|
84 |
|
|
}
|
85 |
03ebde9e
|
Katja Luther
|
|
86 |
879833a4
|
a.babadshanjan
|
public boolean isFormattedOutput() {
|
87 |
|
|
return formattedOutput;
|
88 |
|
|
}
|
89 |
03ebde9e
|
Katja Luther
|
|
90 |
879833a4
|
a.babadshanjan
|
public void setFormattedOutput(boolean formattedOutput) {
|
91 |
|
|
this.formattedOutput = formattedOutput;
|
92 |
|
|
}
|
93 |
03ebde9e
|
Katja Luther
|
|
94 |
879833a4
|
a.babadshanjan
|
public String getEncoding() {
|
95 |
|
|
return encoding;
|
96 |
|
|
}
|
97 |
03ebde9e
|
Katja Luther
|
|
98 |
879833a4
|
a.babadshanjan
|
public void setEncoding(String encoding) {
|
99 |
|
|
this.encoding = encoding;
|
100 |
|
|
}
|
101 |
03ebde9e
|
Katja Luther
|
|
102 |
83863ca3
|
a.babadshanjan
|
public boolean isDoAgentData() {
|
103 |
|
|
return doAgentData;
|
104 |
|
|
}
|
105 |
03ebde9e
|
Katja Luther
|
|
106 |
83863ca3
|
a.babadshanjan
|
public void setDoAgentData(boolean doAgentData) {
|
107 |
|
|
this.doAgentData = doAgentData;
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
public boolean isDoLanguageData() {
|
111 |
|
|
return doLanguageData;
|
112 |
|
|
}
|
113 |
03ebde9e
|
Katja Luther
|
|
114 |
|
|
|
115 |
83863ca3
|
a.babadshanjan
|
public void setDoLanguageData(boolean doLanguageData) {
|
116 |
|
|
this.doLanguageData = doLanguageData;
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
public boolean isDoFeatureData() {
|
120 |
|
|
return doFeatureData;
|
121 |
|
|
}
|
122 |
03ebde9e
|
Katja Luther
|
|
123 |
83863ca3
|
a.babadshanjan
|
public void setDoFeatureData(boolean doFeatureData) {
|
124 |
|
|
this.doFeatureData = doFeatureData;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
1d36aa54
|
Andreas Müller
|
public boolean isDoClassificationData() {
|
128 |
|
|
return doClassificationData;
|
129 |
dcb98834
|
Katja Luther
|
}
|
130 |
1d36aa54
|
Andreas Müller
|
public void setDoClassificationData(boolean doClassificationData) {
|
131 |
|
|
this.doClassificationData = doClassificationData;
|
132 |
dcb98834
|
Katja Luther
|
}
|
133 |
83863ca3
|
a.babadshanjan
|
public boolean isDoDescriptions() {
|
134 |
|
|
return doDescriptions;
|
135 |
|
|
}
|
136 |
03ebde9e
|
Katja Luther
|
|
137 |
83863ca3
|
a.babadshanjan
|
public void setDoDescriptions(boolean doDescriptions) {
|
138 |
|
|
this.doDescriptions = doDescriptions;
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
public boolean isDoMedia() {
|
142 |
|
|
return doMedia;
|
143 |
|
|
}
|
144 |
03ebde9e
|
Katja Luther
|
|
145 |
83863ca3
|
a.babadshanjan
|
public void setDoMedia(boolean doMedia) {
|
146 |
|
|
this.doMedia = doMedia;
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
public boolean isDoReferencedEntities() {
|
150 |
|
|
return doReferencedEntities;
|
151 |
|
|
}
|
152 |
03ebde9e
|
Katja Luther
|
|
153 |
83863ca3
|
a.babadshanjan
|
public void setDoReferencedEntities(boolean doReferencedEntities) {
|
154 |
|
|
this.doReferencedEntities = doReferencedEntities;
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
public boolean isDoSynonyms() {
|
159 |
|
|
return doSynonyms;
|
160 |
|
|
}
|
161 |
e106b9a0
|
Katja Luther
|
public boolean isDoUsers() {
|
162 |
|
|
return doUsers;
|
163 |
|
|
}
|
164 |
03ebde9e
|
Katja Luther
|
|
165 |
83863ca3
|
a.babadshanjan
|
public void setDoSynonyms(boolean doSynonyms) {
|
166 |
|
|
this.doSynonyms = doSynonyms;
|
167 |
|
|
}
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
public boolean isDoTerms() {
|
171 |
|
|
return doTerms;
|
172 |
|
|
}
|
173 |
03ebde9e
|
Katja Luther
|
|
174 |
83863ca3
|
a.babadshanjan
|
public void setDoTerms(boolean doTerms) {
|
175 |
|
|
this.doTerms = doTerms;
|
176 |
|
|
}
|
177 |
|
|
|
178 |
|
|
public boolean isDoTermVocabularies() {
|
179 |
|
|
return doTermVocabularies;
|
180 |
|
|
}
|
181 |
03ebde9e
|
Katja Luther
|
|
182 |
83863ca3
|
a.babadshanjan
|
public void setDoTermVocabularies(boolean doTermVocabularies) {
|
183 |
|
|
this.doTermVocabularies = doTermVocabularies;
|
184 |
|
|
}
|
185 |
|
|
|
186 |
|
|
public boolean isDoHomotypicalGroups() {
|
187 |
|
|
return doHomotypicalGroups;
|
188 |
|
|
}
|
189 |
03ebde9e
|
Katja Luther
|
|
190 |
83863ca3
|
a.babadshanjan
|
public void setDoHomotypicalGroups(boolean doHomotypicalGroups) {
|
191 |
|
|
this.doHomotypicalGroups = doHomotypicalGroups;
|
192 |
|
|
}
|
193 |
|
|
|
194 |
03ebde9e
|
Katja Luther
|
|
195 |
83863ca3
|
a.babadshanjan
|
// @SuppressWarnings("unchecked")
|
196 |
03ebde9e
|
Katja Luther
|
@Override
|
197 |
|
|
protected void makeIoClassList() {
|
198 |
68a6503a
|
a.babadshanjan
|
ioClassList = new Class[] {
|
199 |
030ce127
|
Andreas Müller
|
JaxbExport.class,
|
200 |
83863ca3
|
a.babadshanjan
|
};
|
201 |
|
|
};
|
202 |
|
|
|
203 |
03ebde9e
|
Katja Luther
|
|
204 |
89102b8a
|
Andreas Müller
|
public static JaxbExportConfigurator NewInstance(ICdmDataSource source, File uri) {
|
205 |
4a3dd8c5
|
Andreas Müller
|
return new JaxbExportConfigurator(source, uri);
|
206 |
83863ca3
|
a.babadshanjan
|
}
|
207 |
03ebde9e
|
Katja Luther
|
|
208 |
|
|
|
209 |
83863ca3
|
a.babadshanjan
|
/**
|
210 |
|
|
* @param url
|
211 |
|
|
* @param destination
|
212 |
|
|
*/
|
213 |
89102b8a
|
Andreas Müller
|
private JaxbExportConfigurator(ICdmDataSource source, File uri) {
|
214 |
4a3dd8c5
|
Andreas Müller
|
super(defaultTransformer);
|
215 |
|
|
setDestination(uri);
|
216 |
83863ca3
|
a.babadshanjan
|
setSource(source);
|
217 |
|
|
}
|
218 |
03ebde9e
|
Katja Luther
|
|
219 |
83863ca3
|
a.babadshanjan
|
|
220 |
03ebde9e
|
Katja Luther
|
@Override
|
221 |
89102b8a
|
Andreas Müller
|
public File getDestination() {
|
222 |
4a3dd8c5
|
Andreas Müller
|
return super.getDestination();
|
223 |
83863ca3
|
a.babadshanjan
|
}
|
224 |
|
|
|
225 |
03ebde9e
|
Katja Luther
|
@Override
|
226 |
89102b8a
|
Andreas Müller
|
public void setDestination(File uri) {
|
227 |
4a3dd8c5
|
Andreas Müller
|
super.setDestination(uri);
|
228 |
83863ca3
|
a.babadshanjan
|
}
|
229 |
03ebde9e
|
Katja Luther
|
|
230 |
|
|
@Override
|
231 |
|
|
public String getDestinationNameString() {
|
232 |
83863ca3
|
a.babadshanjan
|
if (this.getDestination() == null) {
|
233 |
|
|
return null;
|
234 |
|
|
} else {
|
235 |
4a3dd8c5
|
Andreas Müller
|
return this.getDestination().toString();
|
236 |
83863ca3
|
a.babadshanjan
|
}
|
237 |
|
|
}
|
238 |
08b9a163
|
ben.clark
|
|
239 |
|
|
public boolean isDoTypeDesignations() {
|
240 |
|
|
return doTypeDesignations;
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
public void setDoTypeDesignations(boolean doTypeDesignations) {
|
244 |
|
|
this.doTypeDesignations = doTypeDesignations;
|
245 |
e106b9a0
|
Katja Luther
|
}
|
246 |
03ebde9e
|
Katja Luther
|
|
247 |
7879071c
|
Andreas Müller
|
public boolean isDoOccurrence() {
|
248 |
|
|
return doOccurrence;
|
249 |
|
|
}
|
250 |
|
|
public void setDoOccurrence(boolean doOccurrence) {
|
251 |
|
|
this.doOccurrence = doOccurrence;
|
252 |
|
|
}
|
253 |
03ebde9e
|
Katja Luther
|
|
254 |
30f6e62f
|
Andreas Müller
|
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 |
03ebde9e
|
Katja Luther
|
|
276 |
30f6e62f
|
Andreas Müller
|
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 |
e106b9a0
|
Katja Luther
|
|
291 |
03ebde9e
|
Katja Luther
|
|
292 |
83863ca3
|
a.babadshanjan
|
}
|