Project

General

Profile

Revision ef92e1f6

IDef92e1f650be6328f4e3d5b466169ce0f32c1d9d
Parent ae115efe
Child 83efeb94

Added by Andreas Müller 2 months ago

fix #9790 remove highest status only for DDS source aggregation

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/description/AggregationSourceMode.java
9 9
package eu.etaxonomy.cdm.api.service.description;
10 10

  
11 11
import java.util.ArrayList;
12
import java.util.EnumSet;
13
import java.util.HashSet;
12 14
import java.util.List;
15
import java.util.Set;
13 16

  
14 17
import eu.etaxonomy.cdm.model.common.Language;
15 18
import eu.etaxonomy.cdm.model.term.IKeyTerm;
16 19

  
17 20
public enum AggregationSourceMode implements IKeyTerm{
18
    NONE("NO", "None", true, true, false),
19
    ALL("ALL", "All sources", true, true, true),
20
    ALL_SAMEVALUE("ALSV", "All sources with highest status", true, true, true),
21
    DESCRIPTION("DESC","Link to underlying description", true, true, false),
22
    TAXON("TAX","Link to child taxon", false, true, false);
21
    NONE("NO", "None",           true , true, false, true, true ),
22
    ALL("ALL", "All sources",    true , true, true , true, true ),
23
    ALL_SAMEVALUE("ALSV", "All sources with highest status",
24
                                 true , true, true , true, false),
25
    DESCRIPTION("DESC","Link to underlying description",
26
                                 true , true, false, true, true ),
27
    TAXON("TAX","Link to child taxon",
28
                                 false, true, false, true, true );
23 29

  
24 30
    final private String key;
25 31
    final private String label;
26 32
    final private boolean supportsWithinTaxon;
27 33
    final private boolean supportsToParent;
28 34
    final private boolean supportsOriginalSourceType;
35
    final private EnumSet<AggregationType> supportedAggregationTypes;
29 36

  
30 37
    private AggregationSourceMode(String key, String message, boolean supportsWithinTaxon,
31
            boolean supportsToParent, boolean supportsOriginalSourceType) {
38
            boolean supportsToParent, boolean supportsOriginalSourceType, boolean supportsDistribution, boolean supportsStructuredDescription) {
32 39
        this.key = key;
33 40
        this.label = message;
34 41
        this.supportsWithinTaxon = supportsWithinTaxon;
35 42
        this.supportsToParent = supportsToParent;
36 43
        this.supportsOriginalSourceType = supportsOriginalSourceType;
44
        Set<AggregationType> aggTypes = new HashSet<>();
45
        if (supportsDistribution){
46
            aggTypes.add(AggregationType.Distribution);
47
        }
48
        if (supportsStructuredDescription){
49
            aggTypes.add(AggregationType.StructuredDescription);
50
        }
51
        this.supportedAggregationTypes = EnumSet.copyOf(aggTypes);
37 52
    }
38 53

  
39 54
    @Override
......
69 84
     * given {@link AggregationMode} and {@link AggregationType}
70 85
     */
71 86
    public static List<AggregationSourceMode> list(AggregationMode aggregationMode, AggregationType type){
72
        //TODO currently aggType is not yet used as all source modes are available for all aggTypes
73 87
        List<AggregationSourceMode> result = new ArrayList<>();
74 88
        for(AggregationSourceMode mode : values()){
89
            if (type != null && !mode.supportedAggregationTypes.contains(type)){
90
                continue;
91
            }
75 92
            if (aggregationMode == AggregationMode.WithinTaxon && mode.supportsWithinTaxon){
76 93
                result.add(mode);
77 94
            }else if (aggregationMode == AggregationMode.ToParent && mode.supportsToParent){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)