forall总是评价为真[Drools]

时间:2016-06-03 05:06:04

标签: java drools rules rule-engine

我有一个类Application,其中有一个CallPhones实例列表。

class Application() {
      List<CallPhones> callPhonesList;
      ...
}

class CallPhones() {
      Integer callTimes;
      ...
}

我想在所有大于10的实例callTimes时触发规则。以下是规则:

rule "Application eligible"
    when
        app : Application()
        forall(CallPhones(callTimes > 10))
    then 
        // application is eligible
end

奇怪的是,规则总是触发,即使callTimesSET column_name = CASE WHEN ... THEN .. ELSE ... END的实例也是5.我也尝试了this question的答案,但没有得到任何帮助。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

应该是

rule "Application eligible"
    when
        app : Application()
        forall($temp:CallPhones(callUserTimes > 10) from app.callPhoneList)
    then 
        // application is eligible
end