1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.rules.rule.event;
17
18 import org.kuali.rice.krad.document.Document;
19 import org.kuali.rice.krad.rules.rule.BusinessRule;
20 import org.kuali.rice.krad.rules.rule.SaveDocumentRule;
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
34
35 public class SaveDocumentEvent extends DocumentEventBase implements SaveEvent {
36
37
38
39
40
41
42
43 public SaveDocumentEvent(String errorPathPrefix, Document document) {
44 this("creating save event for document " + getDocumentId(document), errorPathPrefix, document);
45 }
46
47
48
49
50
51
52 public SaveDocumentEvent(Document document) {
53 this("", document);
54 }
55
56
57
58
59
60 public SaveDocumentEvent(String description, String errorPathPrefix, Document document) {
61 super(description, errorPathPrefix, document);
62 }
63
64
65
66
67 public Class<? extends BusinessRule> getRuleInterfaceClass() {
68 return SaveDocumentRule.class;
69 }
70
71
72
73
74 public boolean invokeRuleMethod(BusinessRule rule) {
75 return ((SaveDocumentRule) rule).processSaveDocument(document);
76 }
77
78
79
80
81 @Override
82 public List<RuleEvent> generateEvents() {
83 KualiRuleService ruleService = KRADServiceLocatorWeb.getKualiRuleService();
84
85 List<RuleEvent> events = new ArrayList<RuleEvent>();
86 events.addAll(ruleService.generateAdHocRoutePersonEvents(getDocument()));
87 events.addAll(ruleService.generateAdHocRouteWorkgroupEvents(getDocument()));
88
89 events.addAll(getDocument().generateSaveEvents());
90
91 return events;
92 }
93 }