[rules-users] Using ArrayList as global in DRL file

2009-07-29 Thread Divya Rajendranath
Hi,

I am setting an ArrayList as a Global on my drools session by saying ...

StatefulSession drlSession = getRuleManager().getSession();
drlSession.setGlobal("myMailingList", myMailingList);

then in my Drl file, I send the same arrayList as a parameter to the setter
of another object by saying...

package com.test.rules;

import java.util.ArrayList;

global java.util.ArrayList myMailingList;

rule "Test"
salience 100
no-loop true
when
$o:MyObject(some condition)
$d:Destination()
then
$d.setFieldMember(myMailingList)
end

So, based on some condition/field value in MyObject I want to set the
Destination with the arraylist - myMailingList.

Is the way I specify/refer the ArrayList in the then part fine. Because I am
always getting "unable to compile test.drl file - runtime exception".

Could some one please help me with this.

-thnx
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help on using Drools with embedded objects

2009-02-23 Thread Divya Rajendranath
Hi,

I am planning to use Drools - JBoss Rules Engine. My requirement is to
disburse mails from my application to different groups based on various
criteria. I want to use Drools here.

My object structure is as follows:

class A{

String B = "";

B b;

C c;
}

Hence Obj A has embedded objects within it, and obj B and C further has
embedded objects.

class B {

String X;

Z z;

}

class Z{

String t;

String s;

}

The decision on sending the mails based on the fields in embedded objects of
A. I pass instance of A to Drools

Format of drl file:

package...;

import ..;

rule "Test"

when $a:A(B(Z(s == "testvalue")))

then

$a.setSomething();

update($a);

end

I wanted to know if this (accessing fields in embedded/child object) is
feasible with Drools.

I get an error saying "UNable to compile myfile.drl when i try to fo this.

Could some one look into this issue and let me know the reason for this ?



Thanks

-D
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users