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