baldimir commented on code in PR #6307:
URL:
https://github.com/apache/incubator-kie-drools/pull/6307#discussion_r2041857291
##########
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:
The method was already there and it is very hard to test as it is part of
codegen. I think if examples work, it will test that it works. I know it is not
ideal, however I want to avoid adding another complex testing into this. I
could do it as part of separate ticket. What do you think, please?
--
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]