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