Project

General

Profile

Revision 240bf2da

ID240bf2da8e0293d8e33e3da62ed601ec67c99a50
Parent 897ab6d1
Child e0dcd1d7

Added by Patrick Plitzner about 2 years ago

ref #7589 Delete taxon node from descriptive data set

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonNodeServiceImpl.java
44 44
import eu.etaxonomy.cdm.model.common.CdmBase;
45 45
import eu.etaxonomy.cdm.model.common.DefinedTerm;
46 46
import eu.etaxonomy.cdm.model.common.TreeIndex;
47
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
47 48
import eu.etaxonomy.cdm.model.description.TaxonDescription;
48 49
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
49 50
import eu.etaxonomy.cdm.model.name.HybridRelationship;
......
83 84
    private ITaxonService taxonService;
84 85

  
85 86
    @Autowired
87
    private IDescriptiveDataSetService dataSetService;
88

  
89
    @Autowired
86 90
    private IAgentService agentService;
87 91

  
88 92
    @Autowired
......
620 624
    	    result.includeResult(deleteTaxonNodes(node.getChildNodes(), config));
621 625
    	}
622 626

  
627
    	//remove node from DescriptiveDataSet
628
        commonService.getReferencingObjects(node).stream()
629
        .filter(obj->obj instanceof DescriptiveDataSet)
630
        .forEach(dataSet->{
631
            ((DescriptiveDataSet)dataSet).removeTaxonSubtree(node);
632
            dataSetService.saveOrUpdate((DescriptiveDataSet) dataSet);
633
        });
634

  
623 635
    	if (taxon != null){
624 636
        	if (config.getTaxonNodeConfig().isDeleteTaxon() && (config.isDeleteInAllClassifications() || taxon.getTaxonNodes().size() == 1)){
625 637
        		result = taxonService.deleteTaxon(taxon.getUuid(), config, node.getClassification().getUuid());

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)