This repository has been archived by the owner on May 26, 2022. It is now read-only.
/
agent-brain_hello-module.drl
114 lines (72 loc) · 2.77 KB
/
agent-brain_hello-module.drl
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package org.drools.mas;
import org.drools.mas.body.content.*;
import org.drools.mas.action.message.*;
import org.drools.mas.action.message.types.*;
import org.drools.mas.action.message.invokers.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Date;
import org.drools.mas.action.helpers.*;
import javax.xml.ws.BindingProvider;
global java.util.Map channels;
// totally useless rule, except for debug :)
rule "Deliver Message Action Found"
when
$action: Action( actionName == "deliverMessage",
$refId : this["refId"],
$convoId : this["conversationId"]
)
$old : MessageDeliveredResponse( refId != $refId || convoId != $convoId )
then
System.out.println("!!!! Action RefId >>> " + $refId );
System.out.println("!!!! Action ConvoId >>> " + $convoId );
end
//TODO : remove when delivery will generate the resp
rule "Deliver Message Action Reset Result"
when
$action: Action( actionName == "deliverMessage",
$refId : this["refId"],
$convoId : this["conversationId"]
)
then
insert( new MessageDeliveredResponse( (String) $refId, (String) $convoId ) );
end
rule "Deliver Message Action Reset Result - Clean"
when
$action: Action( actionName == "deliverMessage",
$refId : this["refId"],
$convoId : this["conversationId"]
)
$old : MessageDeliveredResponse( refId != $refId || convoId != $convoId )
then
retract( $old );
end
rule "Clean Deliver Message Action"
salience -999
when
$action: Action( actionName == "deliverMessage" )
then
retract( $action );
end
rule "Insert Subject-About Entities"
when
$action: Action( actionName == "deliverMessage",
$refId : this["refId"],
$cnvId : this["conversationId"],
$subjectAbout : this["subjectAbout"]
)
$id : String() from $subjectAbout
then
insertLogical( new Entity( $id ) );
end
query deliverMessage( String $refId, String $conversationId,
String $subjectabout,
String $sender, String $mainRecipients, String $secondaryRecipients, String $hiddenRecipients,
String $type, String $header, String $body,
String $priority,
String $deliveryDate, String $status,
MessageDeliveredResponse $return )
$return:= MessageDeliveredResponse( $refId, $conversationId; )
end