I am trying to write a drools rule that would check if a student has an average of more than 5 at a discipline and i get this error whenever i try to run a static method in the when clause. Moreover, i couldn't find in the drools documentation if it's possible to call a static method in the when section.
This is the rule :
rule "student with at least two grades and average less than 5" salience 8
when
$student : Student(grades.size() >= 2)
$list : ArrayList() from eval(computeAverageGrade($student))
$value : Double() from $list
Boolean(booleanValue() == true) from $value < 5.0
then
System.out.println(2);
student.setValid(false)
end
This is the method's header:
public static List<Double> computeAverageGrade(Student student)
and this is the error i am getting :
Caused by: org.mvel2.PropertyAccessException: [Error: null pointer or function not found: eval]
[Near : {... eval(computeAverageGrade($stud ....}]
^
[Line: 1, Column: 1]