Skip to content

Commit 673b666

Browse files
author
Adam Soos
committed
TEJ-1997: added event negation options
1 parent c39682d commit 673b666

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2021 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.basistech.rosette.apimodel;
18+
19+
import java.util.EnumSet;
20+
21+
public enum EventsNegationOption {
22+
IGNORE("Ignore"),
23+
BOTH("Both"),
24+
ONLY_POSITIVE("Only positive"),
25+
ONLY_NEGATIVE("Only negative");
26+
27+
private final String label;
28+
29+
EventsNegationOption(String label) {
30+
this.label = label;
31+
}
32+
33+
public static EventsNegationOption forValue(String value) {
34+
for (EventsNegationOption negationOption : EnumSet.allOf(EventsNegationOption.class)) {
35+
if (negationOption.toString().equalsIgnoreCase(value)) {
36+
return negationOption;
37+
}
38+
}
39+
throw new IllegalArgumentException("invalid events negation option: " + value);
40+
}
41+
42+
@Override
43+
public String toString() {
44+
return label;
45+
}
46+
}

model/src/main/java/com/basistech/rosette/apimodel/EventsOptions.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ public class EventsOptions extends Options {
3434
/**
3535
* Default options
3636
*/
37-
public static final EventsOptions DEFAULT = EventsOptions.builder().build();
37+
public static final EventsOptions DEFAULT = EventsOptions.builder().negation(EventsNegationOption.IGNORE).build();
3838

3939
/**
4040
* workspaceId to use.
4141
*/
4242
String workspaceId;
4343

4444
EnumMap<LanguageCode, List<String>> plan;
45+
46+
EventsNegationOption negation;
4547
}

0 commit comments

Comments
 (0)