]
Mario Fusco updated DROOLS-5655:
--------------------------------
Sprint: 2020 Week 37-39 (from Sep 7)
ObjectDataCompiler converter does not compile all template rules
----------------------------------------------------------------
Key: DROOLS-5655
URL:
https://issues.redhat.com/browse/DROOLS-5655
Project: Drools
Issue Type: Bug
Reporter: Oualid AMCHAYD
Assignee: Mario Fusco
Priority: Major
Attachments: image-2020-09-18-11-31-28-879.png
When trying to compile a rule template with a datasource, the compilers does
not compiles the rows with empty fields.
Here is the code I am using:
{code:java}
ObjectDataCompiler converter = new ObjectDataCompiler();
Collection<MyRule> rulesRep = rulerepo.findAll();
InputStream personInputStream = null;
try {
personInputStream =
ResourceFactory.newClassPathResource("rules.drt").getInputStream(); // convert
sample.drt in resource to input stream
} catch (IOException e) {
e.printStackTrace();
}
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
String personDrl = converter.compile(rulesRep, personInputStream);
kieFileSystem.write("src/main/resources/person_rule.drl",
kieServices.getResources().newReaderResource(new StringReader(personDrl)));
{code}
This is my datasource, which have two empty fields in two rows.
!image-2020-09-18-11-31-28-879.png!
And this is the result i got for the two rows with an empty fields :
{code:java}
rule "ageRule_1"
when
then
$person.setStatus("Infant");
end
rule "ageRule_8"
when
then
$person.setStatus("Old Aged");
end
{code}
As you see the LHS are is generated in two rules.
Am i missing something or this is a normal behaviour when having empty fields.
Thanks in advance.