blob: 6924fc3a9313c2bf52f4d655764a4bdc7e0a2105 (
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 Params
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
|