Project

General

Profile

« Previous | Next » 

Revision 0da64da4

Added by Katja Luther over 2 years ago

ref #9861: termnode contains featurestate as dto

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TermNodeDto.java
33 33
    private UUID parentUuid;
34 34
    private String treeIndex;
35 35
    private List<TermNodeDto> children;
36
    private Set<FeatureState> onlyApplicableIf = new HashSet<>();
37
    private Set<FeatureState> inapplicableIf = new HashSet<>();
36
    private Set<FeatureStateDto> onlyApplicableIf = new HashSet<>();
37
    private Set<FeatureStateDto> inapplicableIf = new HashSet<>();
38 38
    private UUID uuid;
39 39
    private TermDto term;
40 40
    private TermType type;
......
47 47
        if (treeDto != null){
48 48
            treeDto.addTerm(term);
49 49
        }
50

  
50 51
        TermNodeDto dto = new TermNodeDto(term, node.getParent() != null? node.getParent().getIndex(node): 0, treeDto != null? treeDto: TermTreeDto.fromTree((TermTree)node.getGraph()), node.getUuid(), node.treeIndex(), node.getPath());
51 52
        if (node.getParent() != null){
52 53
            dto.setParentUuid(node.getParent().getUuid());
53 54
        }
54

  
55
        
55 56
        List<TermNodeDto> children = new ArrayList<>();
56 57
        for (Object o: node.getChildNodes()){
57 58
            if (o instanceof TermNode){
......
152 153
        this.children = children;
153 154
    }
154 155

  
155
    public Set<FeatureState> getOnlyApplicableIf() {
156
    public Set<FeatureStateDto> getOnlyApplicableIf() {
156 157
        return onlyApplicableIf;
157 158
    }
158 159

  
159
    public void setOnlyApplicableIf(Set<FeatureState> onlyApplicableIf) {
160
    public void setOnlyApplicableIfDto(Set<FeatureStateDto> onlyApplicableIf) {
160 161
        this.onlyApplicableIf = onlyApplicableIf;
161 162
    }
163
    public void setOnlyApplicableIf(Set<FeatureState> onlyApplicableIf) {
164
        if (this.onlyApplicableIf == null){
165
            this.onlyApplicableIf = new HashSet<>();
166
        }
167
        for (FeatureState state: onlyApplicableIf){
168
            this.onlyApplicableIf.add(new FeatureStateDto(state.getUuid(), FeatureDto.fromFeature(state.getFeature()), TermDto.fromTerm(state.getState())));
169
        }
162 170

  
163
    public Set<FeatureState> getInapplicableIf() {
171
    }
172

  
173
    public Set<FeatureStateDto> getInapplicableIf() {
164 174
        return inapplicableIf;
165 175
    }
166 176

  
167
    public void setInapplicableIf(Set<FeatureState> inapplicableIf) {
177
    public void setInapplicableIfDto(Set<FeatureStateDto> inapplicableIf) {
168 178
        this.inapplicableIf = inapplicableIf;
169 179
    }
170 180

  
181
    public void setInapplicableIf(Set<FeatureState> inApplicableIf) {
182
        if (this.inapplicableIf == null){
183
            this.inapplicableIf = new HashSet<>();
184
        }
185
        for (FeatureState state: inApplicableIf){
186
            this.inapplicableIf.add( new FeatureStateDto(state.getUuid(),FeatureDto.fromFeature(state.getFeature()), TermDto.fromTerm(state.getState())));
187
        }
188

  
189
    }
190

  
171 191
    public UUID getUuid() {
172 192
        return uuid;
173 193
    }

Also available in: Unified diff