假设我有两个数据对象Person
和Address
。 Person对象包含字段name
和gender
,Address对象包含字段city
和state
。现在我想根据这个条件采取一些行动:
when
(person.name == 'jayram' && address.city == 'barhiya') ||
(person.gender == 'M' && address.state == 'bihar')
then
do something
如何在drools规则文件中完成此操作?
答案 0 :(得分:0)
也许这应该是解决方案:
package com.sample
dialect "mvel"
import com.sample.Person;
import com.sample.Address;
rule "Hello World"
when
person : Person( status == Message.HELLO)
Address((person.name == 'jayram' && city == 'barhiya') ||
(person.gender == 'M' && state == 'bihar'))
then
// Do something
end