Project

General

Profile

« Previous | Next » 

Revision 64367d00

Added by Katja Luther over 8 years ago

minor

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonNameImport.java
36 36
import eu.etaxonomy.cdm.model.reference.Reference;
37 37
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
38 38
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
39
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser;
40
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
39 41

  
40 42
@Component("tcsXmlTaxonNameIO")
41 43
public class TcsXmlTaxonNameImport extends TcsXmlImportBase implements ICdmIO<TcsXmlImportState> {
......
43 45

  
44 46
	private static int modCount = 5000;
45 47

  
48
	private static INonViralNameParser parser = new NonViralNameParserImpl();
49

  
46 50
	public TcsXmlTaxonNameImport(){
47 51
		super();
48 52
	}
......
295 299
			obligatory = true;
296 300
			Element elSimple = XmlHelp.getSingleChildElement(success, elTaxonName, childName, tcsNamespace, obligatory);
297 301
			String simple = (elSimple == null)? "" : elSimple.getTextNormalize();
298
			nameBase.setTitleCache(simple, false);
302
			nameBase.setTitleCache(simple, true);
299 303
			elementList.add(childName.toString());
300 304

  
301 305
			childName = "CanonicalName";
......
381 385
				childName = "Authorship";
382 386
				obligatory = false;
383 387
				Element elAuthorship = XmlHelp.getSingleChildElement(success, elCanonicalAuthorship, childName, ns, obligatory);
384
				TeamOrPersonBase author = makeNameCitation(elAuthorship, authorMap, success);
388
				TeamOrPersonBase author = makeNameCitation(elAuthorship, authorMap, success, nonViralName, false);
385 389
				nonViralName.setCombinationAuthorship(author);
386 390
				//setCombinationAuthorship(author);
387 391
				testNoMoreElements();
......
389 393
				childName = "BasionymAuthorship";
390 394
				obligatory = false;
391 395
				Element elBasionymAuthorship = XmlHelp.getSingleChildElement(success, elCanonicalAuthorship, childName, ns, obligatory);
392
				TeamOrPersonBase<?> basionymAuthor = makeNameCitation(elBasionymAuthorship, authorMap, success);
396
				TeamOrPersonBase<?> basionymAuthor = makeNameCitation(elBasionymAuthorship, authorMap, success, nonViralName, true);
393 397
				nonViralName.setBasionymAuthorship(basionymAuthor);
394 398
				testNoMoreElements();
395 399

  
396 400
				childName = "CombinationAuthorship";
397 401
				obligatory = false;
398 402
				Element elCombinationAuthorship = XmlHelp.getSingleChildElement(success, elCanonicalAuthorship, childName, ns, obligatory);
399
				TeamOrPersonBase<?> combinationAuthor = makeNameCitation(elCombinationAuthorship, authorMap ,success);
403
				TeamOrPersonBase<?> combinationAuthor = makeNameCitation(elCombinationAuthorship, authorMap ,success, nonViralName, false);
400 404
				if (combinationAuthor != null){
401 405
					nonViralName.setCombinationAuthorship(combinationAuthor);
402 406
				}
......
546 550
	private void makePublishedIn(TaxonNameBase name, Element elPublishedIn, MapWrapper<Reference> referenceMap, ResultWrapper<Boolean> success){
547 551
		if (elPublishedIn != null && name != null){
548 552
			Class<Reference> clazz = Reference.class;
553

  
549 554
			Reference<?> ref = makeReferenceType(elPublishedIn, clazz, referenceMap, success);
550 555
			if (ref instanceof Reference){
556

  
557
			    String titleCache = ref.getTitleCache();
558

  
559
			    ref.setAuthorship(((NonViralName)name).getCombinationAuthorship());
560

  
561
			   ref.setAbbrevTitleCache(titleCache, true);
562
			   ref.setAbbrevTitle(titleCache);
563
			   ref.setProtectedTitleCache(false);
564

  
551 565
				name.setNomenclaturalReference(ref);
566
				name.setProtectedFullTitleCache(false);
567
				name.getFullTitleCache();
568
				name.setProtectedFullTitleCache(true);
552 569
			}else if (ref == null){
553 570
				logger.warn("Nomecl. reference could not be created for '" + name.getTitleCache() + "'");
554 571
			}else{

Also available in: Unified diff