I have a problem when I try to add a rule into the KieBase. I am using
version of Drools.
kieFileSystem.write("src/main/resources/rules/" + rule.getName() + ".drl", rule.getDrlFile());
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
kieContainer = kieServices.newKieContainer(kieRepository.getDefaultReleaseId());
Example of DRL which is causing me this problem is:
package rules
import com.myproject.web.dto.ruleengine.RuleExecutionOutputDTO
global com.myproject.domain.CustomerCDO customer
global com.myproject.domain.ContactPersonCDO contactPerson
dialect "mvel"
rule "TENANT01_EXM_Dejan"
when
customer.getAddress1() != "Belgrade 11" && contactPerson.getEmail() str[endsWith] "gmail.com" then
RuleExecutionOutputDTO $ruleExecutionOutput = new RuleExecutionOutputDTO();
$ruleExecutionOutput.setApproverRoleId(7)
end
Error occurs when I try to build this new rule and to add it into the KieContainer:
[ERROR] org.drools.compiler.kie.builder.impl.KieProject - Unable to build KieBaseModel:defaultKieBase
[ERR 102] Line 19:23 mismatched input '!=' in rule "TENANT01_EXM_Dejan"
[0,0]: Parser returned a null Package
I don't know why Drools engine is complaining about "!=" sign, when it is allowed by a documentation that I followed:
https://docs.jboss.org/drools/release/7.12.0.Final/drools-docs/html_single/It is complaining also about "
str[endsWith]", although by the documentation it is a valid operator for drl syntax.
Do you have any idea why I constantly get this error?
Thank you very much in advance.
Regards,
Dejan Jankovic