2017-09-11 46 views
0
Process Compilation error : [email protected]  
com/sample/Process_com_sample_ruleflowsample.java (21:862) : Type mismatch: cannot convert from int to String 
com/sample/Process_com_sample_ruleflowsample.java (29:1151) : Type mismatch: cannot convert from int to String 

這是我在拋出上述錯誤的src/main/rules下的ruleflowsample.rf。jBPM編譯錯誤

<?xml version="1.0" encoding="UTF-8"?> 
<process xmlns="http://drools.org/drools-5.0/process" 
     xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
     xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd" 
     type="RuleFlow" name="ruleflowsample" id="com.sample.ruleflowsample" package-name="com.sample" > 

    <header> 
    <imports> 
     <import name="com.sample.Employee" /> 
    </imports> 
    <variables> 
     <variable name="caffeineIntake" > 
     <type name="org.drools.process.core.datatype.impl.type.FloatDataType" /> 
     </variable> 
    </variables> 
    </header> 

    <nodes> 
    <start id="1" name="Start" x="12" y="129" width="48" height="48" /> 
    <split id="2" name="Gateway" x="101" y="128" width="49" height="49" type="2" > 
     <constraints> 
     <constraint toNodeId="4" toType="DROOLS_DEFAULT" name="Coffee" priority="1" type="code" dialect="java" >return caffeineIntake&gt;0.105F;</constraint> 
     <constraint toNodeId="5" toType="DROOLS_DEFAULT" name="Tea" priority="1" type="code" dialect="java" >return caffeineIntake&gt;0.04F;</constraint> 
     </constraints> 
    </split> 
    <actionNode id="4" name="Coffee" x="198" y="205" width="80" height="48" > 
     <action type="expression" dialect="java" >String noOfCups = 1; 
System.out.println("No of coffee cups = "+noOfCups); 
System.out.println("caffeineIntake");</action> 
    </actionNode> 
    <actionNode id="5" name="Tea" x="196" y="61" width="80" height="48" > 
     <action type="expression" dialect="java" >String noOfCups = 1; 
System.out.println("No of tea cups = "+noOfCups); 
System.out.println("caffeineIntake");</action> 
    </actionNode> 
    <end id="6" name="End" x="386" y="127" width="48" height="48" /> 
    <join id="7" name="Gateway" x="311" y="127" width="49" height="49" type="2" /> 
    </nodes> 

    <connections> 
    <connection from="1" to="2" /> 
    <connection from="2" to="4" /> 
    <connection from="2" to="5" /> 
    <connection from="7" to="6" /> 
    <connection from="5" to="7" /> 
    <connection from="4" to="7" /> 
    </connections> 

</process> 

我知道錯誤是因爲這條線的發生:System.out.println("caffeineIntake"); 我想要訪問該輸入變量,即caffeineIntake在其上執行一些操作。

回答

0

錯誤沒有發生,因爲這行:System.out.println("caffeineIntake");

這是因爲方言選項選擇的發生: enter image description here

使用這個選項,因爲MVEL而不是Java的解決了這個問題。

0

好,

從我的角度

String noOfCups = 1; 

點的問題。 也許將其更改爲

String noOfCups = "1"; 
+0

我明白報價。但是,即使沒有引用,它工作正常。 –