Project

General

Profile

« Previous | Next » 

Revision 5f62bdc2

Added by Katja Luther 8 months ago

ref #9861: termtree contains map with applicable informations

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/CharacterNodeDto.java
9 9
package eu.etaxonomy.cdm.persistence.dto;
10 10

  
11 11
import java.util.ArrayList;
12
import java.util.HashSet;
12 13
import java.util.List;
13 14
import java.util.UUID;
14 15

  
......
59 60
        }
60 61
        dto.setChildren(children);
61 62
        dto.setOnlyApplicableIf(child.getOnlyApplicableIf());
63
        if (!dto.getOnlyApplicableIf().isEmpty()){
64
            for (FeatureStateDto stateDto:dto.getOnlyApplicableIf()){
65
                if (!treeDto.getOnlyApplicable().containsKey(dto.getTerm().getUuid())){
66
                    treeDto.getOnlyApplicable().put(dto.getTerm().getUuid(), new HashSet<>());
67
                }
68

  
69
                treeDto.getOnlyApplicable().get(dto.getTerm().getUuid()).add(stateDto);
70
            }
71
        }
62 72
        dto.setInapplicableIf(child.getInapplicableIf());
73
        if (!dto.getInapplicableIf().isEmpty()){
74
            for (FeatureStateDto stateDto:dto.getInapplicableIf()){
75
                if (!treeDto.getInapplicableMap().containsKey(dto.getTerm().getUuid())){
76
                    treeDto.getInapplicableMap().put(dto.getTerm().getUuid(), new HashSet<>());
77
                }
78

  
79
                treeDto.getInapplicableMap().get(dto.getTerm().getUuid()).add(stateDto);
80
            }
81
        }
82

  
63 83

  
64 84
        dto.setTermType(child.getTermType());
65 85

  
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TermTreeDto.java
31 31
    private static final long serialVersionUID = -7223363599985320531L;
32 32

  
33 33
    private TermNodeDto root;
34
    private Map<UUID, Set<FeatureStateDto>> inapplicableMap = new HashMap<>(); //a map <uuid of the parent feature, uuid of child feature, state> shows for a parent feature which features are inapplicable for specific state
35
    private Map<UUID, Set<FeatureStateDto>> onlyApplicableMap = new HashMap<>();
36

  
34 37

  
35 38
    public static TermTreeDto fromTree(TermTree tree){
36 39
        TermTreeDto dto = new TermTreeDto(tree.getUuid(), tree.getRepresentations(), tree.getTermType(), tree.getRoot(), tree.getTitleCache(), tree.isAllowDuplicates(), tree.isOrderRelevant(), tree.isFlat() );
......
172 175
        }
173 176
        return result;
174 177
    }
178

  
179
    /**
180
     * @return the inapplicableMap
181
     */
182
    public Map<UUID, Set<FeatureStateDto>> getInapplicableMap() {
183
        return inapplicableMap;
184
    }
185

  
186
    /**
187
     * @param inapplicableMap the inapplicableMap to set
188
     */
189
    public void setInapplicableMap(Map<UUID, Set<FeatureStateDto>> inapplicableMap) {
190
        this.inapplicableMap = inapplicableMap;
191
    }
192

  
193
    /**
194
     * @return the onlyApplicable
195
     */
196
    public Map<UUID, Set<FeatureStateDto>> getOnlyApplicable() {
197
        return onlyApplicableMap;
198
    }
199

  
200
    /**
201
     * @param onlyApplicable the onlyApplicable to set
202
     */
203
    public void setOnlyApplicable(Map<UUID, Set<FeatureStateDto>> onlyApplicable) {
204
        this.onlyApplicableMap = onlyApplicable;
205
    }
175 206
}

Also available in: Unified diff