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.rule.event.AddAdHocRoutePersonEvent; |
21 | |
import org.kuali.rice.krad.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.container.CollectionGroup; |
25 | |
import org.kuali.rice.krad.uif.view.View; |
26 | |
import org.kuali.rice.krad.web.form.DocumentFormBase; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | 0 | public class DocumentViewHelperServiceImpl extends ViewHelperServiceImpl { |
32 | |
|
33 | |
private KualiRuleService kualiRuleService; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@Override |
48 | |
protected boolean performAddLineValidation(View view, CollectionGroup collectionGroup, Object model, |
49 | |
Object addLine) { |
50 | 0 | boolean isValidLine = true; |
51 | |
|
52 | 0 | if (model instanceof DocumentFormBase && addLine instanceof AdHocRoutePerson) { |
53 | 0 | DocumentFormBase form = (DocumentFormBase) model; |
54 | 0 | isValidLine = getKualiRuleService() |
55 | |
.applyRules(new AddAdHocRoutePersonEvent(form.getDocument(), (AdHocRoutePerson) addLine)); |
56 | 0 | } else if (model instanceof DocumentFormBase && addLine instanceof AdHocRouteWorkgroup) { |
57 | 0 | DocumentFormBase form = (DocumentFormBase) model; |
58 | 0 | isValidLine = getKualiRuleService() |
59 | |
.applyRules(new AddAdHocRouteWorkgroupEvent(form.getDocument(), (AdHocRouteWorkgroup) addLine)); |
60 | |
} |
61 | |
|
62 | 0 | return isValidLine; |
63 | |
} |
64 | |
|
65 | |
protected KualiRuleService getKualiRuleService() { |
66 | 0 | if (kualiRuleService == null) { |
67 | 0 | kualiRuleService = KRADServiceLocatorWeb.getKualiRuleService(); |
68 | |
} |
69 | 0 | return this.kualiRuleService; |
70 | |
} |
71 | |
} |