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.io.common.mapping.IInputTransformer;
|
19
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
20
|
import eu.etaxonomy.cdm.model.reference.IDatabase;
|
21
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
22
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
23
|
|
24
|
/**
|
25
|
* @author a.babadshanjan
|
26
|
* @created 08.05.2009
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class FaunaEuropaeaImportConfigurator extends ImportConfiguratorBase<FaunaEuropaeaImportState> implements IImportConfigurator {
|
30
|
private static final Logger logger = Logger.getLogger(FaunaEuropaeaImportConfigurator.class);
|
31
|
|
32
|
//TODO
|
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
|
|
41
|
/* Max number of taxa to be saved with one service call */
|
42
|
private int limitSave = 900;
|
43
|
private ReferenceBase<?> 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
|
FaunaEuropaeaDistributionImport.class,
|
53
|
FaunaEuropaeaHeterotypicSynonymImport.class
|
54
|
};
|
55
|
};
|
56
|
|
57
|
public static FaunaEuropaeaImportConfigurator NewInstance(Source source, ICdmDataSource destination){
|
58
|
return new FaunaEuropaeaImportConfigurator(source, destination);
|
59
|
}
|
60
|
|
61
|
private FaunaEuropaeaImportConfigurator(Source source, ICdmDataSource destination) {
|
62
|
super(defaultTransformer);
|
63
|
setSource(source);
|
64
|
setDestination(destination);
|
65
|
setNomenclaturalCode(NomenclaturalCode.ICBN);
|
66
|
}
|
67
|
|
68
|
public static FaunaEuropaeaImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
|
69
|
return new FaunaEuropaeaImportConfigurator(source, destination);
|
70
|
}
|
71
|
|
72
|
private FaunaEuropaeaImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
|
73
|
super(defaultTransformer);
|
74
|
setSource(source);
|
75
|
setDestination(destination);
|
76
|
setNomenclaturalCode(NomenclaturalCode.ICBN);
|
77
|
}
|
78
|
|
79
|
/* (non-Javadoc)
|
80
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
|
81
|
*/
|
82
|
public Source getSource() {
|
83
|
return (Source)super.getSource();
|
84
|
}
|
85
|
|
86
|
/**
|
87
|
* @param dbSource
|
88
|
*/
|
89
|
public void setSource(Source dbSource) {
|
90
|
super.setSource(dbSource);
|
91
|
}
|
92
|
|
93
|
|
94
|
/* (non-Javadoc)
|
95
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
96
|
*/
|
97
|
@Override
|
98
|
public ReferenceBase<?> getSourceReference() {
|
99
|
//TODO
|
100
|
if (this.sourceReference == null){
|
101
|
logger.warn("getSource Reference not yet fully implemented");
|
102
|
ReferenceFactory refFactory = ReferenceFactory.newInstance();
|
103
|
sourceReference = refFactory.newDatabase();
|
104
|
|
105
|
sourceReference.setTitleCache("Fauna Europaea database", true);
|
106
|
}
|
107
|
return sourceReference;
|
108
|
}
|
109
|
|
110
|
|
111
|
/* (non-Javadoc)
|
112
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
113
|
*/
|
114
|
public ReferenceBase<?> getAuctReference() {
|
115
|
//TODO
|
116
|
if (auctReference == null){
|
117
|
ReferenceFactory refFactory = ReferenceFactory.newInstance();
|
118
|
auctReference = refFactory.newDatabase();
|
119
|
|
120
|
auctReference.setTitleCache("auct.", true);
|
121
|
}
|
122
|
return auctReference;
|
123
|
}
|
124
|
|
125
|
/* (non-Javadoc)
|
126
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
127
|
*/
|
128
|
public String getSourceNameString() {
|
129
|
if (this.getSource() == null) {
|
130
|
return null;
|
131
|
}else{
|
132
|
return this.getSource().toString();
|
133
|
}
|
134
|
}
|
135
|
|
136
|
/* (non-Javadoc)
|
137
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
138
|
*/
|
139
|
public FaunaEuropaeaImportState getNewState() {
|
140
|
return new FaunaEuropaeaImportState(this);
|
141
|
}
|
142
|
|
143
|
/**
|
144
|
* @return the doBasionyms
|
145
|
*/
|
146
|
public boolean isDoBasionyms() {
|
147
|
return doBasionyms;
|
148
|
}
|
149
|
|
150
|
/**
|
151
|
* @param doBasionyms the doBasionyms to set
|
152
|
*/
|
153
|
public void setDoBasionyms(boolean doBasionyms) {
|
154
|
this.doBasionyms = doBasionyms;
|
155
|
}
|
156
|
|
157
|
/**
|
158
|
* @return the doTaxonomicallyIncluded
|
159
|
*/
|
160
|
public boolean isDoTaxonomicallyIncluded() {
|
161
|
return doTaxonomicallyIncluded;
|
162
|
}
|
163
|
|
164
|
/**
|
165
|
* @param doTaxonomicallyIncluded the doTaxonomicallyIncluded to set
|
166
|
*/
|
167
|
public void setDoTaxonomicallyIncluded(boolean doTaxonomicallyIncluded) {
|
168
|
this.doTaxonomicallyIncluded = doTaxonomicallyIncluded;
|
169
|
}
|
170
|
|
171
|
/**
|
172
|
* @return the doMisappliedNames
|
173
|
*/
|
174
|
public boolean isDoMisappliedNames() {
|
175
|
return doMisappliedNames;
|
176
|
}
|
177
|
|
178
|
/**
|
179
|
* @param doMisappliedNames the doMisappliedNames to set
|
180
|
*/
|
181
|
public void setDoMisappliedNames(boolean doMisappliedNames) {
|
182
|
this.doMisappliedNames = doMisappliedNames;
|
183
|
}
|
184
|
|
185
|
/**
|
186
|
* @return the doHeterotypicSynonyms
|
187
|
*/
|
188
|
public boolean isDoHeterotypicSynonyms() {
|
189
|
return doHeterotypicSynonyms;
|
190
|
}
|
191
|
|
192
|
/**
|
193
|
* @param doHeterotypicSynonyms the doHeterotypicSynonyms to set
|
194
|
*/
|
195
|
public void setDoHeterotypicSynonyms(boolean doHeterotypicSynonyms) {
|
196
|
this.doHeterotypicSynonyms = doHeterotypicSynonyms;
|
197
|
}
|
198
|
|
199
|
/**
|
200
|
* @param auctReference the auctReference to set
|
201
|
*/
|
202
|
public void setAuctReference(ReferenceBase<?> auctReference) {
|
203
|
this.auctReference = auctReference;
|
204
|
}
|
205
|
|
206
|
/**
|
207
|
* @return the limitSave
|
208
|
*/
|
209
|
public int getLimitSave() {
|
210
|
return limitSave;
|
211
|
}
|
212
|
|
213
|
/**
|
214
|
* @param limitSave the limitSave to set
|
215
|
*/
|
216
|
public void setLimitSave(int limitSave) {
|
217
|
this.limitSave = limitSave;
|
218
|
}
|
219
|
|
220
|
/**
|
221
|
* @param doHeterotypicSynonymsForBasionyms the doHeterotypicSynonymsForBasionyms to set
|
222
|
*/
|
223
|
public void setDoHeterotypicSynonymsForBasionyms(
|
224
|
boolean doHeterotypicSynonymsForBasionyms) {
|
225
|
this.doHeterotypicSynonymsForBasionyms = doHeterotypicSynonymsForBasionyms;
|
226
|
}
|
227
|
|
228
|
/**
|
229
|
* @return the doHeterotypicSynonymsForBasionyms
|
230
|
*/
|
231
|
public boolean isDoHeterotypicSynonymsForBasionyms() {
|
232
|
return doHeterotypicSynonymsForBasionyms;
|
233
|
}
|
234
|
|
235
|
}
|