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