yesamer commented on code in PR #6325:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6325#discussion_r2065785925


##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java:
##########
@@ -101,8 +103,25 @@ 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 
the element related Decision node name or
+     * BusinessKnowledgeModel node name
+     * @param dmnElement
+     * @return
+     */
+    static String getDecisionOrBkmName(DMNModelInstrumentedBase dmnElement) {
+        if (dmnElement instanceof Decision decision) {
+            return decision.getName();
+        }
+        if (dmnElement instanceof BusinessKnowledgeModel 
businessKnowledgeModel) {
+            return businessKnowledgeModel.getName();
+        }
+        if (dmnElement.getParentDRDElement() == null || dmnElement == 
dmnElement.getParentDRDElement()) {
+            logger.error("Root element id: {} reached. Can't find the related 
Decision or BKM node name", dmnElement.getIdentifierString());
+            throw new IllegalStateException("Root element id: " + 
dmnElement.getIdentifierString() + " reached. Can't find the related Decision 
or BKM node name.");

Review Comment:
   It depends on the consequence of having a missing decisionName. That method 
is called in the class constructor only, to determine the `decisionName` field.
   That field is used to fire an even
   `DMNRuntimeEventManagerUtils.fireAfterConditionalEvaluation(eventManager, 
name, decisionName, toReturn, executedId);`
   What should we do in case of empty decisionName?
   



-- 
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]

Reply via email to