Project

General

Profile

Revision abb1217f

IDabb1217f30e8f8c6229265ecd69258fdcb168a65
Parent abde1c30
Child cb3409ef

Added by Andreas Müller about 7 years ago

Formatting for aggregates with Authors (E+M exception)

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategy.java
9 9
package eu.etaxonomy.cdm.strategy.cache.name;
10 10

  
11 11
import java.util.ArrayList;
12
import java.util.Arrays;
13
import java.util.Collections;
14 12
import java.util.Iterator;
15 13
import java.util.List;
16 14
import java.util.Set;
......
525 523
//			String nameCache = nonViralName.getNameCache();  //OLD: CdmUtils.Nz(getNameCache(nonViralName));
526 524
            List<TaggedText> nameTags = getTaggedName(nonViralName);
527 525
            tags.addAll(nameTags);
528
            if (nameIncludesAuthorship(nonViralName)){
529
                String authorCache = getAuthorshipCache(nonViralName);
530
                if (StringUtils.isNotBlank(authorCache)){
531
                    tags.add(new TaggedText(TagEnum.authors, authorCache));
532
                }
526
            String authorCache = getAuthorshipCache(nonViralName);
527
            if (StringUtils.isNotBlank(authorCache)){
528
                tags.add(new TaggedText(TagEnum.authors, authorCache));
533 529
            }
534 530
        }
535 531
        return tags;
......
557 553
//			result = getUnrankedInfragenericNameCache(nonViralName);
558 554
        }else if (rank.isInfraSpecific()){
559 555
            tags = getInfraSpeciesTaggedNameCache(nonViralName);
560
        }else if (rank.isSpecies()){
556
        }else if (rank.isSpecies() || isAggregateWithAuthorship(nonViralName, rank) ){ //exception see #4288
561 557
            tags = getSpeciesTaggedNameCache(nonViralName);
562 558
        }else if (rank.isInfraGeneric()){
563 559
            tags = getInfraGenusTaggedNameCache(nonViralName);
......
581 577
//***************************** PRIVATES ***************************************/
582 578

  
583 579

  
584
    /**
580
    private boolean isAggregateWithAuthorship(T nonViralName, Rank rank) {
581
		if (rank == null){
582
			return false;
583
		}else{
584
			return rank.isSpeciesAggregate() && ( isNotBlank(nonViralName.getAuthorshipCache()) || nonViralName.getNomenclaturalReference() != null );
585
		}
586
	}
587

  
588

  
589
	/**
585 590
     * Returns the tag list for an autonym taxon.
586 591
     *
587 592
     * @see NonViralName#isAutonym()
......
629 634
	            //TODO handle exception
630 635
	            logger.warn("Rank for autonym does not exist or is not lower than species !!");
631 636
	        }else{
632
	            String infraGenericMarker = nonViralName.getRank().getAbbreviation();
637
	        	Rank rank = nonViralName.getRank();
638
	            String infraGenericMarker = rank.getAbbreviation();
639
                if (rank.equals(Rank.SECTION_BOTANY()) || rank.equals(Rank.SUBSECTION_BOTANY())){
640
                	infraGenericMarker = infraGenericMarker.replace("(bot.)", "");
641
                }
633 642
	            if (StringUtils.isNotBlank(infraGenericMarker)){
634 643
	                tags.add(new TaggedText(TagEnum.rank, infraGenericMarker));
635 644
	            }
......
711 720
     */
712 721
    protected List<TaggedText> getInfraGenusTaggedNameCache(NonViralName<T> nonViralName){
713 722
        Rank rank = nonViralName.getRank();
714
        if (rank != null && rank.isSpeciesAggregate()){
723
        if (rank != null && rank.isSpeciesAggregate() && isBlank(nonViralName.getAuthorshipCache())){
715 724
            return getSpeciesAggregateTaggedCache(nonViralName);
716 725
        }
717 726

  
......
766 775
     * @return
767 776
     */
768 777
    protected List<TaggedText> getSpeciesAggregateTaggedCache(NonViralName<?> nonViralName){
769
        List<TaggedText> tags = getGenusAndSpeciesTaggedPart(nonViralName);
778
        if (! isBlank(nonViralName.getAuthorshipCache())){
779
        	List<TaggedText> result = getSpeciesTaggedNameCache(nonViralName);
780
        	return result;
781
        }
782
    	
783
    	
784
    	List<TaggedText> tags = getGenusAndSpeciesTaggedPart(nonViralName);
770 785

  
771 786
        addSpeciesAggregateTaggedEpithet(tags, nonViralName);
772 787
        addAppendedTaggedPhrase(tags, nonViralName);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)