Project

General

Profile

Revision cfcf723b

IDcfcf723b6485a38d3b39e4d53696036d212d6d6c
Parent 9b0b5ecb
Child 74bdd593, 941a7fd0

Added by Andreas Kohlbecker almost 2 years ago

fix #7874 updating also the nomenclaturalTitle in updateTitleCacheForSingleEntity()

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IdentifiableServiceBase.java
15 15
import java.util.HashSet;
16 16
import java.util.List;
17 17
import java.util.Map;
18
import java.util.Objects;
18 19
import java.util.Set;
19 20
import java.util.UUID;
20 21

  
......
30 31
import eu.etaxonomy.cdm.common.monitor.DefaultProgressMonitor;
31 32
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
32 33
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
34
import eu.etaxonomy.cdm.model.agent.Person;
35
import eu.etaxonomy.cdm.model.agent.Team;
33 36
import eu.etaxonomy.cdm.model.common.CdmBase;
34 37
import eu.etaxonomy.cdm.model.common.DefinedTerm;
35 38
import eu.etaxonomy.cdm.model.common.ISourceable;
......
380 383
		String oldNameCache = null;
381 384
		String oldFullTitleCache = null;
382 385
		String oldAbbrevTitleCache = null;
386
        String oldNomenclaturalTitle = null;
383 387
		if (entity instanceof TaxonName ){
384 388
		    if (((TaxonName) entity).isNonViral()) {
385 389
                try{
......
405 409
				oldAbbrevTitleCache = ref.getAbbrevTitleCache();
406 410
				ref.setProtectedAbbrevTitleCache(false);
407 411
			}
408
		}
412
		} else if (entity instanceof Team){
413
            Team team = (Team) entity;
414
            if(!team.isProtectedTitleCache()){
415
                team.setProtectedNomenclaturalTitleCache(true);
416
                oldNomenclaturalTitle = team.getNomenclaturalTitle();
417
                team.setProtectedNomenclaturalTitleCache(false);
418
            }
419
        } else if (entity instanceof Person){
420
            // Person has no flag so for for protecting the nomenclaturalTitle
421
            Person person = (Person) entity;
422
            oldNomenclaturalTitle = person.getNomenclaturalTitle();
423
        }
409 424
		setOtherCachesNull(entity);
410 425
		String newTitleCache= null;
411 426
		INonViralName nvn = null; //TODO find better solution
......
454 469
			if ( (oldAbbrevTitleCache == null && !ref.isProtectedAbbrevTitleCache() ) || (oldAbbrevTitleCache != null && !oldAbbrevTitleCache.equals(newAbbrevTitleCache))){
455 470
				entitiesToUpdate.add(entity);
456 471
			}
457
		}
472
		}else if (entity instanceof Team){
473
		    Team team = (Team) entity;
474
            String newNomenclaturalTitle = team.getNomenclaturalTitle();
475
            if ( (oldNomenclaturalTitle == null && !team.isProtectedNomenclaturalTitleCache() ) || !Objects.equals(oldNomenclaturalTitle, newNomenclaturalTitle)){
476
                entitiesToUpdate.add(entity);
477
            }
478
        }else if (entity instanceof Person){
479
            Person person = (Person) entity;
480
            String newNomenclaturalTitle = person.getNomenclaturalTitle();
481
            if (!Objects.equals(oldNomenclaturalTitle, newNomenclaturalTitle)){
482
                entitiesToUpdate.add(entity);
483
            }
484
        }
458 485
	}
459 486

  
460 487

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)