Revision bb38665e
Added by Andreas Müller over 10 years ago
cdm-eflora/src/main/java/eu/etaxonomy/cdm/io/eflora/centralAfrica/checklist/CentralAfricaChecklistTaxonImport.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.cdm.common.CdmUtils; |
26 | 26 |
import eu.etaxonomy.cdm.io.common.IOValidator; |
27 | 27 |
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner; |
28 |
import eu.etaxonomy.cdm.io.common.TdwgAreaProvider; |
|
28 | 29 |
import eu.etaxonomy.cdm.io.common.mapping.DbImportMapping; |
29 | 30 |
import eu.etaxonomy.cdm.io.common.mapping.DbImportMarkerMapper; |
30 | 31 |
import eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapper; |
... | ... | |
32 | 33 |
import eu.etaxonomy.cdm.io.common.mapping.IMappingImport; |
33 | 34 |
import eu.etaxonomy.cdm.io.eflora.centralAfrica.checklist.validation.CentralAfricaChecklistTaxonImportValidator; |
34 | 35 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
36 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
|
35 | 37 |
import eu.etaxonomy.cdm.model.description.Distribution; |
36 | 38 |
import eu.etaxonomy.cdm.model.description.PresenceTerm; |
37 | 39 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
38 | 40 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
39 |
import eu.etaxonomy.cdm.model.location.TdwgArea; |
|
40 | 41 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
41 | 42 |
import eu.etaxonomy.cdm.model.name.Rank; |
42 | 43 |
import eu.etaxonomy.cdm.model.reference.Reference; |
... | ... | |
51 | 52 |
/** |
52 | 53 |
* @author a.mueller |
53 | 54 |
* @created 20.02.2010 |
54 |
* @version 1.0 |
|
55 | 55 |
*/ |
56 | 56 |
@Component |
57 | 57 |
public class CentralAfricaChecklistTaxonImport extends CentralAfricaChecklistImportBase<TaxonBase> implements IMappingImport<TaxonBase, CentralAfricaChecklistImportState>{ |
... | ... | |
172 | 172 |
/* (non-Javadoc) |
173 | 173 |
* @see eu.etaxonomy.cdm.io.common.mapping.IMappingImport#createObject(java.sql.ResultSet) |
174 | 174 |
*/ |
175 |
public TaxonBase createObject(ResultSet rs, CentralAfricaChecklistImportState state) throws SQLException { |
|
175 |
public TaxonBase<?> createObject(ResultSet rs, CentralAfricaChecklistImportState state) throws SQLException {
|
|
176 | 176 |
BotanicalName speciesName = BotanicalName.NewInstance(Rank.SPECIES()); |
177 | 177 |
|
178 |
Reference sec = state.getConfig().getSourceReference(); |
|
178 |
Reference<?> sec = state.getConfig().getSourceReference();
|
|
179 | 179 |
getReferenceService().saveOrUpdate(sec); |
180 | 180 |
|
181 | 181 |
String familyString = rs.getString("family"); |
... | ... | |
223 | 223 |
String sourceString = rs.getString("source"); |
224 | 224 |
String sourceId = rs.getString("source_id"); |
225 | 225 |
|
226 |
Reference sourceRef = state.getRelatedObject(REFERENCE_NAMESPACE, sourceString, Reference.class); |
|
227 |
speciesTaxon.addSource(sourceId, REFERENCE_NAMESPACE, sourceRef, null); |
|
228 |
|
|
226 |
Reference<?> sourceRef = state.getRelatedObject(REFERENCE_NAMESPACE, sourceString, Reference.class); |
|
227 |
speciesTaxon.addSource(OriginalSourceType.Import, sourceId, REFERENCE_NAMESPACE, sourceRef, null); |
|
229 | 228 |
|
230 | 229 |
//geneva id |
231 |
Reference genevaReference = state.getGenevaReference(); |
|
230 |
Reference<?> genevaReference = state.getGenevaReference();
|
|
232 | 231 |
Object genevaId = rs.getObject("geneva_ID"); |
233 |
speciesTaxon.addSource(String.valueOf(genevaId), null, genevaReference, null); |
|
232 |
speciesTaxon.addSource(OriginalSourceType.Import, String.valueOf(genevaId), null, genevaReference, null);
|
|
234 | 233 |
|
235 | 234 |
//distribution |
236 | 235 |
handleDistribution(rs, speciesTaxon); |
... | ... | |
259 | 258 |
*/ |
260 | 259 |
private void addDistribution(TaxonDescription description, Boolean exists, String label) { |
261 | 260 |
if (exists == true){ |
262 |
NamedArea namedArea = TdwgArea.getAreaByTdwgAbbreviation(label); |
|
261 |
NamedArea namedArea = TdwgAreaProvider.getAreaByTdwgAbbreviation(label);
|
|
263 | 262 |
Distribution distribution = Distribution.NewInstance(namedArea, PresenceTerm.PRESENT()); |
264 | 263 |
description.addElement(distribution); |
265 | 264 |
} |
Also available in: Unified diff
reintegrate cdmlib-app-3.3 branch into trunk