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/sdd/in/SDDImport.java
81 81
import eu.etaxonomy.cdm.model.name.INonViralName;
82 82
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
83 83
import eu.etaxonomy.cdm.model.name.Rank;
84
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
84
import eu.etaxonomy.cdm.model.name.TaxonName;
85 85
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
86 86
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
87 87
import eu.etaxonomy.cdm.model.reference.Reference;
......
115 115
    private Map<String,Reference> publications = new HashMap<>();
116 116
    private Map<String,State> states = new HashMap<>();
117 117
    private Map<String,TaxonDescription> taxonDescriptions = new HashMap<>();
118
    private Map<String,INonViralName> taxonNameBases = new HashMap<>();
118
    private Map<String,INonViralName> taxonNames = new HashMap<>();
119 119
    private Map<String,MeasurementUnit> units = new HashMap<>();
120 120
    private Map<String,TaxonNode> taxonNodes = new HashMap<>();
121 121
    private Map<String,NamedArea> namedAreas = new HashMap<>();
......
170 170
	    publications = new HashMap<>();
171 171
	    states = new HashMap<>();
172 172
	    taxonDescriptions = new HashMap<>();
173
	    taxonNameBases = new HashMap<>();
173
	    taxonNames = new HashMap<>();
174 174
	    units = new HashMap<>();
175 175
	    taxonNodes = new HashMap<>();
176 176
	    namedAreas = new HashMap<>();
......
490 490
					Element elRepresentation, Map<Language, List<String>> langLabDet) {
491 491
		List<String> labDet = null;
492 492

  
493
		if (ie instanceof TaxonNameBase) {
493
		if (ie instanceof TaxonName) {
494 494
			if (langLabDet.keySet().contains(getTermService().getLanguageByIso("la"))) {
495 495
				labDet = langLabDet.get(getTermService().getLanguageByIso("la"));
496 496
			} else if (langLabDet.keySet().contains(datasetLanguage)) {
......
504 504
			labDet = langLabDet.get(langLabDet.keySet().iterator().next());
505 505
		}
506 506

  
507
		//FIXME labDet is != null only for TaxonNameBase
507
		//FIXME labDet is != null only for TaxonName
508 508
		ie.setTitleCache(labDet.get(0), true);
509 509

  
510 510
		if (labDet.size()>1) {
......
916 916
				String id = elTaxonName.getAttributeValue("id");
917 917
				String uri = elTaxonName.getAttributeValue("uri");
918 918

  
919
				TaxonNameBase<?,?> tnb = null;
919
				TaxonName tnb = null;
920 920
				if (!id.equals("")) {
921 921
					tnb = TaxonNameFactory.NewNonViralInstance(defaultRank);
922 922
					IdentifiableSource source = null;
......
927 927
						source = IdentifiableSource.NewDataImportInstance(id, "TaxonName");
928 928
					}
929 929
					tnb.addSource(source);
930
					taxonNameBases.put(id,tnb);
930
					taxonNames.put(id,tnb);
931 931
				}
932 932

  
933 933
				// <Representation>
......
1223 1223
	private Taxon handleCDNoScope(Namespace sddNamespace,
1224 1224
	        SDDImportState cdmState, Element elCodedDescription	) {
1225 1225
		Taxon taxon = null;
1226
		TaxonNameBase<?,?> nonViralName = TaxonNameFactory.NewNonViralInstance(defaultRank);
1226
		TaxonName nonViralName = TaxonNameFactory.NewNonViralInstance(defaultRank);
1227 1227
		String id = new String("" + taxonNamesCount);
1228 1228
		IdentifiableSource source = IdentifiableSource.NewDataImportInstance(id, "TaxonName");
1229 1229
		importRepresentation(elCodedDescription, sddNamespace, nonViralName, id, cdmState);
......
1234 1234

  
1235 1235
		if(taxon != null){
1236 1236
			nonViralName = CdmBase.deproxy(taxon.getName());
1237
//							taxonNameBases.put(id ,tnb);
1237
//							taxonNames.put(id ,tnb);
1238 1238
//							taxonNamesCount++;
1239 1239
			logger.info("using existing Taxon " + taxon.getTitleCache());
1240 1240
		} else {
1241 1241
			nonViralName.addSource(source);
1242
			taxonNameBases.put(id, nonViralName);
1242
			taxonNames.put(id, nonViralName);
1243 1243
			taxonNamesCount++;
1244 1244
			logger.info("creating new Taxon from TaxonName " + nonViralName.getTitleCache());
1245 1245
			taxon = Taxon.NewInstance(nonViralName, sec);
......
1260 1260
		Taxon taxon = null;
1261 1261
		Element elTaxonName = elScope.getChild("TaxonName", sddNamespace);
1262 1262
		String ref = elTaxonName.getAttributeValue("ref");
1263
		INonViralName nonViralName = taxonNameBases.get(ref);
1263
		INonViralName nonViralName = taxonNames.get(ref);
1264 1264

  
1265 1265
		if(cdmState.getConfig().isReuseExistingTaxaWhenPossible()){
1266 1266
			taxon = getTaxonService().findBestMatchingTaxon(nonViralName.getTitleCache());
......
1269 1269
		if(taxon != null){
1270 1270
			logger.info("using existing Taxon" + taxon.getTitleCache());
1271 1271
			if(!nonViralName.getUuid().equals(taxon.getName().getUuid())){
1272
				logger.warn("TaxonNameBase entity of existing taxon does not match Name in list -> replacing Name in list");
1272
				logger.warn("TaxonName entity of existing taxon does not match Name in list -> replacing Name in list");
1273 1273
				nonViralName = taxon.getName();
1274 1274
			}
1275 1275
		} else {
......
1649 1649
									//											rb.addMedia(me);
1650 1650
									//										}
1651 1651
									//									}
1652
//								 else if (lcb.get(k) instanceof TaxonNameBase){
1653
//									TaxonNameBase tb = (TaxonNameBase) lcb.get(k);
1652
//								 else if (lcb.get(k) instanceof TaxonName){
1653
//									TaxonName tb = (TaxonName) lcb.get(k);
1654 1654
//									tb.addMedia(media);
1655 1655
								} else {
1656 1656
									logger.warn("Can't handle associated media for " + lcb.get(k).getId() + "(" +  lcb.get(k).getClass().getSimpleName()+")"  );
......
1905 1905
							if (!idN.equals("")) {
1906 1906
								Element elTaxonName = elNode.getChild("TaxonName", sddNamespace);
1907 1907
								String refTN = elTaxonName.getAttributeValue("ref");
1908
								tnb = taxonNameBases.get(refTN);
1908
								tnb = taxonNames.get(refTN);
1909 1909
								Taxon taxon = tnb.getTaxa().iterator().next() ;
1910 1910
								Element elParent = elNode.getChild("Parent", sddNamespace);
1911 1911
								if (elParent!=null){

Also available in: Unified diff