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