[jboss-jira] [JBoss JIRA] (DROOLS-577) Filter doesn't work if object has "rule" as a fieldname
Edson Tirelli (JIRA)
issues at jboss.org
Wed Aug 19 12:05:26 EDT 2015
[ https://issues.jboss.org/browse/DROOLS-577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13099891#comment-13099891 ]
Edson Tirelli commented on DROOLS-577:
--------------------------------------
A few additional thoughts on this issue:
* currently, the same context is used for MVEL parsing/compilation everywhere on the engine. For instance, the same context is used to parse/compile an "enabled" expression on the rule and also pattern constraints:
{code:title=snippet.drl|borderStyle=solid}
rule X
enabled( rule.name == "X" ) // here rule refers to the actual rule
when
Fired( rule == "some rule name" ) // here rule is an attribute of the Fired class
...
{code}
* The MVEL parser/compiler is treating both as "external identifiers" that would be injected at runtime. This is correct for the "enabled" expression, but not for the constraint.
* We can not inject the "rule" object into constraints, because constraints can be shared by multiple rules.
* Therefore, the solution seems to be to use different contexts when parsing/compiling mvel expressions. When compiling things like the "enabled" expression, we list/inject "rule" as a known identifier for the rule object itself. When compiling constraints, we do not inject "rule" as a known identifier and let it be resolved to the attribute itself.
> Filter doesn't work if object has "rule" as a fieldname
> -------------------------------------------------------
>
> Key: DROOLS-577
> URL: https://issues.jboss.org/browse/DROOLS-577
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.1.0.Final
> Reporter: Wayne Price
> Assignee: Edson Tirelli
> Priority: Minor
>
> Engine seems not find objects when trying to filter based on a field name "rule".
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list