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


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieSessionModelBuilder.java:
##########
@@ -73,14 +73,23 @@ private Map<String, List<String>> 
getModelByKBase(Collection<CodegenPackageSourc
         Map<String, String> modelsByPackage = 
getModelsByPackage(packageSources);
         Map<String, List<String>> modelsByKBase = new HashMap<>();
         for (Map.Entry<String, KieBaseModel> entry : kieBaseModels.entrySet()) 
{
-            List<String> kieBasePackages = entry.getValue().getPackages();
-            boolean isAllPackages = kieBasePackages.isEmpty() || 
(kieBasePackages.size() == 1 && kieBasePackages.get(0).equals("*"));
-            modelsByKBase.put(entry.getKey(),
-                    isAllPackages ? new ArrayList<>(modelsByPackage.values()) 
: 
kieBasePackages.stream().map(modelsByPackage::get).filter(Objects::nonNull).collect(toList()));
+            List<String> modelsForKieBase = 
getModelsForKieBaseWithoutIncludes(entry.getValue(), modelsByPackage);
+            if (entry.getValue().getIncludes() != null && 
!entry.getValue().getIncludes().isEmpty()) {
+                for (String includedKieBaseName : 
entry.getValue().getIncludes()) {
+                    
modelsForKieBase.addAll(getModelsForKieBaseWithoutIncludes(kieBaseModels.get(includedKieBaseName),
 modelsByPackage));
+                }
+            }
+            modelsByKBase.put(entry.getKey(), modelsForKieBase);
         }
         return modelsByKBase;
     }
 
+    private List<String> getModelsForKieBaseWithoutIncludes(final KieBaseModel 
kieBaseModel, final Map<String, String> modelsByPackage) {

Review Comment:
   Ok. I was hoping that it would be a good time to try to improve that part a 
bit, anyway I see the point.
   
   



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