Revision dfeeeb8b
Added by Andreas Müller almost 6 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelCommonNamesImport.java | ||
---|---|---|
216 | 216 |
lastCommonNameId = commonNameId; |
217 | 217 |
} |
218 | 218 |
|
219 |
final String NO_REGION = ""; |
|
219 | 220 |
//regions |
220 | 221 |
String regionFks = rs.getString("RegionFks"); |
221 |
String[] regionFkSplit = (regionFks==null)? new String[0] : regionFks.split(","); |
|
222 |
String[] regionFkSplit = (regionFks==null)? new String[]{NO_REGION} : regionFks.trim().split(","); |
|
223 |
if (regionFkSplit.length == 0){ |
|
224 |
String message = "regionFkSplit should never be empty but was for common name id " + commonNameId; |
|
225 |
logger.warn(message); |
|
226 |
} |
|
222 | 227 |
|
223 | 228 |
//commonNameString |
224 | 229 |
if (isBlank(commonNameString)){ |
... | ... | |
267 | 272 |
regionFk = regionFk.trim(); |
268 | 273 |
NamedArea area = regionMap.get(regionFk); |
269 | 274 |
if (area == null){ |
270 |
if (regionFkSplit.length > 1 && isNotBlank(regionFk)){
|
|
275 |
if (isNotBlank(regionFk) && regionFk != NO_REGION){
|
|
271 | 276 |
logger.warn("Area for " + regionFk + " not defined in regionMap."); |
272 | 277 |
}else{ |
273 | 278 |
//no region is defined |
274 | 279 |
} |
275 | 280 |
}else{ |
276 | 281 |
commonTaxonName.setArea(area); |
277 |
TaxonDescription description = getDescription(taxon); |
|
278 |
description.addElement(commonTaxonName); |
|
279 | 282 |
} |
283 |
TaxonDescription description = getDescription(taxon); |
|
284 |
description.addElement(commonTaxonName); |
|
280 | 285 |
} |
281 | 286 |
|
282 | 287 |
//Reference/Source |
... | ... | |
339 | 344 |
if (misappliedNameTaxon != null){ |
340 | 345 |
|
341 | 346 |
if (! taxon.getMisappliedNames(false).contains(misappliedNameTaxon)){ |
342 |
taxon.addMisappliedName(misappliedNameTaxon,state.getTransactionalSourceReference(), null); |
|
347 |
taxon.addMisappliedName(misappliedNameTaxon, state.getTransactionalSourceReference(), null);
|
|
343 | 348 |
logger.warn("Misapplied name for common name was not found related to the accepted taxon. Created new relationship. CommonNameId: " + commonNameId); |
344 | 349 |
} |
345 | 350 |
|
351 |
//add common name also to missaplied taxon |
|
352 |
//TODO is this really wanted |
|
346 | 353 |
TaxonDescription misappliedNameDescription = getDescription(misappliedNameTaxon); |
347 | 354 |
for (CommonTaxonName commonTaxonName : commonTaxonNames){ |
348 | 355 |
CommonTaxonName commonNameClone = (CommonTaxonName)commonTaxonName.clone(); |
349 | 356 |
misappliedNameDescription.addElement(commonNameClone); |
357 |
doIdCreatedUpdatedNotes(state, commonNameClone, rs, String.valueOf(commonNameId), NAMESPACE); |
|
350 | 358 |
} |
351 | 359 |
}else{ |
352 | 360 |
//wird schon oben gelogged |
Also available in: Unified diff
ref #7449 try to fix common name import for names with no region and ref #7447 add misapplied name common name import source