latest FE import features
[cdmlib-apps.git] / cdm-pesi / src / main / java / eu / etaxonomy / cdm / io / pesi / 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.pesi.faunaEuropaea;
10
11 import org.apache.log4j.Logger;
12
13 import eu.etaxonomy.cdm.database.ICdmDataSource;
14 import eu.etaxonomy.cdm.io.common.IImportConfigurator;
15 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
16 import eu.etaxonomy.cdm.io.common.Source;
17 import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
18 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
19 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
20 import eu.etaxonomy.cdm.model.reference.Reference;
21 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
22
23 /**
24 * @author a.babadshanjan
25 * @created 08.05.2009
26 * @version 1.0
27 */
28 public class FaunaEuropaeaImportConfigurator extends ImportConfiguratorBase<FaunaEuropaeaImportState, Source> implements IImportConfigurator {
29 private static final Logger logger = Logger.getLogger(FaunaEuropaeaImportConfigurator.class);
30
31 //TODO
32 private static IInputTransformer defaultTransformer = null;
33
34 private boolean doBasionyms = true;
35 private boolean doTaxonomicallyIncluded = true;
36 private boolean doMisappliedNames = true;
37 private boolean doHeterotypicSynonyms = true;
38 private boolean doHeterotypicSynonymsForBasionyms ;
39 private boolean doOccurrence = true;
40
41 /* Max number of taxa to be saved with one service call */
42 private int limitSave = 5000;
43 private Reference<?> auctReference;
44
45 @SuppressWarnings("unchecked")
46 protected void makeIoClassList() {
47 ioClassList = new Class[] {
48 FaunaEuropaeaAuthorImport.class,
49 FaunaEuropaeaTaxonNameImport.class,
50 FaunaEuropaeaRelTaxonIncludeImport.class,
51 FaunaEuropaeaRefImport.class,
52 FaunaEuropaeaUsersImport.class,
53 FaunaEuropaeaDistributionImport.class,
54 FaunaEuropaeaHeterotypicSynonymImport.class,
55 FaunaEuropaeaAdditionalTaxonDataImport.class,
56 };
57 };
58
59 public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
60 return new FaunaEuropaeaImportConfigurator(source, destination);
61 }
62
63 private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
64 super(defaultTransformer);
65 setSource(source);
66 setDestination(destination);
67 setNomenclaturalCode(NomenclaturalCode.ICBN);
68 }
69
70 // public static FaunaEuropaeaImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
71 // return new FaunaEuropaeaImportConfigurator(source, destination);
72 //}
73
74 // private FaunaEuropaeaImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
75 // super(defaultTransformer);
76 // setSource(source);
77 // setDestination(destination);
78 // setNomenclaturalCode(NomenclaturalCode.ICBN);
79 // }
80
81
82 /* (non-Javadoc)
83 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
84 */
85 @Override
86 public Reference<?> getSourceReference() {
87 //TODO
88 if (this.sourceReference == null){
89 logger.warn("getSource Reference not yet fully implemented");
90 sourceReference = ReferenceFactory.newDatabase();
91
92 sourceReference.setTitleCache("Fauna Europaea database", true);
93 }
94 return sourceReference;
95 }
96
97
98 /* (non-Javadoc)
99 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
100 */
101 public Reference<?> getAuctReference() {
102 //TODO
103 if (auctReference == null){
104 auctReference = ReferenceFactory.newPersonalCommunication();
105
106 auctReference.setTitleCache("auct.", true);
107 }
108 return auctReference;
109 }
110
111 /* (non-Javadoc)
112 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
113 */
114 public String getSourceNameString() {
115 if (this.getSource() == null) {
116 return null;
117 }else{
118 return this.getSource().toString();
119 }
120 }
121
122 /* (non-Javadoc)
123 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
124 */
125 public FaunaEuropaeaImportState getNewState() {
126 return new FaunaEuropaeaImportState(this);
127 }
128
129 /**
130 * @return the doBasionyms
131 */
132 public boolean isDoBasionyms() {
133 return doBasionyms;
134 }
135
136 /**
137 * @param doBasionyms the doBasionyms to set
138 */
139 public void setDoBasionyms(boolean doBasionyms) {
140 this.doBasionyms = doBasionyms;
141 }
142
143 /**
144 * @return the doTaxonomicallyIncluded
145 */
146 public boolean isDoTaxonomicallyIncluded() {
147 return doTaxonomicallyIncluded;
148 }
149
150 /**
151 * @param doTaxonomicallyIncluded the doTaxonomicallyIncluded to set
152 */
153 public void setDoTaxonomicallyIncluded(boolean doTaxonomicallyIncluded) {
154 this.doTaxonomicallyIncluded = doTaxonomicallyIncluded;
155 }
156
157 /**
158 * @return the doMisappliedNames
159 */
160 public boolean isDoMisappliedNames() {
161 return doMisappliedNames;
162 }
163
164 /**
165 * @param doMisappliedNames the doMisappliedNames to set
166 */
167 public void setDoMisappliedNames(boolean doMisappliedNames) {
168 this.doMisappliedNames = doMisappliedNames;
169 }
170
171 /**
172 * @return the doHeterotypicSynonyms
173 */
174 public boolean isDoHeterotypicSynonyms() {
175 return doHeterotypicSynonyms;
176 }
177
178 /**
179 * @param doHeterotypicSynonyms the doHeterotypicSynonyms to set
180 */
181 public void setDoHeterotypicSynonyms(boolean doHeterotypicSynonyms) {
182 this.doHeterotypicSynonyms = doHeterotypicSynonyms;
183 }
184
185 /**
186 * @param auctReference the auctReference to set
187 */
188 public void setAuctReference(Reference<?> auctReference) {
189 this.auctReference = auctReference;
190 }
191
192 /**
193 * @return the limitSave
194 */
195 public int getLimitSave() {
196 return limitSave;
197 }
198
199 /**
200 * @param limitSave the limitSave to set
201 */
202 public void setLimitSave(int limitSave) {
203 this.limitSave = limitSave;
204 }
205
206 /**
207 * @param doHeterotypicSynonymsForBasionyms the doHeterotypicSynonymsForBasionyms to set
208 */
209 public void setDoHeterotypicSynonymsForBasionyms(
210 boolean doHeterotypicSynonymsForBasionyms) {
211 this.doHeterotypicSynonymsForBasionyms = doHeterotypicSynonymsForBasionyms;
212 }
213
214 /**
215 * @return the doHeterotypicSynonymsForBasionyms
216 */
217 public boolean isDoHeterotypicSynonymsForBasionyms() {
218 return doHeterotypicSynonymsForBasionyms;
219 }
220
221
222 /* (non-Javadoc)
223 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#isDoOccurrence()
224 */
225 public boolean isDoOccurrence() {
226 return doOccurrence;
227 }
228 /* (non-Javadoc)
229 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#setDoOccurrence(boolean)
230 */
231 public void setDoOccurrence(boolean doOccurrence) {
232 this.doOccurrence = doOccurrence;
233 }
234
235
236 private boolean doAuthors = true;
237 //references
238 private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
239 //names
240 private boolean doTypes = true;
241
242 //taxa
243 private boolean doTaxa = true;
244 private boolean doRelTaxa = true;
245
246 public boolean isDoAuthors() {
247 return doAuthors;
248 }
249 public void setDoAuthors(boolean doAuthors) {
250 this.doAuthors = doAuthors;
251 }
252
253 public DO_REFERENCES getDoReferences() {
254 return doReferences;
255 }
256 public void setDoReferences(DO_REFERENCES doReferences) {
257 this.doReferences = doReferences;
258 }
259
260 // public boolean isDoTypes() {
261 // return doTypes;
262 // }
263 // public void setDoTypes(boolean doTypes) {
264 // this.doTypes = doTypes;
265 // }
266
267 public boolean isDoTaxa() {
268 return doTaxa;
269 }
270 public void setDoTaxa(boolean doTaxa) {
271 this.doTaxa = doTaxa;
272 }
273
274 public boolean isDoRelTaxa() {
275 return doRelTaxa;
276 }
277 public void setDoRelTaxa(boolean doRelTaxa) {
278 this.doRelTaxa = doRelTaxa;
279 }
280
281
282 }