Revision 2d481abb
Added by Katja Luther almost 10 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/indexFungorum/IndexFungorumDistributionImport.java | ||
---|---|---|
97 | 97 |
Integer id = rs.getInt("PreferredNameIFnumber"); |
98 | 98 |
Taxon taxon = state.getRelatedObject(NAMESPACE_SPECIES, String.valueOf(id), Taxon.class); |
99 | 99 |
Reference<?> ref = null; |
100 |
TaxonDescription description = getTaxonDescription(taxon, ref, false, true); |
|
100 |
if (taxon == null){ |
|
101 |
logger.debug("taxon is null for id " + id); |
|
102 |
} else{ |
|
103 |
TaxonDescription description = getTaxonDescription(taxon, ref, false, true); |
|
101 | 104 |
|
102 |
//handle single distributions |
|
103 |
int count = rs.getMetaData().getColumnCount(); |
|
104 |
for (int i=1; i <= count; i++ ){ |
|
105 |
String colName = rs.getMetaData().getColumnName(i); |
|
106 |
//exclude non distribution columns |
|
107 |
if (! excludedColumns.contains(colName)){ |
|
108 |
String distributionValue = rs.getString(i); |
|
109 |
if (StringUtils.isNotBlank(distributionValue)){ |
|
110 |
//create distribution for existing occurrences |
|
111 |
if (! distributionValue.equals("X")){ |
|
112 |
logger.warn("Unexpected distribution value '" + distributionValue + "' for area " + colName); |
|
105 |
//handle single distributions |
|
106 |
int count = rs.getMetaData().getColumnCount(); |
|
107 |
for (int i=1; i <= count; i++ ){ |
|
108 |
String colName = rs.getMetaData().getColumnName(i); |
|
109 |
//exclude non distribution columns |
|
110 |
if (! excludedColumns.contains(colName)){ |
|
111 |
String distributionValue = rs.getString(i); |
|
112 |
if (StringUtils.isNotBlank(distributionValue)){ |
|
113 |
//create distribution for existing occurrences |
|
114 |
if (! distributionValue.equals("X")){ |
|
115 |
logger.warn("Unexpected distribution value '" + distributionValue + "' for area " + colName); |
|
116 |
} |
|
117 |
NamedArea area = state.getTransformer().getNamedAreaByKey(colName); |
|
118 |
Distribution distribution = Distribution.NewInstance(area, status); |
|
119 |
description.addElement(distribution); |
|
120 |
//no last action |
|
121 |
distribution.addMarker(Marker.NewInstance(noLastActionMarkerType, true)); |
|
113 | 122 |
} |
114 |
NamedArea area = state.getTransformer().getNamedAreaByKey(colName); |
|
115 |
Distribution distribution = Distribution.NewInstance(area, status); |
|
116 |
description.addElement(distribution); |
|
117 |
//no last action |
|
118 |
distribution.addMarker(Marker.NewInstance(noLastActionMarkerType, true)); |
|
123 |
|
|
119 | 124 |
} |
120 |
|
|
121 | 125 |
} |
126 |
getTaxonService().saveOrUpdate(taxon); |
|
122 | 127 |
} |
123 | 128 |
|
124 | 129 |
//save |
125 |
getTaxonService().saveOrUpdate(taxon); |
|
130 |
|
|
126 | 131 |
} |
127 | 132 |
|
128 | 133 |
|
Also available in: Unified diff
changes in Fauna Europeae Import and Index Fungorum Import and PESI Export