ChinchuAjith commented on code in PR #6267:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6267#discussion_r1984534164


##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java:
##########
@@ -209,60 +210,82 @@ public DMNModel compile(Definitions dmndefs, 
Collection<DMNModel> dmnModels, Res
         }
         DMNModelImpl model = new DMNModelImpl(dmndefs, resource);
         model.setRuntimeTypeCheck(((DMNCompilerConfigurationImpl) 
dmnCompilerConfig).getOption(RuntimeTypeCheckOption.class).isRuntimeTypeCheck());
+        DMNCompilerContext ctx = configureDMNCompiler(model.getFeelDialect(), 
relativeResolver);
+        if (!dmndefs.getImport().isEmpty()) {
+            iterateImports(dmndefs, dmnModels, model, relativeResolver );
+        }
+        processItemDefinitions(ctx, model, dmndefs);
+        processDrgElements(ctx, model, dmndefs);
+        return model;
+    }
+
+    private DMNCompilerContext configureDMNCompiler(FEELDialect feeldialect, 
Function<String, Reader> relativeResolver) {
+
         DMNCompilerConfigurationImpl cc = (DMNCompilerConfigurationImpl) 
dmnCompilerConfig;
         List<FEELProfile> helperFEELProfiles = cc.getFeelProfiles();
-        DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(), 
helperFEELProfiles, model.getFeelDialect());
+        DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(), 
helperFEELProfiles, feeldialect);
         DMNCompilerContext ctx = new DMNCompilerContext(feel);
         ctx.setRelativeResolver(relativeResolver);
+        return ctx;
+    }
+
+    private void iterateImports(Definitions dmndefs, Collection<DMNModel> 
dmnModels, DMNModelImpl model, Function<String, Reader> relativeResolver ) {

Review Comment:
   The if/else inside this method have been replaced with switch case. Tested 
and is working fine now. Please review once and let me know if any further 
modification required here.



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