1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.service.impl;
17
18 import org.kuali.rice.krad.bo.AdHocRoutePerson;
19 import org.kuali.rice.krad.bo.AdHocRouteWorkgroup;
20 import org.kuali.rice.krad.rules.rule.event.AddAdHocRoutePersonEvent;
21 import org.kuali.rice.krad.rules.rule.event.AddAdHocRouteWorkgroupEvent;
22 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
23 import org.kuali.rice.krad.service.KualiRuleService;
24 import org.kuali.rice.krad.uif.view.ViewModel;
25 import org.kuali.rice.krad.web.form.DocumentFormBase;
26
27
28
29
30
31
32 public class DocumentViewHelperServiceImpl extends ViewHelperServiceImpl {
33 private static final long serialVersionUID = 5311653907592800785L;
34
35 private transient KualiRuleService kualiRuleService;
36
37
38
39
40
41
42
43
44
45
46 @Override
47 protected boolean performAddLineValidation(ViewModel model, Object addLine, String collectionId,
48 String collectionPath) {
49 boolean isValidLine = super.performAddLineValidation(model, addLine, collectionId, collectionPath);
50
51 if (model instanceof DocumentFormBase && addLine instanceof AdHocRoutePerson) {
52 DocumentFormBase form = (DocumentFormBase) model;
53 isValidLine &= getKualiRuleService().applyRules(new AddAdHocRoutePersonEvent(form.getDocument(),
54 (AdHocRoutePerson) addLine));
55 } else if (model instanceof DocumentFormBase && addLine instanceof AdHocRouteWorkgroup) {
56 DocumentFormBase form = (DocumentFormBase) model;
57 isValidLine &= getKualiRuleService().applyRules(new AddAdHocRouteWorkgroupEvent(form.getDocument(),
58 (AdHocRouteWorkgroup) addLine));
59 }
60
61 return isValidLine;
62 }
63
64
65
66
67
68
69 protected KualiRuleService getKualiRuleService() {
70 if (kualiRuleService == null) {
71 kualiRuleService = KRADServiceLocatorWeb.getKualiRuleService();
72 }
73
74 return this.kualiRuleService;
75 }
76 }