我有以下POJO:
1)
Class1
2)
public class InvoiceDetails{
String currency;
public String getCurrency(){
return this.currency;
}
public void setCurrency(String currency){
this.currency = currency;
}
}
我想通过以下方式在我的Drools Decision表中创建一个条件:
public class ValidCurrencies {
List<String> currencies = new ArrayList<String>();
public ValidCurrencies() {
currencies.add("JPY");
currencies.add("USD");
currencies.add("EUR");
currencies.add("CNY");
}
public List<String> getCurrencies() {
return currencies;
}
public void setCurrencies(List<String> currencies) {
this.currencies = currencies;
}
}
有人可以帮助编写Decison表语法来编写以下内容吗?
CONDITION | ACTION
$inv: InvoiceDetails $validCurr: ValidCurrencies |
$param==$validCurr.getCurrencies().containsAll(Arrays.asList($inv.getCurrency()))
TRUE
FALSE
ValidCurrencies
答案 0 :(得分:0)
我相信您可以通过这种方式完成
<table>
<tr>
<th>CONDITION</th>
<th>CONDITION</th>
<th>CONDITION</th>
<th>ACTION</th>
</tr>
<tr>
<td>$inv: InvoiceDetails</td>
<td>$validCurr: ValidCurrencies</td>
<td>$param==$validCurr.getCurrencies().contains($inv.getCurrency())</td>
<td></td>
</tr>
<tr>
<td>TRUE</td>
<td>TRUE</td>
<td>TRUE</td>
<td>/**action 1**/</td>
</tr>
<tr>
<td>TRUE</td>
<td>TRUE</td>
<td>false</td>
<td>/**action 2**/</td>
</tr>
</table>