[rules-users] How to Compute against WorkingMemory in Drools ?
Wolfgang Laun
wolfgang.laun at gmail.com
Fri Apr 26 09:04:36 EDT 2013
>From the rule "CORRELATION" I can guess that
class Alert {
List<Alert> alerts = ...;
public List<Alert> getAlerts(){ return alerts; }
}
which is a little strange.
If you add the constraint alertDescription contains "ERR" to the
collect, you don't need the function checkForAlertDescription any
more.
-W
On 26/04/2013, vr <veneet at aol.in> wrote:
>
>
> *My DRL snapshot*
>
> rule "CORRELATION"
> salience 1
> when
> $alert : Alert()
> $list : ArrayList() from collect (Alert ( sourceName=="NETWORK")
> from $alert.alerts)
> then
> checkForAlertDescription($list,drools.getWorkingMemory(),$alert);
>
> //Update the alert list
> end
>
>
>
> function void checkForAlertDescription(ArrayList list,WorkingMemory
> wm,Alert
> alert) {
>
> /// i update the alert array list via fetching the list i received from the
> rule above/
> ArrayList<Alert> alist =new ArrayList<Alert>();
> for(int i=0;i<list.size();i++){
> if( ((Alert)list.get(i)).getAlertDescription().contains("ERR"))
> alist.add((Alert)list.get(i));
> }
>
> alert.setAlerts(list);
>
>
> }
>
>
>
>
>
>
>
>
> -----
> Thanks for the support ...!!!
> VR
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-Compute-against-WorkingMemory-in-Drools-tp4023550p4023555.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