[
https://issues.jboss.org/browse/DROOLS-2537?page=com.atlassian.jira.plugi...
]
Luca Molteni commented on DROOLS-2537:
--------------------------------------
The DSL is based on `org.drools.model.Drools`, which is a different interface than
`org.kie.api.runtime.rule.RuleContext`
At runtime the object passed is an instance of
`org.drools.modelcompiler.consequence.DroolsImpl`, which is both an implementation of
RuleContext and Drools but as the DSL doesn't know about kie-api someone using it
cannot assume the object is of that type.
One thing we could do is to rewrite the method using RuleContext as a parameter using a
late binding downcast, something like this
{{
public class FactWithRuleContext {
public String getRuleName(final Object ruleContext) {
final RuleContext ruleContext1 = (RuleContext) ruleContext;
return ruleContext1.getRule().getName();
}
}}}
Executable model - kcontext cannot be used as a RuleContext
-----------------------------------------------------------
Key: DROOLS-2537
URL:
https://issues.jboss.org/browse/DROOLS-2537
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 7.7.0.Final
Reporter: Tibor Zimányi
Assignee: Mario Fusco
When using kcontext in RHS as a RuleContext, the execution throws incompatible types
exception [1]. The problem could be that kcontext is translated to Drools and not to
DroolsImpl in the model DSLs.
PR with a reproducer is here:
https://github.com/kiegroup/drools/pull/1896/files#diff-67291fa531041ec60...
[1]
https://gist.github.com/baldimir/94cd43fc10215dd3ef8dad16a0e830d8
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)