-
Bug
-
Resolution: Not a Bug
-
Major
-
None
-
None
-
None
-
None
-
2020 Week 37-39 (from Sep 7)
-
Undefined
-
NEW
-
NEW
-
---
-
---
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:
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)));
This is my datasource, which have two empty fields in two rows.
And this is the result i got for the two rows with an empty fields :
rule "ageRule_1" when then $person.setStatus("Infant"); end rule "ageRule_8" when then $person.setStatus("Old Aged"); end
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.