You can only use memberOf with Collection or arrays, so you should be binding your variables to the list, instead of the class:

Workdays( $wd : workDays )

   []s
   Edson

2008/10/3 Marcin Krol <mrkafk@gmail.com>

I'm doing this:

ThermostatTimeData ttd1 = new ThermostatTimeData("January", "Monday", 14);
session.insert(ttd1);
WorkDays wd = new WorkDays();
session.insert(wd);
session.fireAllRules();
printoutThermostatData(ttd1);

and then this:

rule "Rule 1"
 when
   $wd : com.sample.WorkDays()
   $ttd : ThermostatTimeData ( day memberOf $wd )
 then
       modify ( $ttd ) {
        setDaytype("workday")
       }
       System.out.println("Rule 1 fired.");
end

And I get the error like in subject. Anybody knows why?


WorkDays.java:

package com.sample;
import java.util.ArrayList;
import java.util.List;


public class WorkDays {
               private List<String> wd;
               
               public WorkDays() {
                       this.wd = new ArrayList<String>();
                       this.wd.add("Monday");
                       this.wd.add("Tuesday");
                       this.wd.add("Wednesday");
                       this.wd.add("Thursday");                        
                       this.wd.add("Friday");                  
               }
               
               public List<String> getWorkDays() {
                       return this.wd;
               }
}
       

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



--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com