Skip to content

Commit 94a520c

Browse files
authored
Merge pull request #340 from nl-portal/feature/remove-empty-dmn-rules
To avoid empty DMN rules in response
2 parents eb841a4 + a97334b commit 94a520c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dockerRegion=eu-central-1
55

66
kotlinVersion=2.0.21
77
springBootVersion=3.4.0
8-
springDependencyManagementVersion=1.1.6
8+
springDependencyManagementVersion=1.1.7
99
benManesVersionsVersion=0.51.0
1010
ktlintVersion=12.1.2
1111
spotlessVersion=6.25.0

product/src/main/kotlin/nl/nlportal/product/service/DmnService.kt

+7-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class DmnService(
6666
key,
6767
variablesMapping,
6868
)
69-
return dmnClient.getDecision(dmnRequest)
69+
return filterEmptyDecisionRules(dmnClient.getDecision(dmnRequest))
7070
}
7171

7272
suspend fun getDecision(
@@ -125,7 +125,7 @@ class DmnService(
125125
beslisTabelConfiguration.key,
126126
variablesMapping,
127127
)
128-
return dmnClient.getDecision(dmnRequest)
128+
return filterEmptyDecisionRules(dmnClient.getDecision(dmnRequest))
129129
}
130130

131131
suspend fun getProductDecision(
@@ -201,7 +201,11 @@ class DmnService(
201201
beslisTabelConfiguration.key,
202202
variablesMapping,
203203
)
204-
return dmnClient.getDecision(dmnRequest)
204+
return filterEmptyDecisionRules(dmnClient.getDecision(dmnRequest))
205+
}
206+
207+
private fun filterEmptyDecisionRules(decisions: List<Map<String, DmnResponse>>): List<Map<String, DmnResponse>> {
208+
return decisions.filter { it.isNotEmpty() }
205209
}
206210

207211
private fun findBeslisTabelConfiguration(

product/src/test/resources/product/data/get-dmn-decision.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@
4949
"value": "LINK",
5050
"valueInfo": {}
5151
}
52-
}
52+
},
53+
{}
5354
]

0 commit comments

Comments
 (0)