[rules-users] java dialect and declared types
Davide Sottara
dsotty at gmail.com
Thu Jan 23 07:51:23 EST 2014
Declared types have public accessors as usual.
This seems a minor bug in the expression analysis.
Can you try
getRaw().complicated()
and / or
raw.complicated
and report what happens?
Thanks
Davide
On 01/23/2014 06:40 AM, pmander wrote:
> If I declare a type in a drl and reference the attributes in a rule then all
> is fine for either dialect. But, if one of the attributes is a java class
> that has been compiled and inserted then under the java dialect only I get a
> compilation error: rule compilation error the field ... is not visible
>
> for example
>
> declare DroolsTransaction
> ORG : String
> PRODUCT : String
> raw : Transaction
> end
>
> rule "create classes"
> salience 100
> when
> $t : Transaction()
> then
> insert(new DroolsTransaction((String)$t.fieldFor("ORG"),
> (String)$t.fieldFor("PRODUCT"), $t));
> end
>
> I insert Transaction objects in the session and this works fine for the
> following rule if I have the dialect set to mvel.
>
> rule "1"
> when
> $t : DroolsTransaction(ORG == "A" , PRODUCT == "001", raw.complicated())
> then
> do something
> end
>
> but when I switch dialects to java, the compilation complains that raw is
> not visible.
>
> I guess drools is dynamically creating the DroolsTransaction object with
> private fields... and I need public accessors - how to define them?
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/java-dialect-and-declared-types-tp4027822.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
More information about the rules-users
mailing list