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 |