Copilot commented on code in PR #6325:
URL:
https://github.com/apache/incubator-kie-drools/pull/6325#discussion_r2076249359
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtils.java:
##########
@@ -159,9 +159,9 @@ public static void
fireAfterEvaluateConditional(DMNRuntimeEventManager eventMana
}
}
Review Comment:
Consider updating or adding method documentation to clearly explain the
change from decisionName to rootElementName, so callers understand the intended
usage of this parameter.
```suggestion
/**
* Fires an event after a conditional evaluation has been performed.
*
* @param eventManager The event manager responsible for handling
runtime events.
* @param conditionalName The name of the conditional being evaluated.
* @param rootElementName The name of the root element associated with
the evaluation.
* This parameter replaces the previously used
'decisionName' to better reflect its purpose.
* @param evaluatorResult The result of the evaluation.
* @param idExecuted The ID of the executed element.
*/
```
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java:
##########
@@ -101,8 +103,33 @@ static EvaluatorIdentifier
getEvaluatorIdentifier(Map<EvaluatorType, EvaluatorId
.orElseThrow(() -> new RuntimeException("Missing " + type + "
evaluator in evaluatorIdMap"));
}
- static String getDecisionName(DMNModelInstrumentedBase dmnElement) {
- return dmnElement instanceof Decision decision ? decision.getName() :
getDecisionName(dmnElement.getParentDRDElement());
+ /**
+ * Given a DMNModelInstrumentedBase element, it looks in the DMN hierarchy
to retrieve the root element name.
+ * Most of the time, the root element is a Decision node OR a
BusinessKnowledgeModel node that wrap the Conditional
+ * Expression. In all other cases the top level root element identifier is
returned.
+ * @param dmnElement
+ * @return The root element (Decision, BKM or Definitions) name or
identifier
Review Comment:
[nitpick] Consider expanding the documentation for getRootElementNodeName to
mention that null DMNModelInstrumentedBase returns null, so that callers know
how to handle a null rootElementName.
```suggestion
* Most of the time, the root element is a Decision node OR a
BusinessKnowledgeModel node that wraps the Conditional
* Expression. In all other cases, the top-level root element identifier
is returned.
*
* If the input {@code dmnElement} is {@code null}, this method returns
{@code null}.
*
* @param dmnElement The DMNModelInstrumentedBase element to analyze.
* @return The root element (Decision, BKM, or Definitions) name or
identifier, or {@code null} if {@code dmnElement} is {@code null}.
```
--
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]