gitgabrio commented on code in PR #6406:
URL:
https://github.com/apache/incubator-kie-drools/pull/6406#discussion_r2235453241
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeImpl.java:
##########
@@ -248,10 +250,34 @@ private DMNResultImpl createResult(DMNModel model,
DMNContext context) {
private DMNResultImpl createResultImpl(DMNModel model, DMNContext context)
{
DMNResultImpl result = dmnResultFactory.newDMNResultImpl(model);
+ Map<String, Object> baseInputs = new HashMap<>(context.getAll());
+ populateContextUsingAliases((DMNModelImpl) model, context.getAll(),
baseInputs);
result.setContext(context.clone()); // DMNContextFPAImpl.clone()
creates DMNContextImpl
return result;
}
+ @SuppressWarnings("unchecked")
+ private void populateContextUsingAliases(DMNModelImpl model, Map<String,
Object> context, Map<String, Object> baseInputs) {
Review Comment:
Hi @AthiraHari77 thanks for the PR.
I have the impression there are some issues with this method, though:
1. the method is private, so it is not unit tested - while it should
2. it is very complex - line 264 is a method by itself (masked by stream
usage) that should be tested in isolation
3. it is not very clear why that `importChainAliases` should contains only
elements where chain.size > 1 (of course there is a reason, but it would be
better to write a comment to explain it)
4. I think it would be better to avoid/reduce side-effect - i.e. this method
should return a map that would be added to the original context in the calling
method
5. last, this -> `Map<String, Object> current = context;` and following
usage of `current` makes the code harder to read without clear reason
(Side-note: the failing tests are exactly related to the missing unit tests,
that would have immediately shown the problem in the code))
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]