File tree Expand file tree Collapse file tree 9 files changed +15
-137
lines changed
java/io/serverlessworkflow/api
resources/schema/switchconditions Expand file tree Collapse file tree 9 files changed +15
-137
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -76,8 +76,6 @@ private void addDefaultDeserializers() {
76
76
new OperationStateActionModeDeserializer (workflowPropertySource ));
77
77
addDeserializer (DefaultState .Type .class ,
78
78
new DefaultStateTypeDeserializer (workflowPropertySource ));
79
- addDeserializer (DataCondition .Operator .class ,
80
- new DataConditionOperatorDeserializer (workflowPropertySource ));
81
79
addDeserializer (EventDefinition .Kind .class , new EventDefinitionKindDeserializer (workflowPropertySource ));
82
80
addDeserializer (ParallelState .CompletionType .class , new ParallelStateCompletionTypeDeserializer (workflowPropertySource ));
83
81
addDeserializer (Schedule .DirectInvoke .class , new ScheduleDirectInvokeDeserializer (workflowPropertySource ));
Original file line number Diff line number Diff line change 6
6
],
7
7
"description" : " Switch state data based condition" ,
8
8
"properties" : {
9
- "path " : {
9
+ "condition " : {
10
10
"type" : " string" ,
11
- "description" : " JSONPath expression that selects elements of state data"
12
- },
13
- "value" : {
14
- "type" : " string" ,
15
- "description" : " Matching value"
16
- },
17
- "operator" : {
18
- "type" : " string" ,
19
- "enum" : [
20
- " exists" ,
21
- " notexists" ,
22
- " null" ,
23
- " notnull" ,
24
- " equals" ,
25
- " notequals" ,
26
- " lessthan" ,
27
- " lessthanorequals" ,
28
- " greaterthan" ,
29
- " greaterthanorequals" ,
30
- " matches" ,
31
- " notmatches" ,
32
- " custom"
33
- ],
34
- "description" : " Condition operator"
11
+ "description" : " JsonPath expression evaluated against state data. True if results are not empty"
35
12
},
36
13
"transition" : {
37
14
"$ref" : " ../transitions/transition.json" ,
38
15
"description" : " Next transition of the workflow if there is valid matches"
39
16
}
40
17
},
41
18
"required" : [
42
- " path" ,
43
- " value" ,
44
- " operator" ,
19
+ " condition" ,
45
20
" transition"
46
21
]
47
22
}
Original file line number Diff line number Diff line change 18
18
},
19
19
"dataConditions" : [
20
20
{
21
- "path" : " $.applicant.age" ,
22
- "value" : " 18" ,
23
- "operator" : " greaterthanorequals" ,
21
+ "condition" : " {{ $.applicants[?(@.age >= 18)] }}" ,
24
22
"transition" : {
25
23
"nextState" : " StartApplication"
26
24
}
27
25
},
28
26
{
29
- "path" : " $.applicant.age" ,
30
- "value" : " 18" ,
31
- "operator" : " lessthan" ,
27
+ "condition" : " {{ $.applicants[?(@.age < 18)] }}" ,
32
28
"transition" : {
33
29
"nextState" : " RejectApplication"
34
30
}
Original file line number Diff line number Diff line change @@ -12,14 +12,10 @@ states:
12
12
start :
13
13
kind : default
14
14
dataConditions :
15
- - path : " $.applicant.age"
16
- value : ' 18'
17
- operator : greaterthanorequals
15
+ - condition : " {{ $.applicants[?(@.age >= 18)] }}"
18
16
transition :
19
17
nextState : StartApplication
20
- - path : " $.applicant.age"
21
- value : ' 18'
22
- operator : lessthan
18
+ - condition : " {{ $.applicants[?(@.age < 18)] }}"
23
19
transition :
24
20
nextState : RejectApplication
25
21
default :
Original file line number Diff line number Diff line change 52
52
"type" : " switch" ,
53
53
"dataConditions" : [
54
54
{
55
- "path" : " $.creditCheck.decision" ,
56
- "value" : " Approved" ,
57
- "operator" : " equals" ,
55
+ "condition" : " {{ $.creditCheck[?(@.decision == 'Approved')] }}" ,
58
56
"transition" : {
59
57
"nextState" : " StartApplication"
60
58
}
61
59
},
62
60
{
63
- "path" : " $.creditCheck.decision" ,
64
- "value" : " Denied" ,
65
- "operator" : " equals" ,
61
+ "condition" : " {{ $.creditCheck[?(@.decision == 'Denied')] }}" ,
66
62
"transition" : {
67
63
"nextState" : " RejectApplication"
68
64
}
Original file line number Diff line number Diff line change @@ -32,14 +32,10 @@ states:
32
32
- name : EvaluateDecision
33
33
type : switch
34
34
dataConditions :
35
- - path : " $.creditCheck.decision"
36
- value : Approved
37
- operator : equals
35
+ - condition : " {{ $.creditCheck[?(@.decision == 'Approved')] }}"
38
36
transition :
39
37
nextState : StartApplication
40
- - path : " $.creditCheck.decision"
41
- value : Denied
42
- operator : equals
38
+ - condition : " {{ $.creditCheck[?(@.decision == 'Denied')] }}"
43
39
transition :
44
40
nextState : RejectApplication
45
41
default :
Original file line number Diff line number Diff line change 86
86
"type" :" switch" ,
87
87
"dataConditions" : [
88
88
{
89
- "path" : " $.jobstatus" ,
90
- "value" : " SUCCEEDED" ,
91
- "operator" : " equals" ,
89
+ "condition" : " {{ $[?(@.jobstatus == 'SUCCEEDED')] }}" ,
92
90
"transition" : {
93
91
"nextState" : " JobSucceeded"
94
92
}
95
93
},
96
94
{
97
- "path" : " $.jobstatus" ,
98
- "value" : " FAILED" ,
99
- "operator" : " equals" ,
95
+ "condition" : " {{ $[?(@.jobstatus == 'FAILED')] }}" ,
100
96
"transition" : {
101
97
"nextState" : " JobFailed"
102
98
}
Original file line number Diff line number Diff line change @@ -51,14 +51,10 @@ states:
51
51
- name : DetermineCompletion
52
52
type : switch
53
53
dataConditions :
54
- - path : " $.jobstatus"
55
- value : SUCCEEDED
56
- operator : equals
54
+ - condition : " {{ $[?(@.jobstatus == 'SUCCEEDED')] }}"
57
55
transition :
58
56
nextState : JobSucceeded
59
- - path : " $.jobstatus"
60
- value : FAILED
61
- operator : equals
57
+ - condition : " {{ $[?(@.jobstatus == 'FAILED')] }}"
62
58
transition :
63
59
nextState : JobFailed
64
60
default :
You can’t perform that action at this time.
0 commit comments