1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.rule.event;
17
18 import org.kuali.rice.krad.document.Document;
19 import org.kuali.rice.krad.rule.BusinessRule;
20 import org.kuali.rice.krad.rule.SendAdHocRequestsRule;
21 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
22 import org.kuali.rice.krad.service.KualiRuleService;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27
28
29
30
31
32
33 public class SendAdHocRequestsEvent extends KualiDocumentEventBase {
34
35 public SendAdHocRequestsEvent(String errorPathPrefix, Document document) {
36 this("creating send adhoc requests event for document " + getDocumentId(document), errorPathPrefix, document);
37 }
38
39
40
41
42
43
44 public SendAdHocRequestsEvent(Document document) {
45 this("", document);
46 }
47
48 public SendAdHocRequestsEvent(String description, String errorPathPrefix, Document document) {
49 super(description, errorPathPrefix, document);
50 }
51
52
53
54
55
56
57 public Class<? extends BusinessRule> getRuleInterfaceClass() {
58 return SendAdHocRequestsRule.class;
59 }
60
61
62
63
64 public boolean invokeRuleMethod(BusinessRule rule) {
65 return ((SendAdHocRequestsRule) rule).processSendAdHocRequests(document);
66 }
67
68
69
70
71 @Override
72 public List<KualiDocumentEvent> generateEvents() {
73 KualiRuleService ruleService = KRADServiceLocatorWeb.getKualiRuleService();
74
75 List<KualiDocumentEvent> events = new ArrayList<KualiDocumentEvent>();
76 events.addAll(ruleService.generateAdHocRoutePersonEvents(getDocument()));
77 events.addAll(ruleService.generateAdHocRouteWorkgroupEvents(getDocument()));
78 return events;
79 }
80 }