2013-07-12 64 views
0

工作規則:JBoss的滴料 - 比較衍生串

rule "it is morning before lunch" 
    ruleflow-group "define_period" 
    when 
     $process: WorkflowProcessInstance() 
     Hour(value >=6 && < 12) from $process.getVariable("hourOfDay") 
    then 
     System.out.println("Its morning"); 
end 

課時:

public class Hour { 
    private Integer value; 
    public Hour() {} 
    public Hour(Integer value) { 
     this.value=value; 
    } 
    public void setValue(Integer value) { 
     this.value = value; 
    } 

    public Integer getValue() { 
     return value; 
    } 

    @Override 
    public String toString() { 
     return value+"h"; 
    } 
} 

$方法還,則爲另一變量 - '時段',這是類型的 '字符串' 。我想用這個來代替比較小時。我如何去做。我曾嘗試更換:

Hour(value >=6 && < 12) from $process.getVariable("hourOfDay")

String(this == "morning") from $process.getVariable("period")

String(value == "morning") from $process.getVariable("period")

但是,這並不工作。

讓我知道你是否需要更多信息。謝謝。

回答

0

嘗試使用

$process: WorkflowProcessInstance(period == 'morning') 

,而不是

$process: WorkflowProcessInstance()