Project

General

Profile

« Previous | Next » 

Revision 24617f27

Added by Katja Luther over 7 years ago

normal explicit excel import: add reference to name import

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java
50 50
import eu.etaxonomy.cdm.model.name.NonViralName;
51 51
import eu.etaxonomy.cdm.model.name.Rank;
52 52
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
53
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
53 54
import eu.etaxonomy.cdm.model.reference.Reference;
54 55
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
55 56
import eu.etaxonomy.cdm.model.taxon.Classification;
......
139 140
		} else if(key.equalsIgnoreCase(IMAGE_COLUMN)) {
140 141
			normalExplicitRow.putImage(index, value);
141 142

  
142
		} else if(key.equalsIgnoreCase(DATE_COLUMN)) {
143
		} else if(key.equalsIgnoreCase(DATE_COLUMN) || key.equalsIgnoreCase(YEAR_COLUMN)) {
143 144
            normalExplicitRow.setDate(value);
144 145

  
145 146
        } else if(key.equalsIgnoreCase(FAMILY_COLUMN)) {
......
217 218
				}
218 219

  
219 220
	            //taxon
220
				taxonBase = createTaxon(state, rank, taxonNameStr, authorStr, referenceStr, nameStatus);
221
				taxonBase = createTaxon(state, rank, taxonNameStr, authorStr, referenceStr, dateStr, nameStatus);
221 222
			}else{
222 223
				return;
223 224
			}
......
561 562
	 * @return
562 563
	 */
563 564
	private TaxonBase createTaxon(TaxonExcelImportState state, Rank rank,
564
			String taxonNameStr, String authorStr, String reference, String nameStatus) {
565
			String taxonNameStr, String authorStr, String reference, String date, String nameStatus) {
565 566
		// Create the taxon name object depending on the setting of the nomenclatural code
566 567
		// in the configurator (botanical code, zoological code, etc.)
567 568
		if (StringUtils.isBlank(taxonNameStr)){
......
585 586
			logger.info("Matching taxon/synonym found for " + titleCache);
586 587
			return null;
587 588
		}else {
588
			taxonBase = createTaxon(state, rank, taxonNameStr, authorStr, reference, nameStatus, nc);
589
			taxonBase = createTaxon(state, rank, taxonNameStr, authorStr, reference, date, nameStatus, nc);
589 590
		}
590 591
		return taxonBase;
591 592
	}
......
604 605
	 * @return
605 606
	 */
606 607
	private TaxonBase<?> createTaxon(TaxonExcelImportState state, Rank rank, String taxonNameStr,
607
			String authorStr, String reference, String nameStatus, NomenclaturalCode nc) {
608
			String authorStr, String reference, String date, String nameStatus, NomenclaturalCode nc) {
608 609
		TaxonBase<?> taxonBase;
609 610
		NonViralName<?> taxonNameBase = null;
610 611
		if (nc == NomenclaturalCode.ICVCN){
......
628 629
					taxonNameBase.setAuthorshipCache(authorStr);
629 630
 				}
630 631
			}
632
			if (StringUtils.isNotBlank(reference)) {
633
			    INomenclaturalReference ref = parser.parseReferenceTitle(reference, date, false);
634
			    taxonNameBase.setNomenclaturalReference(ref);
635
			}
631 636
		}
632 637

  
633 638
		//Create the taxon

Also available in: Unified diff