本文介绍了检查列表对象是否具有一定的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检查列表对象是否具有流口水值时遇到一些问题.

I have some problems checking if an object of a list has a value with drools.

我的模特是这个

class Products{
    private List<Approver> approvalPath;
}
class Approver{
    private String employeeName;
}

所以,我需要制定这样的规则

So, I need to make a rule like this

rule "member"
    when
        //approvalPath has an approver with name "Charles" (for example)
    then
        //do something
end

我该怎么办?

推荐答案

有两个版本.

when
  $app: Approver( employeeName == "Charles" )
  Products( approvalPath contains $pp )

并且:

when
  Products( $ap: approvalPath )
  Approver( employeeName == "Charles" ) from $ap

数字1要求插入批准者对象作为事实.

Number 1 requires the insertion of Approver objects as facts.

这篇关于检查列表对象是否具有一定的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 19:17