【发布时间】:2020-02-05 23:29:37
【问题描述】:
假设我有一个如下所示的规则文件。以下规则基于 2 个属性 Instrument 和 maverickModelMappingId。 Drools 可以告诉我有多少规则使用“仪器”字段吗?我的用例是我想知道我是要删除一个属性还是一个字段,有多少条规则以及哪些规则会受到影响。
package abc.modelMapping.ruleEngine;
dialect "java"
declare FRONTOFFICESYSTEM
Instrument : String
maverickModelMappingId : String
end
rule "rule_MurexCredit_Rule_3"
salience 3
no-loop true
when
$frontOfficeSystem : FRONTOFFICESYSTEM("Default swap".equalsIgnoreCase(Instrument))
then
$frontOfficeSystem.setMaverickModelMappingId("001282");
System.out.println("001282 "+"MurexCredit_Rule_3+");
end
rule "rule_MurexCredit_Rule_2"
salience 2
no-loop true
when
$frontOfficeSystem : FRONTOFFICESYSTEM("Euro credit index option".equalsIgnoreCase(Instrument))
then
$frontOfficeSystem.setMaverickModelMappingId("001283");
System.out.println("001283 "+"MurexCredit_Rule_2+");
end
rule "rule_MurexCredit_Rule_1"
salience 1
no-loop true
when
$frontOfficeSystem : FRONTOFFICESYSTEM("Credit index".equalsIgnoreCase(Instrument))
then
$frontOfficeSystem.setMaverickModelMappingId("001282");
System.out.println("001282 "+"MurexCredit_Rule_1+");
end
【问题讨论】:
-
Drools 本身无法判断有多少规则使用了一个属性。使用 IDE 的搜索工具会是更好的解决方案。
标签: drools rules rule-engine