[rules-users] java dialect and declared types

pmander paul.s.mander at gmail.com
Thu Jan 23 07:40:23 EST 2014


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.


More information about the rules-users mailing list