2 * Copyright (C) 2008 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.io
.jaxb
;
14 import org
.apache
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
17 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
18 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
;
19 import eu
.etaxonomy
.cdm
.io
.common
.ImportConfiguratorBase
;
20 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
22 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
25 * @author a.babadshanjan
28 public class JaxbImportConfigurator
extends ImportConfiguratorBase
<JaxbImportState
, URI
> implements IImportConfigurator
{
30 private static final Logger logger
= Logger
.getLogger(JaxbImportConfigurator
.class);
32 private int maxRows
= 0;
35 private static IInputTransformer defaultTransformer
= null;
38 private boolean doUser
= true;
39 private boolean doAgentData
= true;
40 private boolean doLanguageData
= true;
41 private boolean doFeatureData
= true;
42 private boolean doDescriptions
= true;
43 private boolean doMedia
= true;
44 private boolean doOccurrence
= true;
45 private boolean doReferencedEntities
= true;
46 private boolean doSynonyms
= true;
47 private boolean doTerms
= true;
48 private boolean doTermVocabularies
= true;
49 private boolean doHomotypicalGroups
= true;
51 private boolean doTypeDesignations
= true;
52 private boolean doClassificationData
= true;
53 private boolean doAuthors
= true;
55 private DO_REFERENCES doReferences
= DO_REFERENCES
.ALL
;
57 private boolean doTaxonNames
= true;
59 private boolean doTaxa
= true;
62 public JaxbImportState
getNewState() {
63 return new JaxbImportState(this);
66 public int getMaxRows() {
70 public void setMaxRows(int maxRows
) {
71 this.maxRows
= maxRows
;
76 public boolean isDoAgentData() {
80 public void setDoAgentData(boolean doAgentData
) {
81 this.doAgentData
= doAgentData
;
84 public boolean isDoLanguageData() {
85 return doLanguageData
;
88 public void setDoLanguageData(boolean doLanguageData
) {
89 this.doLanguageData
= doLanguageData
;
92 public boolean isDoFeatureData() {
96 public void setDoFeatureData(boolean doFeatureData
) {
97 this.doFeatureData
= doFeatureData
;
100 public boolean isDoDescriptions() {
101 return doDescriptions
;
104 public void setDoDescriptions(boolean doDescriptions
) {
105 this.doDescriptions
= doDescriptions
;
108 public boolean isDoMedia() {
112 public void setDoMedia(boolean doMedia
) {
113 this.doMedia
= doMedia
;
117 public boolean isDoReferencedEntities() {
118 return doReferencedEntities
;
121 public void setDoReferencedEntities(boolean doReferencedEntities
) {
122 this.doReferencedEntities
= doReferencedEntities
;
126 public boolean isDoSynonyms() {
130 public void setDoSynonyms(boolean doSynonyms
) {
131 this.doSynonyms
= doSynonyms
;
135 public boolean isDoTerms() {
139 public void setDoTerms(boolean doTerms
) {
140 this.doTerms
= doTerms
;
143 public boolean isDoTermVocabularies() {
144 return doTermVocabularies
;
147 public void setDoTermVocabularies(boolean doTermVocabularies
) {
148 this.doTermVocabularies
= doTermVocabularies
;
151 public boolean isDoHomotypicalGroups() {
152 return doHomotypicalGroups
;
155 public void setDoHomotypicalGroups(boolean doHomotypicalGroups
) {
156 this.doHomotypicalGroups
= doHomotypicalGroups
;
159 // @SuppressWarnings("unchecked")
160 protected void makeIoClassList() {
161 ioClassList
= new Class
[] {
166 public static JaxbImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
){
167 return new JaxbImportConfigurator(uri
, destination
);
175 private JaxbImportConfigurator(URI uri
, ICdmDataSource destination
) {
176 super(defaultTransformer
);
178 setDestination(destination
);
179 setDbSchemaValidation(DbSchemaValidation
.CREATE
);
183 public Reference
getSourceReference() {
185 if (this.sourceReference
== null){
186 logger
.warn("getSource Reference not yet fully implemented");
187 sourceReference
= ReferenceFactory
.newDatabase();
188 sourceReference
.setTitleCache("Jaxb import", true);
190 return sourceReference
;
195 public String
getSourceNameString() {
196 if (this.getSource() == null){
199 return this.getSource().toString();
203 //******************** GETTER / SETTER ***************************************/
205 public boolean isDoTypeDesignations() {
206 return doTypeDesignations
;
209 public void setDoTypeDesignations(boolean doTypeDesignations
) {
210 this.doTypeDesignations
= doTypeDesignations
;
213 public boolean isDoClassificationData() {
214 return this.doClassificationData
;
218 public boolean isDoOccurrence() {
221 public void setDoOccurrence(boolean doOccurrence
) {
222 this.doOccurrence
= doOccurrence
;
226 public boolean isDoUser() {
230 public void setDoUser(boolean doUser
) {
231 this.doUser
= doUser
;
235 public boolean isDoAuthors() {
238 public void setDoAuthors(boolean doAuthors
) {
239 this.doAuthors
= doAuthors
;
242 public DO_REFERENCES
getDoReferences() {
245 public void setDoReferences(DO_REFERENCES doReferences
) {
246 this.doReferences
= doReferences
;
249 public boolean isDoTaxonNames() {
252 public void setDoTaxonNames(boolean doTaxonNames
) {
253 this.doTaxonNames
= doTaxonNames
;
256 public boolean isDoTaxa() {
259 public void setDoTaxa(boolean doTaxa
) {
260 this.doTaxa
= doTaxa
;
265 public boolean isOmitTermLoading() {
270 public boolean isCreateNew(){
275 public DbSchemaValidation
getDbSchemaValidation() {
277 return DbSchemaValidation
.CREATE
;
279 return super.getDbSchemaValidation();