gitgabrio commented on code in PR #2253:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2253#discussion_r2282511546


##########
jitexecutor/jitexecutor-common/src/main/java/org/kie/kogito/jitexecutor/common/requests/MultipleResourcesPayload.java:
##########
@@ -24,13 +24,21 @@ public class MultipleResourcesPayload {
 
     private String mainURI;
     private List<ResourceWithURI> resources;
+    private boolean isStrictMode;
 
     public MultipleResourcesPayload() {
     }
 
     public MultipleResourcesPayload(String mainURI, List<ResourceWithURI> 
resources) {

Review Comment:
   HI @AthiraHari77 
   IT would be better to invoke the other constructor in this way :
   
   ```
    public MultipleResourcesPayload(String mainURI, List<ResourceWithURI> 
resources) {
    this(mainURI, resources, false);
    }
   ```
    
    to avoid duplication



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/JITDMNServiceImpl.java:
##########
@@ -74,33 +74,33 @@ public JITDMNServiceImpl(int explainabilityLimeSampleSize, 
int explainabilityLim
     }
 
     @Override
-    public JITDMNResult evaluateModel(String modelXML, Map<String, Object> 
context) {
+    public JITDMNResult evaluateModel(String modelXML, Map<String, Object> 
context, boolean isStrictMode) {
         DMNEvaluator dmnEvaluator = DMNEvaluator.fromXML(modelXML);
-        return dmnEvaluator.evaluate(context);
+        return dmnEvaluator.evaluate(context, isStrictMode);
     }
 
     @Override
-    public JITDMNResult evaluateModel(MultipleResourcesPayload payload, 
Map<String, Object> context) {
+    public JITDMNResult evaluateModel(MultipleResourcesPayload payload, 
Map<String, Object> context, boolean isStrictMode) {

Review Comment:
   Hi 
   Since `isStrictMode` is part of the MultipleResourcePayload, there's no 
reaso to add it as isolated parameter



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluator.java:
##########
@@ -191,9 +192,10 @@ public Collection<DMNModel> getAllDMNModels() {
         return dmnRuntime.getModels();
     }
 
-    public JITDMNResult evaluate(Map<String, Object> context) {
+    public JITDMNResult evaluate(Map<String, Object> context, boolean 
isStrictMode) {
         DMNContext dmnContext =
                 new DynamicDMNContextBuilder(dmnRuntime.newContext(), 
dmnModel).populateContextWith(context);
+        ((DMNRuntimeImpl) this.dmnRuntime).setOption(new 
RuntimeModeOption(isStrictMode ? "strict" : "lenient"));

Review Comment:
   Hi @Athira, could you please replace that 
   
   `new RuntimeModeOption(isStrictMode ? "strict" : "lenient")`
   
   with the usage of MODE enum  ? Thanks!
   



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java:
##########
@@ -58,7 +58,8 @@ public Response jitdmn(JITDMNPayload payload) {
         LOGGER.debug(payload.toString());
         LOGGER.debug(LINEBREAK);
         Supplier<Response> supplier = () -> {
-            JITDMNResult evaluateAll = payload.getModel() != null ? 
jitdmnService.evaluateModel(payload.getModel(), payload.getContext()) : 
jitdmnService.evaluateModel(payload, payload.getContext());
+            JITDMNResult evaluateAll = payload.getModel() != null ? 
jitdmnService.evaluateModel(payload.getModel(), payload.getContext(), 
payload.isStrictMode())

Review Comment:
   That `payload.getModel() != null` basically differentiate between a 
`JITDMNPayload` and a `MultipleResourcesPayload` (see JITDMNPayload 
constructors): could you please adapt the code ?



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java:
##########
@@ -95,7 +97,8 @@ public Response jitEvaluateAndExplain(JITDMNPayload payload) {
         LOGGER.debug(LINEBREAK);
         Supplier<Response> supplier = () -> {
             DMNResultWithExplanation response =
-                    payload.getModel() != null ? 
jitdmnService.evaluateModelAndExplain(payload.getModel(), payload.getContext()) 
: jitdmnService.evaluateModelAndExplain(payload, payload.getContext());
+                    payload.getModel() != null ? 
jitdmnService.evaluateModelAndExplain(payload.getModel(), payload.getContext(), 
payload.isStrictMode())

Review Comment:
   See above 



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResource.java:
##########
@@ -78,7 +79,8 @@ public Response jitdmnResult(JITDMNPayload payload) {
         LOGGER.debug(payload.toString());
         LOGGER.debug(LINEBREAK);
         Supplier<Response> supplier = () -> {
-            JITDMNResult dmnResult = payload.getModel() != null ? 
jitdmnService.evaluateModel(payload.getModel(), payload.getContext()) : 
jitdmnService.evaluateModel(payload, payload.getContext());
+            JITDMNResult dmnResult = payload.getModel() != null ? 
jitdmnService.evaluateModel(payload.getModel(), payload.getContext(), 
payload.isStrictMode())

Review Comment:
   See above comment



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