以下决定 table 可能有什么问题?
What would possibly be wrong with the following decision table?
public class TestDecisionTable {
public static void main(String[] args)
{
try{
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-dtables");
Screens s1 = new Screens();
s1.setDeliveryChannel("Y");
s1.setUsePointsAppl("Y");
s1.setContactDetails("Y");
s1.setRiskScore("Y");
s1.setReasonCode(100);
s1.setCurrentScreen(303);
kSession.insert(s1);
Screens s2 = new Screens();
s2.setDeliveryChannel("Y");
s2.setUsePointsAppl("Y");
s2.setContactDetails("Y");
s2.setRiskScore("Y");
s2.setReasonCode(101);
s2.setCurrentScreen(303);
kSession.insert(s2);
Screens s3 = new Screens();
s3.setDeliveryChannel("Y");
s3.setUsePointsAppl("Y");
s3.setContactDetails("Y");
s3.setRiskScore("Y");
s3.setReasonCode(102);
s3.setCurrentScreen(303);
kSession.insert(s3);
kSession.fireAllRules();
}
catch (Throwable t) {
t.printStackTrace();
}
}
}
我现在只用一个规则来执行这个决定 table。我收到 "mismatch input '==' in rule "Screens_11"],text=parser returned a null Package]]" 错误。这是堆栈跟踪:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=Sample.xls, line=8, column=0
text=[ERR 102] Line 8:16 mismatched input '==' in rule "Screens_11"], Message [id=2, level=ERROR, path=Sample.xls, line=0, column=0
text=Parser returned a null Package]]
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:450)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:604)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:575)
at com.sample.TestDecisionTable.main(TestDecisionTable.java:15)
如有任何帮助,我们将不胜感激。
编辑:添加了从电子表格生成的文本
=== Begin generated DRL ===
package com.sample;
//generated from Decision Table
import com.sample.Screens;
// rule values at C11, header at C6
rule "Screens_11"
when
var:Screens(deliveryChannel == "Y")
usePointsAppl == "Y"
contactDetails == "Y"
riskScore == "Y"
reasonCode == 100
currentScreen == 303
then
var.setNextScreen(306);
System.out.println(var.getNextScreen());
end
// rule values at C12, header at C6
rule "Screens_12"
when
var:Screens(deliveryChannel == "Y")
usePointsAppl == "Y"
contactDetails == "Y"
riskScore == "Y"
reasonCode == 100
currentScreen == 303
then
var.setNextScreen(306);
System.out.println(var.getNextScreen());
end
=== End generated DRL ===
第 8 行已合并单元格。不要加入超出限制的列。
尝试此代码并报告完整输出。
private void testSpreadsheet(){
File dtf = new File( dtPath );
InputStream is;
try {
is = new FileInputStream( dtf );
SpreadsheetCompiler ssComp = new SpreadsheetCompiler();
String s = ssComp.compile( is, InputType.XLS );
System.out.println( "=== Begin generated DRL ===" );
System.out.println( s );
System.out.println( "=== End generated DRL ===" );
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public class TestDecisionTable {
public static void main(String[] args)
{
try{
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-dtables");
Screens s1 = new Screens();
s1.setDeliveryChannel("Y");
s1.setUsePointsAppl("Y");
s1.setContactDetails("Y");
s1.setRiskScore("Y");
s1.setReasonCode(100);
s1.setCurrentScreen(303);
kSession.insert(s1);
Screens s2 = new Screens();
s2.setDeliveryChannel("Y");
s2.setUsePointsAppl("Y");
s2.setContactDetails("Y");
s2.setRiskScore("Y");
s2.setReasonCode(101);
s2.setCurrentScreen(303);
kSession.insert(s2);
Screens s3 = new Screens();
s3.setDeliveryChannel("Y");
s3.setUsePointsAppl("Y");
s3.setContactDetails("Y");
s3.setRiskScore("Y");
s3.setReasonCode(102);
s3.setCurrentScreen(303);
kSession.insert(s3);
kSession.fireAllRules();
}
catch (Throwable t) {
t.printStackTrace();
}
}
}
我现在只用一个规则来执行这个决定 table。我收到 "mismatch input '==' in rule "Screens_11"],text=parser returned a null Package]]" 错误。这是堆栈跟踪:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=Sample.xls, line=8, column=0
text=[ERR 102] Line 8:16 mismatched input '==' in rule "Screens_11"], Message [id=2, level=ERROR, path=Sample.xls, line=0, column=0
text=Parser returned a null Package]]
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:450)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:604)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:575)
at com.sample.TestDecisionTable.main(TestDecisionTable.java:15)
如有任何帮助,我们将不胜感激。
编辑:添加了从电子表格生成的文本
=== Begin generated DRL ===
package com.sample;
//generated from Decision Table
import com.sample.Screens;
// rule values at C11, header at C6
rule "Screens_11"
when
var:Screens(deliveryChannel == "Y")
usePointsAppl == "Y"
contactDetails == "Y"
riskScore == "Y"
reasonCode == 100
currentScreen == 303
then
var.setNextScreen(306);
System.out.println(var.getNextScreen());
end
// rule values at C12, header at C6
rule "Screens_12"
when
var:Screens(deliveryChannel == "Y")
usePointsAppl == "Y"
contactDetails == "Y"
riskScore == "Y"
reasonCode == 100
currentScreen == 303
then
var.setNextScreen(306);
System.out.println(var.getNextScreen());
end
=== End generated DRL ===
第 8 行已合并单元格。不要加入超出限制的列。
尝试此代码并报告完整输出。
private void testSpreadsheet(){
File dtf = new File( dtPath );
InputStream is;
try {
is = new FileInputStream( dtf );
SpreadsheetCompiler ssComp = new SpreadsheetCompiler();
String s = ssComp.compile( is, InputType.XLS );
System.out.println( "=== Begin generated DRL ===" );
System.out.println( s );
System.out.println( "=== End generated DRL ===" );
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}