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