Project

General

Profile

Revision d1238e5b

IDd1238e5b8520ec3f72df1a6a2f6550216c2d212b
Parent 4bbec44a
Child 1210623a

Added by Patrick Plitzner over 2 years ago

ref #7597 Implement taxon description aggregation

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptionServiceImpl.java
847 847

  
848 848
    }
849 849

  
850
    public UpdateResult aggregateTaxonDescriptions(UUID taxonNodeUuid){
850
    @Override
851
    public UpdateResult aggregateComputedTaxonDescriptions(UUID taxonNodeUuid){
851 852
        UpdateResult result = new UpdateResult();
852 853

  
853 854
        TaxonNode node = taxonNodeDao.load(taxonNodeUuid);
......
856 857

  
857 858
        //get all "computed" descriptions from all sub nodes
858 859
        List<TaxonNode> childNodes = taxonNodeDao.listChildrenOf(node, null, null, true, false, null);
859
        List<DescriptionBase> computedDescriptions = new ArrayList<>();
860
        List<TaxonDescription> computedDescriptions = new ArrayList<>();
860 861

  
861 862
        childNodes.stream().map(childNode -> childNode.getTaxon())
862 863
                .forEach(childTaxon -> childTaxon.getDescriptions().stream()
......
866 867
                        // add them to the list
867 868
                        .forEach(computedDescription -> computedDescriptions.add(computedDescription)));
868 869

  
870
        result.includeResult(aggregateDescription(taxon, computedDescriptions, taxon.getTitleCache()));
869 871
        return result;
870 872
    }
871 873

  
......
888 890
    }
889 891

  
890 892
    @SuppressWarnings("unchecked")
891
    public UpdateResult aggregateDescription(Taxon taxon, List<DescriptionBase> descriptions, String descriptionTitle) {
893
    private UpdateResult aggregateDescription(Taxon taxon, List<? extends DescriptionBase> descriptions, String descriptionTitle) {
892 894
        UpdateResult result = new UpdateResult();
893 895
        Map<Character, List<DescriptionElementBase>> featureToElementMap = new HashMap<>();
894 896

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IDescriptionService.java
618 618
     * @return the result of the operation
619 619
     */
620 620
    public UpdateResult aggregateDescription(UUID taxonUuid, List<UUID> descriptionUuids, String descriptionTitle);
621

  
622
    /**
623
     * Aggregates all {@link TaxonDescription}s of all sub nodes that have a "computed" marker
624
     * @param taxonNodeUuid the parent taxon node
625
     * @return the result of the operation
626
     */
627
    public UpdateResult aggregateComputedTaxonDescriptions(UUID taxonNodeUuid);
621 628
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)