Merging r13268 through r14040 from trunk/cdmlib into branches/cdmlib-unitils3
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / jaxb / JaxbExportConfigurator.java
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.net.URI;
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.IExportConfigurator;
19 import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
20
21 /**
22 * @author a.babadshanjan
23 * @created 03.09.2008
24 */
25 public class JaxbExportConfigurator extends ExportConfiguratorBase<URI,JaxbExportState> implements IExportConfigurator<JaxbExportState> {
26 @SuppressWarnings("unused")
27 private static final Logger logger = Logger.getLogger(JaxbExportConfigurator.class);
28
29 private int maxRows = 0;
30 private boolean formattedOutput = Boolean.TRUE;
31 private String encoding = "UTF-8";
32
33 private boolean doUsers = true;
34 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 private boolean doOccurrence = true;
40 // 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
50 private boolean doTypeDesignations = true;
51 private boolean doClassificationData = true;
52
53 //TODO
54 private static IExportTransformer defaultTransformer = null;
55
56
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 public int getMaxRows() {
66 return maxRows;
67 }
68
69 public void setMaxRows(int maxRows) {
70 this.maxRows = maxRows;
71 }
72
73 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 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
102 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 public boolean isDoClassificationData() {
115 return doClassificationData;
116 }
117 public void setDoClassificationData(boolean doClassificationData) {
118 this.doClassificationData = doClassificationData;
119 }
120 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 public boolean isDoUsers() {
149 return doUsers;
150 }
151
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 ioClassList = new Class[] {
185 JaxbExport.class,
186 };
187 };
188
189
190 public static JaxbExportConfigurator NewInstance(ICdmDataSource source, URI uri) {
191 return new JaxbExportConfigurator(source, uri);
192 }
193
194
195 /**
196 * @param url
197 * @param destination
198 */
199 private JaxbExportConfigurator(ICdmDataSource source, URI uri) {
200 super(defaultTransformer);
201 setDestination(uri);
202 setSource(source);
203 }
204
205
206 /* (non-Javadoc)
207 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
208 */
209 public URI getDestination() {
210 return super.getDestination();
211 }
212
213
214 /**
215 * @param file
216 */
217 public void setDestination(URI uri) {
218 super.setDestination(uri);
219 }
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 return this.getDestination().toString();
230 }
231 }
232
233 public boolean isDoTypeDesignations() {
234 return doTypeDesignations;
235 }
236
237 public void setDoTypeDesignations(boolean doTypeDesignations) {
238 this.doTypeDesignations = doTypeDesignations;
239 }
240
241 public boolean isDoOccurrence() {
242 return doOccurrence;
243 }
244 public void setDoOccurrence(boolean doOccurrence) {
245 this.doOccurrence = doOccurrence;
246 }
247
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
285
286 }