gitgabrio commented on code in PR #6105:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6105#discussion_r1827932781


##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java:
##########
@@ -113,8 +111,8 @@ public class DMNCompilerImpl implements DMNCompiler {
     private static final Logger logger = LoggerFactory.getLogger( 
DMNCompilerImpl.class );
 
     private final DMNDecisionLogicCompiler evaluatorCompiler;
-    private DMNCompilerConfiguration dmnCompilerConfig;
-    private Deque<DRGElementCompiler> drgCompilers = new LinkedList<>();
+    private final DMNCompilerConfiguration dmnCompilerConfig;
+    private final Deque<DRGElementCompiler> drgCompilers = new LinkedList<>();

Review Comment:
   Hi @samuel-beniamin 
   IINW this is signavio-only behaviour that get to the core code: if so, could 
you please remove and move to signavio module ? Thanks!



##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java:
##########
@@ -491,9 +493,30 @@ private void processDrgElements(DMNCompilerContext ctx, 
DMNModelImpl model, Defi
     public interface AfterProcessDrgElements {
         void callback(DMNCompilerImpl compiler, DMNCompilerContext ctx, 
DMNModelImpl model);
     }
-    
+
+    /**

Review Comment:
   Hi @samuel-beniamin 
   IINW this is signavio-only behaviour that get to the core code: if so, could 
you please remove and move to signavio module ? Thanks!



##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNCompilerImplTest.java:
##########
@@ -76,4 +98,27 @@ void getRootElement() {
         retrieved = DMNCompilerImpl.getRootElement(elementReference);
         assertThat(retrieved).isNotNull().isEqualTo(parent);
     }
+

Review Comment:
   Hi @samuel-beniamin 
   IINW this is signavio-only behaviour that get to the core code: if so, could 
you please remove and move to signavio module ? Thanks!
   
   



##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java:
##########
@@ -491,9 +493,30 @@ private void processDrgElements(DMNCompilerContext ctx, 
DMNModelImpl model, Defi
     public interface AfterProcessDrgElements {
         void callback(DMNCompilerImpl compiler, DMNCompilerContext ctx, 
DMNModelImpl model);
     }
-    
+
+    /**
+     * Adds a callback that will be invoked after the DRG elements have been 
processed, for all the following models that are compiled with this compiler 
instance.
+     * Which may lead to the callback being called multiple times, and for 
unrelated models. Unless, the callback is registered to a specific model using:
+     * {@link #addCallbackForModel(AfterProcessDrgElements, DMNModel)}.
+     */
     public void addCallback(AfterProcessDrgElements callback) {
-        this.afterDRGcallbacks.add(callback);
+        afterDRGcallbacks.add(callback);
+    }
+
+
+    /**
+     * Adds a callback that will be invoked after the DRG elements have been 
processed, for a given model.
+     */
+    public void addCallbackForModel(AfterProcessDrgElements callback, DMNModel 
model) {

Review Comment:
   Hi @samuel-beniamin 
   IINW this is signavio-only behaviour that get to the core code: if so, could 
you please remove and move to signavio module ? Thanks!



##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java:
##########
@@ -123,6 +121,7 @@ public class DMNCompilerImpl implements DMNCompiler {
         drgCompilers.add( new KnowledgeSourceCompiler() ); // keep last as 
it's a void compiler
     }
     private final List<AfterProcessDrgElements> afterDRGcallbacks = new 
ArrayList<>();
+    private final Map<DMNModel, List<AfterProcessDrgElements>> 
afterDRGcallbacksForModel = new HashMap<>();

Review Comment:
   Hi @samuel-beniamin 
   IINW this is signavio-only behaviour that get to the core code: if so, could 
you please remove and move to signavio module ? Thanks!



##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/DMNCompilerImplTest.java:
##########
@@ -18,29 +18,51 @@
  */
 package org.kie.dmn.core.compiler;
 
+import java.io.StringReader;
+import java.util.Collections;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.kie.dmn.api.core.DMNCompilerConfiguration;
+import org.kie.dmn.api.core.DMNModel;
+import org.kie.dmn.core.api.DMNFactory;
+import org.kie.dmn.core.impl.DMNModelImpl;
 import org.kie.dmn.model.api.DMNElementReference;
 import org.kie.dmn.model.api.Definitions;
 import org.kie.dmn.model.api.InformationRequirement;
 import org.kie.dmn.model.v1_5.TDMNElementReference;
 import org.kie.dmn.model.v1_5.TDefinitions;
 import org.kie.dmn.model.v1_5.TInformationRequirement;
+import org.mockito.Mockito;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static 
org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
 class DMNCompilerImplTest {
 
     private static final String nameSpace = 
"http://www.montera.com.au/spec/DMN/local-hrefs";;
     private static Definitions parent;
+    private static DMNCompilerImpl dmnCompiler;
+    private static DMNCompilerImpl.AfterProcessDrgElements mockCallback;
+    private static DMNCompilerImpl.AfterProcessDrgElements 
mockCallbackForModel;
 
     @BeforeAll
     static void setup() {
         String modelName = "LocalHrefs";
         parent = new TDefinitions();
         parent.setName(modelName);
         parent.setNamespace(nameSpace);
+
+        DMNCompilerConfiguration config = 
DMNFactory.newCompilerConfiguration();

Review Comment:
   Hi @samuel-beniamin 
   IINW this is signavio-only behaviour that get to the core code: if so, could 
you please remove and move to signavio module ? Thanks!



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