blob: a3cdb7851b27c070c8d96511b49b3c3b991ad9c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package com.sample
import com.sample.DroolsTest.Message;
// Declare the Parameters here.
declare PapParams
samPoll : int
value : String
end
// This Rule will be generated by the UI.
rule "Create parameters structure"
salience 1000
when
then
Params params = new Params();
params.setSamPoll(76);
params.setValue("Bobby");
insertLogical(params);
end
// Start using the parameters as below in Rules.
rule "Rule 1: Check parameter structure access from when/then"
when
$param: Params()
Params($param.samPoll > 50)
then
System.out.println("Firing rule 1");
System.out.println($param);
end
rule "Rule 2: Check parameter value access from when/then"
when
$param: Params()
Params($param.samPoll > 50)
then
System.out.println("Firing rule 2");
System.out.println($param.getValue());
System.out.println($param.getSamPoll());
end
|