Fauna Europaea import: Heterotypic synonyms for basionyms
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / faunaEuropaea / FaunaEuropaeaImportConfigurator.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 package eu.etaxonomy.cdm.io.faunaEuropaea;
10
11 import org.apache.log4j.Logger;
12 import eu.etaxonomy.cdm.database.ICdmDataSource;
13 import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
14 import eu.etaxonomy.cdm.io.common.IImportConfigurator;
15 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
16 import eu.etaxonomy.cdm.io.common.ImportStateBase;
17 import eu.etaxonomy.cdm.io.common.Source;
18 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
19 import eu.etaxonomy.cdm.model.reference.Database;
20 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
21
22 /**
23 * @author a.babadshanjan
24 * @created 08.05.2009
25 * @version 1.0
26 */
27 public class FaunaEuropaeaImportConfigurator extends ImportConfiguratorBase<FaunaEuropaeaImportState> implements IImportConfigurator {
28
29 private static final Logger logger = Logger.getLogger(FaunaEuropaeaImportConfigurator.class);
30
31 private boolean doBasionyms = true;
32 private boolean doTaxonomicallyIncluded = true;
33 private boolean doMisappliedNames = true;
34 private boolean doHeterotypicSynonyms = true;
35 // private boolean doHeterotypicSynonymsForBasionyms = true;
36
37 /* Max number of taxa to be saved with one service call */
38 private int limitSave = 1000;
39 private ReferenceBase<?> auctReference;
40
41 @SuppressWarnings("unchecked")
42 protected void makeIoClassList() {
43 ioClassList = new Class[] {
44 FaunaEuropaeaAuthorImport.class,
45 FaunaEuropaeaTaxonNameImport.class,
46 FaunaEuropaeaHeterotypicSynonymImport.class,
47 FaunaEuropaeaRelTaxonIncludeImport.class,
48 FaunaEuropaeaRefImport.class,
49 FaunaEuropaeaDistributionImport.class
50 };
51 };
52
53 public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
54 return new FaunaEuropaeaImportConfigurator(source, destination);
55 }
56
57 private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
58 setSource(source);
59 setDestination(destination);
60 setNomenclaturalCode(NomenclaturalCode.ICBN);
61 }
62
63 public static FaunaEuropaeaImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
64 return new FaunaEuropaeaImportConfigurator(source, destination);
65 }
66
67 private FaunaEuropaeaImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
68 setSource(source);
69 setDestination(destination);
70 setNomenclaturalCode(NomenclaturalCode.ICBN);
71 }
72
73 /* (non-Javadoc)
74 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
75 */
76 public Source getSource() {
77 return (Source)super.getSource();
78 }
79
80 /**
81 * @param dbSource
82 */
83 public void setSource(Source dbSource) {
84 super.setSource(dbSource);
85 }
86
87
88 /* (non-Javadoc)
89 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
90 */
91 @Override
92 public ReferenceBase<?> getSourceReference() {
93 //TODO
94 if (this.sourceReference == null){
95 logger.warn("getSource Reference not yet fully implemented");
96 sourceReference = Database.NewInstance();
97 sourceReference.setTitleCache("Fauna Europaea database");
98 }
99 return sourceReference;
100 }
101
102
103 /* (non-Javadoc)
104 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
105 */
106 public ReferenceBase<?> getAuctReference() {
107 //TODO
108 if (auctReference == null){
109 auctReference = Database.NewInstance();
110 auctReference.setTitleCache("auct.");
111 }
112 return auctReference;
113 }
114
115 /* (non-Javadoc)
116 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
117 */
118 public String getSourceNameString() {
119 if (this.getSource() == null) {
120 return null;
121 }else{
122 return this.getSource().toString();
123 }
124 }
125
126 /* (non-Javadoc)
127 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
128 */
129 public FaunaEuropaeaImportState getNewState() {
130 return new FaunaEuropaeaImportState(this);
131 }
132
133 /**
134 * @return the doBasionyms
135 */
136 public boolean isDoBasionyms() {
137 return doBasionyms;
138 }
139
140 /**
141 * @param doBasionyms the doBasionyms to set
142 */
143 public void setDoBasionyms(boolean doBasionyms) {
144 this.doBasionyms = doBasionyms;
145 }
146
147 /**
148 * @return the doTaxonomicallyIncluded
149 */
150 public boolean isDoTaxonomicallyIncluded() {
151 return doTaxonomicallyIncluded;
152 }
153
154 /**
155 * @param doTaxonomicallyIncluded the doTaxonomicallyIncluded to set
156 */
157 public void setDoTaxonomicallyIncluded(boolean doTaxonomicallyIncluded) {
158 this.doTaxonomicallyIncluded = doTaxonomicallyIncluded;
159 }
160
161 /**
162 * @return the doMisappliedNames
163 */
164 public boolean isDoMisappliedNames() {
165 return doMisappliedNames;
166 }
167
168 /**
169 * @param doMisappliedNames the doMisappliedNames to set
170 */
171 public void setDoMisappliedNames(boolean doMisappliedNames) {
172 this.doMisappliedNames = doMisappliedNames;
173 }
174
175 /**
176 * @return the doHeterotypicSynonyms
177 */
178 public boolean isDoHeterotypicSynonyms() {
179 return doHeterotypicSynonyms;
180 }
181
182 /**
183 * @param doHeterotypicSynonyms the doHeterotypicSynonyms to set
184 */
185 public void setDoHeterotypicSynonyms(boolean doHeterotypicSynonyms) {
186 this.doHeterotypicSynonyms = doHeterotypicSynonyms;
187 }
188
189 /**
190 * @param auctReference the auctReference to set
191 */
192 public void setAuctReference(ReferenceBase<?> auctReference) {
193 this.auctReference = auctReference;
194 }
195
196 /**
197 * @return the limitSave
198 */
199 public int getLimitSave() {
200 return limitSave;
201 }
202
203 /**
204 * @param limitSave the limitSave to set
205 */
206 public void setLimitSave(int limitSave) {
207 this.limitSave = limitSave;
208 }
209
210 }