Project

General

Profile

Revision f44fb5c3

IDf44fb5c3c0626a2f02323f6f86832a755881c535
Parent 0c949c56
Child 3d36bbcd

Added by Katja Luther about 5 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
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/TaxonExcelImporterBase.java
56 56

  
57 57
	protected static final String SYNONYM_COLUMN = "Synonym";
58 58
	protected static final String DATE_COLUMN = "Date";
59
	protected static final String YEAR_COLUMN = "Year";
59 60
	protected static final String FAMILY_COLUMN = "Family";
60 61

  
61 62
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)