Project

General

Profile

Revision a083a070

IDa083a0708ab14dfabe673b1ed77feaf1166f67d2
Parent 1a5b2194
Child 8efb1fe4

Added by Patrick Plitzner about 1 year ago

ref #7597 Fix concurrent modification exception

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptiveDataSetService.java
11 11
import java.util.Optional;
12 12
import java.util.Set;
13 13
import java.util.UUID;
14
import java.util.stream.Collectors;
14 15

  
15 16
import org.apache.log4j.Logger;
16 17
import org.springframework.beans.factory.annotation.Autowired;
......
412 413
        });
413 414

  
414 415
        // delete all aggregation description of this dataset (MarkerType.COMPUTED)
415
        dataSet.getDescriptions().stream()
416
        List<TaxonDescription> toRemove = dataSet.getDescriptions().stream()
416 417
        .filter(aggDesc->aggDesc instanceof TaxonDescription)
417 418
        .filter(desc -> desc.getMarkers().stream().anyMatch(marker -> marker.getMarkerType().equals(MarkerType.COMPUTED())))
418 419
        .map(aggDesc->(TaxonDescription)aggDesc)
419
        .forEach(aggregatedDescription->{
420
            removeDescription(aggregatedDescription.getUuid(), descriptiveDataSetUuid);
421
            taxon.removeDescription(aggregatedDescription);
422
            descriptionService.delete(aggregatedDescription);
423
        });
420
        .collect(Collectors.toList());
421
        for (TaxonDescription taxonDescription : toRemove) {
422
            dataSet.removeDescription(taxonDescription);
423
            taxon.removeDescription(taxonDescription);
424
        }
424 425

  
425 426
        // create new aggregation
426 427
        TaxonDescription description = TaxonDescription.NewInstance(taxon);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)