Skip to content

Commit b590df5

Browse files
committed
simplify the dmn flow
1 parent 1d7331e commit b590df5

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

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

+16-22
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ class DmnService(
9595
)
9696

9797
sources?.forEach {
98-
if (beslisTabelConfiguration.variabelen.containsKey(it.key)) {
99-
variablesMapping.putAll(
100-
mapBeslisTabelVariablesWithSource(
101-
beslisTabelConfiguration.variabelen[it.key]!!,
102-
it.value,
103-
),
104-
)
105-
} else {
106-
logger.warn(BESLISTABLE_NOT_FOUND_BY_KEY, it.key)
107-
}
98+
beslisTabelConfiguration.variabelen[it.key]?.let { variable ->
99+
{
100+
variablesMapping.putAll(
101+
mapBeslisTabelVariablesWithSource(
102+
variable,
103+
it.value,
104+
),
105+
)
106+
}
107+
} ?: logger.warn(BESLISTABLE_NOT_FOUND_BY_KEY, it.key)
108108
}
109109

110110
// handle the configured static variables
@@ -157,24 +157,18 @@ class DmnService(
157157

158158
// loop through the sources and get the Object as Json and map with the variables
159159
sources?.forEach {
160-
val source = productService.getSourceAsJson(it.key, it.value)
161-
162-
if (source == null) {
163-
logger.warn("Could not find objects for key {} with uuid {}", it.key, it.value)
164-
} else {
165-
if (beslisTabelVariables.containsKey(it.key)) {
166-
if (beslisTabelVariables[it.key] != null) {
160+
productService.getSourceAsJson(it.key, it.value)?.let { source ->
161+
beslisTabelVariables[it.key]?.let { variable ->
162+
{
167163
variablesMapping.putAll(
168164
mapBeslisTabelVariablesWithSource(
169-
beslisTabelVariables[it.key]!!,
165+
variable,
170166
source,
171167
),
172168
)
173169
}
174-
} else {
175-
logger.warn(BESLISTABLE_NOT_FOUND_BY_KEY, it.key)
176-
}
177-
}
170+
} ?: logger.warn(BESLISTABLE_NOT_FOUND_BY_KEY, it.key)
171+
} ?: logger.warn("Could not find objects for key {} with uuid {}", it.key, it.value)
178172
}
179173

180174
// check if the beslisTabelVariables contains a producttype configuration,

0 commit comments

Comments
 (0)