Project

General

Profile

« Previous | Next » 

Revision 9dc896c9

Added by Andreas Müller almost 7 years ago

fix #6368 rename table and class TaxonNameBase

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java
52 52
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
53 53
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
54 54
import eu.etaxonomy.cdm.model.name.Rank;
55
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
55
import eu.etaxonomy.cdm.model.name.TaxonName;
56 56
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
57 57
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
58 58
import eu.etaxonomy.cdm.model.reference.Reference;
......
327 327
			String childId = taxonDataHolder.getId();
328 328
			UUID cdmUuid = taxonDataHolder.getCdmUuid();
329 329
			Taxon acceptedTaxon = null;
330
			TaxonNameBase<?,?> nameUsedInSource = null;
330
			TaxonName nameUsedInSource = null;
331 331
			TaxonBase<?> taxonBase = null;
332 332
			Taxon parentTaxon = null;
333 333

  
......
522 522
	 * @param taxonDataHolder
523 523
	 * @param acceptedTaxon
524 524
	 */
525
	private void handleFeatures(TaxonExcelImportState state, NormalExplicitRow taxonDataHolder, Taxon acceptedTaxon, TaxonNameBase nameUsedInSource) {
525
	private void handleFeatures(TaxonExcelImportState state, NormalExplicitRow taxonDataHolder, Taxon acceptedTaxon, TaxonName nameUsedInSource) {
526 526
		//feature
527 527
		for (UUID featureUuid : taxonDataHolder.getFeatures()){
528 528
			Feature feature = getFeature(state, featureUuid);
......
761 761
	private TaxonBase<?> createTaxon(TaxonExcelImportState state, Rank rank, String taxonNameStr,
762 762
			String authorStr, String publishingAutorStr, String basionymAuthor, String reference, String date, String nameStatus, NomenclaturalCode nc) {
763 763
		TaxonBase<?> taxonBase;
764
		INonViralName taxonNameBase = null;
764
		INonViralName taxonName = null;
765 765
		if (nc == NomenclaturalCode.ICVCN){
766 766
			logger.warn("ICVCN not yet supported");
767 767

  
768 768
		}else{
769 769
		    //String taxonNameStr = titleCache.substring(0, titleCache.indexOf(authorStr));
770
			taxonNameBase = nc.getNewTaxonNameInstance(rank);
770
			taxonName = nc.getNewTaxonNameInstance(rank);
771 771
			NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance();
772
			taxonNameBase = parser.parseFullName(taxonNameStr, nc, rank);
772
			taxonName = parser.parseFullName(taxonNameStr, nc, rank);
773 773

  
774
			if (! taxonNameBase.getNameCache().equals(taxonNameStr)){
775
				taxonNameBase.setNameCache(taxonNameStr, true);
774
			if (! taxonName.getNameCache().equals(taxonNameStr)){
775
				taxonName.setNameCache(taxonNameStr, true);
776 776
			}
777 777

  
778 778
			// Create the author
779 779
			if (StringUtils.isNotBlank(authorStr)) {
780 780
				try {
781
					parser.parseAuthors(taxonNameBase, authorStr);
781
					parser.parseAuthors(taxonName, authorStr);
782 782
				} catch (StringNotParsableException e) {
783
					taxonNameBase.setAuthorshipCache(authorStr);
783
					taxonName.setAuthorshipCache(authorStr);
784 784
 				}
785 785
			}
786 786
			if (StringUtils.isNotBlank(reference)) {
787 787

  
788 788
			    INomenclaturalReference ref = parser.parseReferenceTitle(reference, date, true);
789 789
			    if (ref.getAuthorship() == null){
790
			        ref.setAuthorship(taxonNameBase.getCombinationAuthorship());
790
			        ref.setAuthorship(taxonName.getCombinationAuthorship());
791 791
			    }
792 792

  
793 793
			    if (ref.getAbbrevTitle() == null && !ref.isOfType(ReferenceType.Article)) {
......
797 797

  
798 798
                ref.setProtectedTitleCache(false);
799 799

  
800
			    taxonNameBase.setNomenclaturalReference(ref);
801
			    taxonNameBase.setNomenclaturalMicroReference(state.getCurrentRow().getCollation());
800
			    taxonName.setNomenclaturalReference(ref);
801
			    taxonName.setNomenclaturalMicroReference(state.getCurrentRow().getCollation());
802 802
			}
803 803
		}
804 804

  
......
807 807
		// Create the status
808 808
		nameStatus = CdmUtils.Nz(nameStatus).trim().toLowerCase();
809 809
		if (validMarkers.contains(nameStatus)){
810
			taxonBase = Taxon.NewInstance(taxonNameBase, sec);
810
			taxonBase = Taxon.NewInstance(taxonName, sec);
811 811
		}else if (synonymMarkers.contains(nameStatus)){
812
			taxonBase = Synonym.NewInstance(taxonNameBase, sec);
812
			taxonBase = Synonym.NewInstance(taxonName, sec);
813 813
		}else {
814
			Taxon taxon = Taxon.NewInstance(taxonNameBase, sec);
814
			Taxon taxon = Taxon.NewInstance(taxonName, sec);
815 815
			if (nameStatusMarkers.contains(nameStatus)){
816 816
			    if (nameStatus.equals(NOM_ILLEG)){
817
			        taxonNameBase.addStatus(NomenclaturalStatusType.ILLEGITIMATE(), null, null);
817
			        taxonName.addStatus(NomenclaturalStatusType.ILLEGITIMATE(), null, null);
818 818
			    } else if (nameStatus.equals(NOM_REJ)){
819
			        taxonNameBase.addStatus(NomenclaturalStatusType.REJECTED(), null, null);
819
			        taxonName.addStatus(NomenclaturalStatusType.REJECTED(), null, null);
820 820
			    } else if (nameStatus.equals(NOM_CONS)){
821
                    taxonNameBase.addStatus(NomenclaturalStatusType.CONSERVED(), null, null);
821
                    taxonName.addStatus(NomenclaturalStatusType.CONSERVED(), null, null);
822 822
                }
823 823
			}else{
824 824
			    taxon.setTaxonStatusUnknown(true);
......
838 838
	//TODO implementation must be improved when matching of taxon names with existing names is implemented
839 839
	//=> the assumption that the only description is the description added by this import
840 840
	//is wrong then
841
	private TaxonNameDescription getNameDescription(TaxonNameBase<?,?> name) {
841
	private TaxonNameDescription getNameDescription(TaxonName<?,?> name) {
842 842
		Set<TaxonNameDescription> descriptions = name.getDescriptions();
843 843
		if (descriptions.size()>1){
844 844
			throw new IllegalStateException("Implementation does not yet support names with multiple descriptions");

Also available in: Unified diff