Revision 5316cc5a
Added by Andreas Müller almost 13 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java | ||
---|---|---|
258 | 258 |
Integer childId = taxonDataHolder.getId(); |
259 | 259 |
UUID cdmUuid = taxonDataHolder.getCdmUuid(); |
260 | 260 |
Taxon acceptedTaxon; |
261 |
TaxonNameBase nameUsedInSource; |
|
261 | 262 |
|
262 | 263 |
if (cdmUuid != null){ |
263 | 264 |
TaxonBase taxonBase = getTaxonService().find(cdmUuid); |
264 | 265 |
acceptedTaxon = getAcceptedTaxon(taxonBase); |
266 |
nameUsedInSource = taxonBase.getName(); |
|
265 | 267 |
}else{ |
266 | 268 |
//TODO error handling for class cast |
267 | 269 |
Taxon parentTaxon = CdmBase.deproxy(state.getTaxonBase(parentId), Taxon.class); |
268 | 270 |
if (CdmUtils.isNotEmpty(taxonNameStr)) { |
269 | 271 |
TaxonBase taxonBase = state.getTaxonBase(childId); |
272 |
nameUsedInSource = taxonBase.getName(); |
|
270 | 273 |
nameStatus = CdmUtils.Nz(nameStatus).trim().toLowerCase(); |
271 | 274 |
if (validMarkers.contains(nameStatus)){ |
272 | 275 |
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class); |
... | ... | |
317 | 320 |
}else{//taxonNameStr is empty |
318 | 321 |
//vernacular name case |
319 | 322 |
acceptedTaxon = parentTaxon; |
323 |
nameUsedInSource = null; |
|
320 | 324 |
} |
321 | 325 |
} |
322 | 326 |
|
... | ... | |
328 | 332 |
handleCommonName(state, taxonNameStr, commonNameStr, acceptedTaxon); |
329 | 333 |
} |
330 | 334 |
|
331 |
handleFeatures(state, taxonDataHolder, acceptedTaxon); |
|
335 |
handleFeatures(state, taxonDataHolder, acceptedTaxon, nameUsedInSource);
|
|
332 | 336 |
} |
333 | 337 |
} catch (Exception e) { |
334 | 338 |
e.printStackTrace(); |
... | ... | |
342 | 346 |
* @param taxonDataHolder |
343 | 347 |
* @param acceptedTaxon |
344 | 348 |
*/ |
345 |
private void handleFeatures(TaxonExcelImportState state, NormalExplicitRow taxonDataHolder, Taxon acceptedTaxon) { |
|
349 |
private void handleFeatures(TaxonExcelImportState state, NormalExplicitRow taxonDataHolder, Taxon acceptedTaxon, TaxonNameBase nameUsedInSource) {
|
|
346 | 350 |
//feature |
347 | 351 |
for (UUID featureUuid : taxonDataHolder.getFeatures()){ |
348 | 352 |
Feature feature = getFeature(state, featureUuid); |
349 |
// Feature feature = CdmBase.deproxy(getTermService().find(featureUuid), Feature.class); |
|
350 | 353 |
List<String> textList = taxonDataHolder.getFeatureTexts(featureUuid); |
351 | 354 |
List<String> languageList = taxonDataHolder.getFeatureLanguages(featureUuid); |
352 | 355 |
|
353 |
|
|
354 | 356 |
for (int i = 0; i < textList.size(); i++){ |
355 | 357 |
String featureText = textList.get(i); |
356 | 358 |
String featureLanguage = languageList.get(i); |
... | ... | |
384 | 386 |
} |
385 | 387 |
if (refExists){ |
386 | 388 |
source.setCitation(ref); |
389 |
source.setNameUsedInSource(nameUsedInSource); |
|
387 | 390 |
} |
388 | 391 |
textData.addSource(source); |
389 | 392 |
} |
Also available in: Unified diff
nameUsedInSource added to NEEI