On Thu, Mar 19, 2009 at 7:52 AM, Nikhil_dev
<k.nikhil@verchaska.com>
wrote:
i have combined all the rules into a single RuleBase,
below is the content of drl file,
package com.vtech.ruleengine.module.rulemanagermodule
import com.vtech.ruleengine.module.rulemanagermodule.RuleAttributes;
import java.util.Map;
rule "adt_chld_fare"
dialect "mvel"
when
$a : RuleAttributes()
eval ($a.Values["Adult Fare"]> ($a.Values["Child Fare"]+ 1500
) )
then
($a.Values["AcceptRejectFilter"]='Reject')
end
rule "DEMO_RULE"
dialect "mvel"
when
$a : RuleAttributes()
eval ($a.Values["Adult Fare"]> 8000 )
then
($a.Values["Nett Payable"]= ($a.Values["Adult Fare"]* 0.80 ) )
end
rule "Compare_date_1"
dialect "mvel"
when
$a : RuleAttributes()
eval ('12-Jan-2009'>='15-Jan-2008')
then
($a.Values["Adult Fare"]= 5000 )
end
rule "Rule_20090106_1"
dialect "mvel"
when
$a : RuleAttributes()
eval ( ($a.Values["No Of Adults"]< 10 ) &&
($a.Values["No Of
Adults"]> 5 ) )
then
($a.Values["Adult Fare"]= ($a.Values["Adult Fare"]+ -50 ) )
end
rule "Rule_20090107_Markup"
dialect "mvel"
when
$a : RuleAttributes()
eval ($a.Values["markupPerc"]>= 0 )
then
($a.Values["markupAmount"]=
($a.Values["buyingAmount"]*$a.Values["markupPerc"]) )
end
rule "Sample_Rule"
dialect "mvel"
when
$a : RuleAttributes()
eval ($a.Values["Sector"]< 0 )
then
($a.Values["Via"]= ($a.Values["Via1"]+ 1250 ) )
end
i am passing following hashmap containing,
hmAttriList.put("Adult Fare", 8000);
hmAttriList.put("Child Fare", 80);
hmAttriList.put("Gross Fare", 0);
hmAttriList.put("Published Fare", 0);
while executing it i am getting following error message
SEVERE [global]
org.mvel.CompileException: could not perform numeric operation on
non-numeric types: left-type=null; right-type=java.lang.Integer
at
org.mvel.math.IEEEFloatingPointMath.doOperationNonNumeric(IEEEFloatingPointMath.java:149)
at
org.mvel.math.IEEEFloatingPointMath._doOperations(IEEEFloatingPointMath.java:102)
at
org.mvel.math.IEEEFloatingPointMath.doOperation(IEEEFloatingPointMath.java:43)
at org.mvel.util.ParseTools.doOperations(ParseTools.java:810)
at
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
at
org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)
at
org.mvel.ast.Substatement.getReducedValueAccelerated(Substatement.java:24)
.............
..............
==>[ActivationCreated(0): rule=adt_chld_fare;
tuple=[fid:1:1:com.vtech.ruleengine.module.rulemanagermodule.RuleAttributes@14a0fe1]
]
Error Message : org.mvel.CompileException: could not perform numeric
operation on non-numeric types: left-type=null;
right-type=java.lang.Integer