gitgabrio commented on code in PR #3896:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3896#discussion_r2095118047


##########
kogito-codegen-modules/kogito-codegen-decisions/src/main/java/org/kie/kogito/codegen/decision/DecisionCodegen.java:
##########
@@ -122,54 +99,59 @@ public static DecisionCodegen ofPath(KogitoBuildContext 
context, Path... paths)
         return ofCollectedResources(context, 
CollectedResourceProducer.fromPaths(context.ignoreHiddenFiles(), paths));
     }
 
-    private static final String operationalDashboardDmnTemplate = 
"/grafana-dashboard-template/operational-dashboard-template.json";
-    private static final String domainDashboardDmnTemplate = 
"/grafana-dashboard-template/blank-dashboard.json";
-
     private final List<CollectedResource> cResources;
-    private final List<DMNResource> resources = new ArrayList<>();
-    private final List<GeneratedFile> generatedFiles = new ArrayList<>();
     private final List<String> classesForManualReflection = new ArrayList<>();
     private final Set<DMNProfile> customDMNProfiles = new HashSet<>();
     private final boolean enableRuntimeTypeCheckOption;
 
     public DecisionCodegen(KogitoBuildContext context, List<CollectedResource> 
cResources) {
         super(context, GENERATOR_NAME, new DecisionConfigGenerator(context));
+        LOGGER.debug("DecisionCodegen {}", cResources);
         Set<String> customDMNProfilesProperties = 
getCustomDMNProfilesProperties();
         
customDMNProfiles.addAll(getCustomDMNProfiles(customDMNProfilesProperties, 
context.getClassLoader()));
         enableRuntimeTypeCheckOption = getEnableRuntimeTypeCheckOption();
         this.cResources = cResources;
     }
 
-    private void loadModelsAndValidate() {
-        Map<Resource, CollectedResource> r2cr = 
cResources.stream().collect(Collectors.toMap(CollectedResource::resource, 
Function.identity()));
-        // First, we perform static validation on directly the XML
-        DecisionValidation.dmnValidateResources(context(), r2cr.keySet());
-        // DMN model processing; any semantic error during compilation will 
also be thrown accordingly
-        DMNRuntimeBuilder dmnRuntimeBuilder = 
DMNRuntimeBuilder.fromDefaults().setOption(new 
RuntimeTypeCheckOption(enableRuntimeTypeCheckOption));
-        customDMNProfiles.forEach(dmnRuntimeBuilder::addProfile);
-        DMNRuntime dmnRuntime = dmnRuntimeBuilder
-                .setRootClassLoader(context().getClassLoader()) // KOGITO-4788
-                .buildConfiguration()
-                .fromResources(r2cr.keySet())
-                .getOrElseThrow(e -> new RuntimeException("Error compiling DMN 
model(s)", e));
-        // Any post-compilation of the DMN model validations: DT (static) 
analysis
-        DecisionValidation.dmnValidateDecisionTablesInModels(context(), 
dmnRuntime.getModels());
-        List<DMNResource> dmnResources = 
dmnRuntime.getModels().stream().map(model -> new DMNResource(model, 
r2cr.get(model.getResource()))).collect(toList());
-        resources.addAll(dmnResources);
+    @Override
+    public Optional<ApplicationSection> section() {
+        LOGGER.debug("section");
+        return Optional.of(new DecisionContainerGenerator(
+                context(),
+                applicationCanonicalName(),
+                this.cResources,
+                this.classesForManualReflection,
+                this.customDMNProfiles,
+                this.enableRuntimeTypeCheckOption));
     }
 
     @Override
-    protected Collection<GeneratedFile> internalGenerate() {
-        loadModelsAndValidate();
-        generateAndStoreRestResources();
-        generateAndStoreDecisionModelResourcesProvider();
+    public boolean isEmpty() {
+        return cResources.isEmpty();
+    }
 
-        return generatedFiles;
+    @Override
+    public int priority() {
+        return 30;
     }
 
     @Override
-    public boolean isEmpty() {
-        return cResources.isEmpty();
+    public String applicationCanonicalName() {
+        return super.applicationCanonicalName();

Review Comment:
   It is needed to override the access modifier and expose it as `public` 
(invoked by `DecisionCodegenUtils`)



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