0

我有以下课程

public class DroolsObjectRule {

    private String backend;
    private Long time;
    private Long avgTime;
    private boolean allow=true;
    private String message;

    //Set

    //Get
}

我的规则

rule "rule_3_increment_more"
  salience 3
  when
    $drol: DroolsObjectRule(backend == "AD1" &&  (2 * $drol.avgTime) > $drol.time) [this is line 33]
  then
    $drol.setMessage("RULE 3");
end

当我运行代码时,出现以下错误

Caused by: java.lang.IllegalArgumentException: 
 [33,48]: [ERR 101] Line 33:48 no viable alternative at input '2'
          in rule "rule_3_increment_more" in pattern DroolsObjectRule
 [33,79]: [ERR 102] Line 33:79 mismatched input ')' expecting '('
          in rule "rule_3_increment_more" in pattern DroolsObjectRule in pattern $drol.time

任何想法?

4

1 回答 1

0

该规则在 5.3.0、5.6.0、5.5.0、6.0.0 和 6.1.0 中正常工作。

如果您使用旧版本,请坚持使用传统形式的约束:

DroolsObjectRule( backend == "AD1", $avgTime: avgTime,
                  time < 2*$avgTime )
于 2014-09-23T05:48:22.550 回答