Fauna Europaea Import
[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
36 /* Max number of taxa to be saved with one service call */
37 private int limitSave = 1000;
38 private int maxTaxon = 306000;
39 private boolean useTransactions = true;
40 private ReferenceBase<?> auctReference;
41
42 // @SuppressWarnings("unchecked")
43 // protected void makeIoClassList() {
44 // ioClassList = new Class[] {
45 // FaunaEuropaeaAuthorImport.class,
46 // FaunaEuropaeaNameImport.class,
47 // FaunaEuropaeaRelShipImport.class,
48 // FaunaEuropaeaRefImport.class,
49 // FaunaEuropaeaDistributionImport.class
50 // };
51 // };
52
53 @SuppressWarnings("unchecked")
54 protected void makeIoClassList() {
55 ioClassList = new Class[] {
56 // FaunaEuropaeaAuthorImport.class,
57 // FaunaEuropaeaNameImport.class,
58 // FaunaEuropaeaRelShipImport.class,
59 FaunaEuropaeaRelTaxonIncludeImport.class
60 // FaunaEuropaeaRefImport.class,
61 // FaunaEuropaeaDistributionImport.class
62 };
63 };
64
65 public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
66 return new FaunaEuropaeaImportConfigurator(source, destination);
67 }
68
69 private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
70 setSource(source);
71 setDestination(destination);
72 setNomenclaturalCode(NomenclaturalCode.ICBN);
73 }
74
75 /* (non-Javadoc)
76 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
77 */
78 public Source getSource() {
79 return (Source)super.getSource();
80 }
81
82 /**
83 * @param dbSource
84 */
85 public void setSource(Source dbSource) {
86 super.setSource(dbSource);
87 }
88
89
90 /* (non-Javadoc)
91 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
92 */
93 @Override
94 public ReferenceBase<?> getSourceReference() {
95 //TODO
96 if (this.sourceReference == null){
97 logger.warn("getSource Reference not yet fully implemented");
98 sourceReference = Database.NewInstance();
99 sourceReference.setTitleCache("Fauna Europaea database");
100 }
101 return sourceReference;
102 }
103
104
105 /* (non-Javadoc)
106 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
107 */
108 public ReferenceBase<?> getAuctReference() {
109 //TODO
110 if (auctReference == null){
111 auctReference = Database.NewInstance();
112 auctReference.setTitleCache("auct.");
113 }
114 return auctReference;
115 }
116
117 /* (non-Javadoc)
118 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
119 */
120 public String getSourceNameString() {
121 if (this.getSource() == null) {
122 return null;
123 }else{
124 return this.getSource().toString();
125 }
126 }
127
128 /* (non-Javadoc)
129 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
130 */
131 public FaunaEuropaeaImportState getNewState() {
132 return new FaunaEuropaeaImportState(this);
133 }
134
135 /**
136 * @return the doBasionyms
137 */
138 public boolean isDoBasionyms() {
139 return doBasionyms;
140 }
141
142 /**
143 * @param doBasionyms the doBasionyms to set
144 */
145 public void setDoBasionyms(boolean doBasionyms) {
146 this.doBasionyms = doBasionyms;
147 }
148
149 /**
150 * @return the doTaxonomicallyIncluded
151 */
152 public boolean isDoTaxonomicallyIncluded() {
153 return doTaxonomicallyIncluded;
154 }
155
156 /**
157 * @param doTaxonomicallyIncluded the doTaxonomicallyIncluded to set
158 */
159 public void setDoTaxonomicallyIncluded(boolean doTaxonomicallyIncluded) {
160 this.doTaxonomicallyIncluded = doTaxonomicallyIncluded;
161 }
162
163 /**
164 * @return the doMisappliedNames
165 */
166 public boolean isDoMisappliedNames() {
167 return doMisappliedNames;
168 }
169
170 /**
171 * @param doMisappliedNames the doMisappliedNames to set
172 */
173 public void setDoMisappliedNames(boolean doMisappliedNames) {
174 this.doMisappliedNames = doMisappliedNames;
175 }
176
177 /**
178 * @return the doHeterotypicSynonyms
179 */
180 public boolean isDoHeterotypicSynonyms() {
181 return doHeterotypicSynonyms;
182 }
183
184 /**
185 * @param doHeterotypicSynonyms the doHeterotypicSynonyms to set
186 */
187 public void setDoHeterotypicSynonyms(boolean doHeterotypicSynonyms) {
188 this.doHeterotypicSynonyms = doHeterotypicSynonyms;
189 }
190
191 /**
192 * @return the useTransactions
193 */
194 public boolean isUseTransactions() {
195 return useTransactions;
196 }
197
198 /**
199 * @param useTransactions the useTransactions to set
200 */
201 public void setUseTransactions(boolean useTransactions) {
202 this.useTransactions = useTransactions;
203 }
204
205 /**
206 * @param auctReference the auctReference to set
207 */
208 public void setAuctReference(ReferenceBase<?> auctReference) {
209 this.auctReference = auctReference;
210 }
211
212 /**
213 * @return the limitSave
214 */
215 public int getLimitSave() {
216 return limitSave;
217 }
218
219 /**
220 * @param limitSave the limitSave to set
221 */
222 public void setLimitSave(int limitSave) {
223 this.limitSave = limitSave;
224 }
225
226 /**
227 * @return the maxTaxon
228 */
229 public int getMaxTaxon() {
230 return maxTaxon;
231 }
232
233 /**
234 * @param maxTaxon the maxTaxon to set
235 */
236 public void setMaxTaxon(int maxTaxon) {
237 this.maxTaxon = maxTaxon;
238 }
239
240
241
242 }