Hello,
I want to use StatelessSession with spreadsheet. I wrote few rules in DRL,
but I cant do it in spreadsheet. First I want to present rules and class
that is used by rules:
public class CProduct {
private String name;
private int value;
public CProduct ()
{
name = "empty";
value = 0;
}
public CProduct (String name, int value)
{
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
}
Rules:
rule "Case A"
salience 1
activation-group "g1"
when
p : CProduct( name == "A" )
then
System.out.println("Special product: " + p.getName());
end
rule "Case B"
salience 1
activation-group "g1"
when
p : CProduct( name == "B" )
then
System.out.println("Special product: " + p.getName());
end
rule "Case general"
salience 0
activation-group "g1"
when
p : CProduct( )
then
System.out.println("Normal product: " + p.getName());
end
Using stateLessSession, salience, and activation-group I can determine, that
only one rule is going to be fired for each CProduct. And with salience
param, I can determine priority (it is important to get special products
first).
Now I am going to write those rules in spreadsheet. But I can't define rule
"Case general".
CONDITION ACTION ACTIVATION-GROUP PRIORITY p:CProduct name
System.out.println("$param"); Rules names
Product name what to print
Case A
A
Special A
G1 1 Case B
B Special B G1 1 General case
normal G1 0
But when I am going to use the spreadsheet, I get this error:
"p cannot be resolved"
Problem disappears, when I fill "Product name" in "General case".
But I want it to be empty, because I want to fire rule "General case" when
rules "Case A" & "Case B" won't fire for any object's
name.
Thanks, Tom.