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() {
7676 new OperationStateActionModeDeserializer (workflowPropertySource ));
7777 addDeserializer (DefaultState .Type .class ,
7878 new DefaultStateTypeDeserializer (workflowPropertySource ));
79- addDeserializer (DataCondition .Operator .class ,
80- new DataConditionOperatorDeserializer (workflowPropertySource ));
8179 addDeserializer (EventDefinition .Kind .class , new EventDefinitionKindDeserializer (workflowPropertySource ));
8280 addDeserializer (ParallelState .CompletionType .class , new ParallelStateCompletionTypeDeserializer (workflowPropertySource ));
8381 addDeserializer (Schedule .DirectInvoke .class , new ScheduleDirectInvokeDeserializer (workflowPropertySource ));
Original file line number Diff line number Diff line change 66 ],
77 "description" : " Switch state data based condition" ,
88 "properties" : {
9- "path " : {
9+ "condition " : {
1010 "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"
3512 },
3613 "transition" : {
3714 "$ref" : " ../transitions/transition.json" ,
3815 "description" : " Next transition of the workflow if there is valid matches"
3916 }
4017 },
4118 "required" : [
42- " path" ,
43- " value" ,
44- " operator" ,
19+ " condition" ,
4520 " transition"
4621 ]
4722}
Original file line number Diff line number Diff line change 1818 },
1919 "dataConditions" : [
2020 {
21- "path" : " $.applicant.age" ,
22- "value" : " 18" ,
23- "operator" : " greaterthanorequals" ,
21+ "condition" : " {{ $.applicants[?(@.age >= 18)] }}" ,
2422 "transition" : {
2523 "nextState" : " StartApplication"
2624 }
2725 },
2826 {
29- "path" : " $.applicant.age" ,
30- "value" : " 18" ,
31- "operator" : " lessthan" ,
27+ "condition" : " {{ $.applicants[?(@.age < 18)] }}" ,
3228 "transition" : {
3329 "nextState" : " RejectApplication"
3430 }
Original file line number Diff line number Diff line change @@ -12,14 +12,10 @@ states:
1212 start :
1313 kind : default
1414 dataConditions :
15- - path : " $.applicant.age"
16- value : ' 18'
17- operator : greaterthanorequals
15+ - condition : " {{ $.applicants[?(@.age >= 18)] }}"
1816 transition :
1917 nextState : StartApplication
20- - path : " $.applicant.age"
21- value : ' 18'
22- operator : lessthan
18+ - condition : " {{ $.applicants[?(@.age < 18)] }}"
2319 transition :
2420 nextState : RejectApplication
2521 default :
Original file line number Diff line number Diff line change 5252 "type" : " switch" ,
5353 "dataConditions" : [
5454 {
55- "path" : " $.creditCheck.decision" ,
56- "value" : " Approved" ,
57- "operator" : " equals" ,
55+ "condition" : " {{ $.creditCheck[?(@.decision == 'Approved')] }}" ,
5856 "transition" : {
5957 "nextState" : " StartApplication"
6058 }
6159 },
6260 {
63- "path" : " $.creditCheck.decision" ,
64- "value" : " Denied" ,
65- "operator" : " equals" ,
61+ "condition" : " {{ $.creditCheck[?(@.decision == 'Denied')] }}" ,
6662 "transition" : {
6763 "nextState" : " RejectApplication"
6864 }
Original file line number Diff line number Diff line change @@ -32,14 +32,10 @@ states:
3232 - name : EvaluateDecision
3333 type : switch
3434 dataConditions :
35- - path : " $.creditCheck.decision"
36- value : Approved
37- operator : equals
35+ - condition : " {{ $.creditCheck[?(@.decision == 'Approved')] }}"
3836 transition :
3937 nextState : StartApplication
40- - path : " $.creditCheck.decision"
41- value : Denied
42- operator : equals
38+ - condition : " {{ $.creditCheck[?(@.decision == 'Denied')] }}"
4339 transition :
4440 nextState : RejectApplication
4541 default :
Original file line number Diff line number Diff line change 8686 "type" :" switch" ,
8787 "dataConditions" : [
8888 {
89- "path" : " $.jobstatus" ,
90- "value" : " SUCCEEDED" ,
91- "operator" : " equals" ,
89+ "condition" : " {{ $[?(@.jobstatus == 'SUCCEEDED')] }}" ,
9290 "transition" : {
9391 "nextState" : " JobSucceeded"
9492 }
9593 },
9694 {
97- "path" : " $.jobstatus" ,
98- "value" : " FAILED" ,
99- "operator" : " equals" ,
95+ "condition" : " {{ $[?(@.jobstatus == 'FAILED')] }}" ,
10096 "transition" : {
10197 "nextState" : " JobFailed"
10298 }
Original file line number Diff line number Diff line change @@ -51,14 +51,10 @@ states:
5151 - name : DetermineCompletion
5252 type : switch
5353 dataConditions :
54- - path : " $.jobstatus"
55- value : SUCCEEDED
56- operator : equals
54+ - condition : " {{ $[?(@.jobstatus == 'SUCCEEDED')] }}"
5755 transition :
5856 nextState : JobSucceeded
59- - path : " $.jobstatus"
60- value : FAILED
61- operator : equals
57+ - condition : " {{ $[?(@.jobstatus == 'FAILED')] }}"
6258 transition :
6359 nextState : JobFailed
6460 default :
You can’t perform that action at this time.
0 commit comments