Project

General

Profile

Revision 86c4f235

ID86c4f235db409fb7c11f8b4141f2a54582685c46
Parent dd5cea54
Child fac15f07

Added by Katja Luther over 4 years ago

move taxonNodeFiler to model

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/filter/LogicFilter.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.filter;
11

  
12
import java.util.UUID;
13

  
14
import eu.etaxonomy.cdm.model.common.CdmBase;
15
import eu.etaxonomy.cdm.model.common.ITreeNode;
16

  
17
/**
18
 * Preliminary class which represents a filter for an export on a CdmBase object, combined
19
 * with a logical operation.
20
 * Added to an existing filter it may e.g. allow operations like "filter1 or filter(TaxonNode:123)"
21
 * It includes the logical operators as enums.
22
 *
23
 * @author a.mueller
24
 *
25
 */
26
public class LogicFilter<T extends CdmBase> {
27

  
28
    public enum Op{
29
        OR, AND, NOT;
30
//      OR(" OR "), AND(" AND "), NOT(" NOT ");
31
//          String str;
32
//
33
//      private Op(String opStr){
34
//          str = opStr;
35
//      }
36
    }
37

  
38
    private static final Op defaultOperator = Op.OR;
39

  
40
    private Op operator = defaultOperator;
41

  
42
    private UUID uuid;
43
    private String treeIndex;
44
    private Class<? extends T> clazz;
45

  
46
//  private boolean hasUncheckedUuid = false;
47

  
48

  
49

  
50
    public LogicFilter(T cdmBase){
51
        this(cdmBase, defaultOperator);
52
    }
53

  
54
    public LogicFilter(Class<? extends T> clazz, UUID uuid, Op operator) {
55
//        hasUncheckedUuid = true;
56
        if (uuid == null){
57
            throw new IllegalArgumentException("Null uuid not allowed as filter criteria");
58
        }
59
        if (operator == null){
60
            operator = defaultOperator;
61
        }
62

  
63
        this.uuid = uuid;
64
        this.operator = operator;
65
        this.clazz = clazz;
66

  
67
    }
68

  
69
    public <S extends T> LogicFilter(S cdmBase, Op operator){
70
        if (cdmBase == null){
71
            throw new IllegalArgumentException("Null object not allowed as filter criteria");
72
        }
73
        if (operator == null){
74
            operator = defaultOperator;
75
        }
76
        cdmBase = CdmBase.deproxy(cdmBase);
77

  
78
        this.uuid = cdmBase.getUuid();
79
        this.operator = operator;
80
        this.clazz = (Class)cdmBase.getClass();
81
        if (cdmBase instanceof ITreeNode){
82
            this.treeIndex = ((ITreeNode<?>)cdmBase).treeIndex();
83
        }
84
    }
85

  
86

  
87

  
88
    public Op getOperator() {
89
        return operator;
90
    }
91

  
92
    public UUID getUuid() {
93
        return uuid;
94
    }
95

  
96
    public String getTreeIndex() {
97
        return treeIndex;
98
    }
99

  
100
    public Class<? extends T> getClazz() {
101
        return clazz;
102
    }
103

  
104
    /**
105
     * TODO try to remove public setter
106
     * @deprecated for internal use only
107
     */
108

  
109
    @Deprecated
110
    public void setTreeIndex(String treeIndex) {
111
        this.treeIndex = treeIndex;
112
    }
113

  
114
}
115

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/filter/TaxonNodeFilter.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.filter;
11

  
12
import java.io.Serializable;
13
import java.util.ArrayList;
14
import java.util.Collection;
15
import java.util.Collections;
16
import java.util.List;
17
import java.util.UUID;
18

  
19
import eu.etaxonomy.cdm.filter.LogicFilter.Op;
20
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
21
import eu.etaxonomy.cdm.model.location.NamedArea;
22
import eu.etaxonomy.cdm.model.taxon.Classification;
23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
25

  
26
/**
27
 *
28
 * Preliminary.
29
 * @author a.mueller
30
 *
31
 */
32
public class TaxonNodeFilter implements Serializable{
33

  
34
    private static final long serialVersionUID = 2292886683987183999L;
35

  
36
    private List<LogicFilter<TaxonNode>> subtrees = new ArrayList<>();
37
    private List<LogicFilter<TaxonNode>> taxonNodes = new ArrayList<>();
38
    private List<LogicFilter<Classification>> classifications = new ArrayList<>();
39
    private List<LogicFilter<Taxon>> taxa = new ArrayList<>();
40

  
41
    private List<LogicFilter<NamedArea>> areaFilter = new ArrayList<>();
42

  
43
    private List<LogicFilter<PresenceAbsenceTerm>> distributionStatusFilter = new ArrayList<>();
44

  
45
    private boolean includeRootNodes = false;
46

  
47
    //********************** FACTORY ***************************/
48

  
49
    public static TaxonNodeFilter NewTaxonNodeInstance(UUID taxonNodeUuid){
50
        return new TaxonNodeFilter().orTaxonNode(taxonNodeUuid);
51
    }
52
    public static TaxonNodeFilter NewTaxonNodeInstance(TaxonNode taxonNode){
53
        return new TaxonNodeFilter().orTaxonNode(taxonNode);
54
    }
55

  
56
    public static TaxonNodeFilter NewClassificationInstance(UUID classificationUuid){
57
        return new TaxonNodeFilter().orClassification(classificationUuid);
58
    }
59
    public static TaxonNodeFilter NewClassificationInstance(Classification classification){
60
        return new TaxonNodeFilter().orClassification(classification);
61
    }
62

  
63

  
64
    public static TaxonNodeFilter NewSubtreeInstance(UUID subtreeUuid){
65
        return new TaxonNodeFilter().orSubtree(subtreeUuid);
66
    }
67
    public static TaxonNodeFilter NewSubtreeInstance(TaxonNode subtree){
68
        return new TaxonNodeFilter().orSubtree(subtree);
69
    }
70

  
71
    public static TaxonNodeFilter NewTaxonInstance(UUID taxonUuid){
72
        return new TaxonNodeFilter().orTaxon(taxonUuid);
73
    }
74

  
75
    public static TaxonNodeFilter NewTaxonInstance(Taxon taxon){
76
        return new TaxonNodeFilter().orTaxon(taxon);
77
    }
78

  
79
    public static TaxonNodeFilter NewInstance(Collection<UUID> classificationUuids,
80
            Collection<UUID> subtreeUuids, Collection<UUID> taxonNodeUuids,
81
            Collection<UUID> taxonUuids){
82
        TaxonNodeFilter result = new TaxonNodeFilter();
83
        classificationUuids = classificationUuids == null ? new ArrayList<>(): classificationUuids;
84
        subtreeUuids = subtreeUuids == null ? new ArrayList<>(): subtreeUuids;
85
        taxonNodeUuids = taxonNodeUuids == null ? new ArrayList<>(): taxonNodeUuids;
86
        taxonUuids = taxonUuids == null ? new ArrayList<>(): taxonUuids;
87

  
88
        for (UUID uuid : classificationUuids){
89
            result.orClassification(uuid);
90
        }
91
        for (UUID uuid : subtreeUuids){
92
            result.orSubtree(uuid);
93
        }
94
        for (UUID uuid : taxonNodeUuids){
95
            result.orTaxonNode(uuid);
96
        }
97
        for (UUID uuid : taxonUuids){
98
            result.orTaxon(uuid);
99
        }
100
        return result;
101

  
102
    }
103

  
104
// ************************ CONSTRUCTOR *******************/
105

  
106
    public TaxonNodeFilter(){
107
        reset();
108
    }
109

  
110
    public TaxonNodeFilter(TaxonNode node){
111
        reset();
112
        LogicFilter<TaxonNode> filter = new LogicFilter<>(node);
113
        subtrees.add(filter);
114
    }
115

  
116
    public TaxonNodeFilter(Classification classification){
117
        reset();
118
        LogicFilter<Classification> filter = new LogicFilter<>(classification);
119
        classifications.add(filter);
120
    }
121

  
122
    public TaxonNodeFilter(Taxon taxon){
123
        reset();
124
        LogicFilter<Taxon> filter = new LogicFilter<>(taxon);
125
        taxa.add(filter);
126
    }
127

  
128
//    public <T extends CdmBase> TaxonNodeFilter(Class<T> clazz, UUID uuid){
129
//        reset();
130
//        LogicFilter<T> filter = new LogicFilter<T>(clazz, uuid);
131
//        classifications.add(filter);
132
//    }
133

  
134
// ********************** reset *****************************/
135

  
136
    public void reset(){
137
        subtrees = new ArrayList<>();
138
        resetArea();
139
        resetDistributionStatus();
140
        resetTaxonNodes();
141
        resetClassifications();
142
        resetTaxa();
143
    }
144

  
145
    private void resetDistributionStatus() {
146
        distributionStatusFilter = new ArrayList<>();
147
    }
148

  
149
    private void resetTaxonNodes() {
150
        taxonNodes = new ArrayList<>();
151
    }
152

  
153
    private void resetClassifications() {
154
        classifications = new ArrayList<>();
155
    }
156

  
157
    private void resetTaxa() {
158
        taxa = new ArrayList<>();
159
    }
160

  
161
    private void resetArea() {
162
        areaFilter = new ArrayList<>();
163
    }
164

  
165
//*************************************
166

  
167
    public List<LogicFilter<TaxonNode>>getSubtreeFilter(){
168
        return Collections.unmodifiableList(subtrees);
169
    }
170

  
171
    public List<LogicFilter<TaxonNode>>getTaxonNodesFilter(){
172
        return Collections.unmodifiableList(taxonNodes);
173
    }
174

  
175

  
176
    public List<LogicFilter<Classification>>getClassificationFilter(){
177
        return Collections.unmodifiableList(classifications);
178
    }
179

  
180
    public List<LogicFilter<Taxon>>getTaxonFilter(){
181
        return Collections.unmodifiableList(taxa);
182
    }
183

  
184
    public List<LogicFilter<NamedArea>>getAreaFilter(){
185
        return Collections.unmodifiableList(areaFilter);
186
    }
187

  
188
    public List<LogicFilter<PresenceAbsenceTerm>>getDistributionStatusFilter(){
189
        return Collections.unmodifiableList(distributionStatusFilter);
190
    }
191

  
192
    public TaxonNodeFilter orSubtree(TaxonNode taxonNode){
193
        subtrees.add( new LogicFilter<>(taxonNode, Op.OR));
194
        return this;
195
    }
196

  
197
    public TaxonNodeFilter notSubtree(TaxonNode taxonNode){
198
        subtrees.add( new LogicFilter<>(taxonNode, Op.NOT));
199
        return this;
200
    }
201

  
202
    public TaxonNodeFilter orSubtree(UUID taxonNodeUuid){
203
        subtrees.add( new LogicFilter<>(TaxonNode.class, taxonNodeUuid, Op.OR));
204
        return this;
205
    }
206

  
207
    public TaxonNodeFilter orTaxonNode(TaxonNode taxonNode){
208
        taxonNodes.add( new LogicFilter<>(taxonNode, Op.OR));
209
        return this;
210
    }
211
    public TaxonNodeFilter orTaxonNode(UUID uuid){
212
        taxonNodes.add( new LogicFilter<>(TaxonNode.class, uuid, Op.OR));
213
        return this;
214
    }
215

  
216
    public TaxonNodeFilter notTaxonNode(TaxonNode taxonNode){
217
        taxonNodes.add( new LogicFilter<>(taxonNode, Op.NOT));
218
        return this;
219
    }
220

  
221
    public TaxonNodeFilter orTaxon(Taxon taxon){
222
        taxa.add( new LogicFilter<>(taxon, Op.OR));
223
        return this;
224
    }
225

  
226
    public TaxonNodeFilter orTaxon(UUID uuid){
227
        taxa.add( new LogicFilter<>(Taxon.class, uuid, Op.OR));
228
        return this;
229
    }
230

  
231
    public TaxonNodeFilter orClassification(Classification classification){
232
        classifications.add( new LogicFilter<>(classification, Op.OR));
233
        return this;
234
    }
235

  
236

  
237
    public TaxonNodeFilter orClassification(UUID uuid){
238
        classifications.add( new LogicFilter<>(Classification.class, uuid, Op.OR));
239
        return this;
240
    }
241

  
242
    public TaxonNodeFilter notTaxon(Taxon taxon){
243
        taxa.add( new LogicFilter<>(taxon, Op.NOT));
244
        return this;
245
    }
246

  
247
    public TaxonNodeFilter set(NamedArea area){
248
        resetArea();
249
        areaFilter.add( new LogicFilter<>(area, Op.AND));
250
        return this;
251
    }
252

  
253
    public boolean isIncludeRootNodes() {
254
        return includeRootNodes;
255
    }
256
    public TaxonNodeFilter setIncludeRootNodes(boolean includeRootNodes) {
257
        this.includeRootNodes = includeRootNodes;
258
        return this;
259
    }
260

  
261
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/filter/LogicFilter.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.filter;
11

  
12
import java.util.UUID;
13

  
14
import eu.etaxonomy.cdm.model.common.CdmBase;
15
import eu.etaxonomy.cdm.model.common.ITreeNode;
16

  
17
/**
18
 * Preliminary class which represents a filter for an export on a CdmBase object, combined
19
 * with a logical operation.
20
 * Added to an existing filter it may e.g. allow operations like "filter1 or filter(TaxonNode:123)"
21
 * It includes the logical operators as enums.
22
 *
23
 * @author a.mueller
24
 *
25
 */
26
public class LogicFilter<T extends CdmBase> {
27

  
28
    public enum Op{
29
        OR, AND, NOT;
30
//      OR(" OR "), AND(" AND "), NOT(" NOT ");
31
//          String str;
32
//
33
//      private Op(String opStr){
34
//          str = opStr;
35
//      }
36
    }
37

  
38
    private static final Op defaultOperator = Op.OR;
39

  
40
    private Op operator = defaultOperator;
41

  
42
    private UUID uuid;
43
    private String treeIndex;
44
    private Class<? extends T> clazz;
45

  
46
//  private boolean hasUncheckedUuid = false;
47

  
48

  
49

  
50
    public LogicFilter(T cdmBase){
51
        this(cdmBase, defaultOperator);
52
    }
53

  
54
    public LogicFilter(Class<? extends T> clazz, UUID uuid, Op operator) {
55
//        hasUncheckedUuid = true;
56
        if (uuid == null){
57
            throw new IllegalArgumentException("Null uuid not allowed as filter criteria");
58
        }
59
        if (operator == null){
60
            operator = defaultOperator;
61
        }
62

  
63
        this.uuid = uuid;
64
        this.operator = operator;
65
        this.clazz = clazz;
66

  
67
    }
68

  
69
    public <S extends T> LogicFilter(S cdmBase, Op operator){
70
        if (cdmBase == null){
71
            throw new IllegalArgumentException("Null object not allowed as filter criteria");
72
        }
73
        if (operator == null){
74
            operator = defaultOperator;
75
        }
76
        cdmBase = CdmBase.deproxy(cdmBase);
77

  
78
        this.uuid = cdmBase.getUuid();
79
        this.operator = operator;
80
        this.clazz = (Class)cdmBase.getClass();
81
        if (cdmBase instanceof ITreeNode){
82
            this.treeIndex = ((ITreeNode<?>)cdmBase).treeIndex();
83
        }
84
    }
85

  
86

  
87

  
88
    public Op getOperator() {
89
        return operator;
90
    }
91

  
92
    public UUID getUuid() {
93
        return uuid;
94
    }
95

  
96
    public String getTreeIndex() {
97
        return treeIndex;
98
    }
99

  
100
    public Class<? extends T> getClazz() {
101
        return clazz;
102
    }
103

  
104
    /**
105
     * TODO try to remove public setter
106
     * @deprecated for internal use only
107
     */
108

  
109
    @Deprecated
110
    public void setTreeIndex(String treeIndex) {
111
        this.treeIndex = treeIndex;
112
    }
113

  
114
}
115

  
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/filter/TaxonNodeFilter.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.filter;
11

  
12
import java.io.Serializable;
13
import java.util.ArrayList;
14
import java.util.Collection;
15
import java.util.Collections;
16
import java.util.List;
17
import java.util.UUID;
18

  
19
import eu.etaxonomy.cdm.filter.LogicFilter.Op;
20
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
21
import eu.etaxonomy.cdm.model.location.NamedArea;
22
import eu.etaxonomy.cdm.model.taxon.Classification;
23
import eu.etaxonomy.cdm.model.taxon.Taxon;
24
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
25

  
26
/**
27
 *
28
 * Preliminary.
29
 * @author a.mueller
30
 *
31
 */
32
public class TaxonNodeFilter implements Serializable{
33

  
34
    private static final long serialVersionUID = 2292886683987183999L;
35

  
36
    private List<LogicFilter<TaxonNode>> subtrees = new ArrayList<>();
37
    private List<LogicFilter<TaxonNode>> taxonNodes = new ArrayList<>();
38
    private List<LogicFilter<Classification>> classifications = new ArrayList<>();
39
    private List<LogicFilter<Taxon>> taxa = new ArrayList<>();
40

  
41
    private List<LogicFilter<NamedArea>> areaFilter = new ArrayList<>();
42

  
43
    private List<LogicFilter<PresenceAbsenceTerm>> distributionStatusFilter = new ArrayList<>();
44

  
45
    private boolean includeRootNodes = false;
46

  
47
    //********************** FACTORY ***************************/
48

  
49
    public static TaxonNodeFilter NewTaxonNodeInstance(UUID taxonNodeUuid){
50
        return new TaxonNodeFilter().orTaxonNode(taxonNodeUuid);
51
    }
52
    public static TaxonNodeFilter NewTaxonNodeInstance(TaxonNode taxonNode){
53
        return new TaxonNodeFilter().orTaxonNode(taxonNode);
54
    }
55

  
56
    public static TaxonNodeFilter NewClassificationInstance(UUID classificationUuid){
57
        return new TaxonNodeFilter().orClassification(classificationUuid);
58
    }
59
    public static TaxonNodeFilter NewClassificationInstance(Classification classification){
60
        return new TaxonNodeFilter().orClassification(classification);
61
    }
62

  
63

  
64
    public static TaxonNodeFilter NewSubtreeInstance(UUID subtreeUuid){
65
        return new TaxonNodeFilter().orSubtree(subtreeUuid);
66
    }
67
    public static TaxonNodeFilter NewSubtreeInstance(TaxonNode subtree){
68
        return new TaxonNodeFilter().orSubtree(subtree);
69
    }
70

  
71
    public static TaxonNodeFilter NewTaxonInstance(UUID taxonUuid){
72
        return new TaxonNodeFilter().orTaxon(taxonUuid);
73
    }
74

  
75
    public static TaxonNodeFilter NewTaxonInstance(Taxon taxon){
76
        return new TaxonNodeFilter().orTaxon(taxon);
77
    }
78

  
79
    public static TaxonNodeFilter NewInstance(Collection<UUID> classificationUuids,
80
            Collection<UUID> subtreeUuids, Collection<UUID> taxonNodeUuids,
81
            Collection<UUID> taxonUuids){
82
        TaxonNodeFilter result = new TaxonNodeFilter();
83
        classificationUuids = classificationUuids == null ? new ArrayList<>(): classificationUuids;
84
        subtreeUuids = subtreeUuids == null ? new ArrayList<>(): subtreeUuids;
85
        taxonNodeUuids = taxonNodeUuids == null ? new ArrayList<>(): taxonNodeUuids;
86
        taxonUuids = taxonUuids == null ? new ArrayList<>(): taxonUuids;
87

  
88
        for (UUID uuid : classificationUuids){
89
            result.orClassification(uuid);
90
        }
91
        for (UUID uuid : subtreeUuids){
92
            result.orSubtree(uuid);
93
        }
94
        for (UUID uuid : taxonNodeUuids){
95
            result.orTaxonNode(uuid);
96
        }
97
        for (UUID uuid : taxonUuids){
98
            result.orTaxon(uuid);
99
        }
100
        return result;
101

  
102
    }
103

  
104
// ************************ CONSTRUCTOR *******************/
105

  
106
    public TaxonNodeFilter(){
107
        reset();
108
    }
109

  
110
    public TaxonNodeFilter(TaxonNode node){
111
        reset();
112
        LogicFilter<TaxonNode> filter = new LogicFilter<>(node);
113
        subtrees.add(filter);
114
    }
115

  
116
    public TaxonNodeFilter(Classification classification){
117
        reset();
118
        LogicFilter<Classification> filter = new LogicFilter<>(classification);
119
        classifications.add(filter);
120
    }
121

  
122
    public TaxonNodeFilter(Taxon taxon){
123
        reset();
124
        LogicFilter<Taxon> filter = new LogicFilter<>(taxon);
125
        taxa.add(filter);
126
    }
127

  
128
//    public <T extends CdmBase> TaxonNodeFilter(Class<T> clazz, UUID uuid){
129
//        reset();
130
//        LogicFilter<T> filter = new LogicFilter<T>(clazz, uuid);
131
//        classifications.add(filter);
132
//    }
133

  
134
// ********************** reset *****************************/
135

  
136
    public void reset(){
137
        subtrees = new ArrayList<>();
138
        resetArea();
139
        resetDistributionStatus();
140
        resetTaxonNodes();
141
        resetClassifications();
142
        resetTaxa();
143
    }
144

  
145
    private void resetDistributionStatus() {
146
        distributionStatusFilter = new ArrayList<>();
147
    }
148

  
149
    private void resetTaxonNodes() {
150
        taxonNodes = new ArrayList<>();
151
    }
152

  
153
    private void resetClassifications() {
154
        classifications = new ArrayList<>();
155
    }
156

  
157
    private void resetTaxa() {
158
        taxa = new ArrayList<>();
159
    }
160

  
161
    private void resetArea() {
162
        areaFilter = new ArrayList<>();
163
    }
164

  
165
//*************************************
166

  
167
    public List<LogicFilter<TaxonNode>>getSubtreeFilter(){
168
        return Collections.unmodifiableList(subtrees);
169
    }
170

  
171
    public List<LogicFilter<TaxonNode>>getTaxonNodesFilter(){
172
        return Collections.unmodifiableList(taxonNodes);
173
    }
174

  
175

  
176
    public List<LogicFilter<Classification>>getClassificationFilter(){
177
        return Collections.unmodifiableList(classifications);
178
    }
179

  
180
    public List<LogicFilter<Taxon>>getTaxonFilter(){
181
        return Collections.unmodifiableList(taxa);
182
    }
183

  
184
    public List<LogicFilter<NamedArea>>getAreaFilter(){
185
        return Collections.unmodifiableList(areaFilter);
186
    }
187

  
188
    public List<LogicFilter<PresenceAbsenceTerm>>getDistributionStatusFilter(){
189
        return Collections.unmodifiableList(distributionStatusFilter);
190
    }
191

  
192
    public TaxonNodeFilter orSubtree(TaxonNode taxonNode){
193
        subtrees.add( new LogicFilter<>(taxonNode, Op.OR));
194
        return this;
195
    }
196

  
197
    public TaxonNodeFilter notSubtree(TaxonNode taxonNode){
198
        subtrees.add( new LogicFilter<>(taxonNode, Op.NOT));
199
        return this;
200
    }
201

  
202
    public TaxonNodeFilter orSubtree(UUID taxonNodeUuid){
203
        subtrees.add( new LogicFilter<>(TaxonNode.class, taxonNodeUuid, Op.OR));
204
        return this;
205
    }
206

  
207
    public TaxonNodeFilter orTaxonNode(TaxonNode taxonNode){
208
        taxonNodes.add( new LogicFilter<>(taxonNode, Op.OR));
209
        return this;
210
    }
211
    public TaxonNodeFilter orTaxonNode(UUID uuid){
212
        taxonNodes.add( new LogicFilter<>(TaxonNode.class, uuid, Op.OR));
213
        return this;
214
    }
215

  
216
    public TaxonNodeFilter notTaxonNode(TaxonNode taxonNode){
217
        taxonNodes.add( new LogicFilter<>(taxonNode, Op.NOT));
218
        return this;
219
    }
220

  
221
    public TaxonNodeFilter orTaxon(Taxon taxon){
222
        taxa.add( new LogicFilter<>(taxon, Op.OR));
223
        return this;
224
    }
225

  
226
    public TaxonNodeFilter orTaxon(UUID uuid){
227
        taxa.add( new LogicFilter<>(Taxon.class, uuid, Op.OR));
228
        return this;
229
    }
230

  
231
    public TaxonNodeFilter orClassification(Classification classification){
232
        classifications.add( new LogicFilter<>(classification, Op.OR));
233
        return this;
234
    }
235

  
236

  
237
    public TaxonNodeFilter orClassification(UUID uuid){
238
        classifications.add( new LogicFilter<>(Classification.class, uuid, Op.OR));
239
        return this;
240
    }
241

  
242
    public TaxonNodeFilter notTaxon(Taxon taxon){
243
        taxa.add( new LogicFilter<>(taxon, Op.NOT));
244
        return this;
245
    }
246

  
247
    public TaxonNodeFilter set(NamedArea area){
248
        resetArea();
249
        areaFilter.add( new LogicFilter<>(area, Op.AND));
250
        return this;
251
    }
252

  
253
    public boolean isIncludeRootNodes() {
254
        return includeRootNodes;
255
    }
256
    public TaxonNodeFilter setIncludeRootNodes(boolean includeRootNodes) {
257
        this.includeRootNodes = includeRootNodes;
258
        return this;
259
    }
260

  
261
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)