1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sec.service.impl;
17
18 import org.kuali.ole.sec.document.validation.impl.AccessSecurityAccountingDocumentRuleBase;
19 import org.kuali.ole.sec.service.AccessSecurityService;
20 import org.kuali.ole.sys.context.SpringContext;
21 import org.kuali.rice.krad.document.Document;
22 import org.kuali.rice.krad.rules.rule.BusinessRule;
23 import org.kuali.rice.krad.service.impl.DocumentDictionaryServiceImpl;
24
25 public class SecDocumentDictionaryServiceImpl extends DocumentDictionaryServiceImpl {
26 private AccessSecurityService accessSecurityService;
27
28 protected AccessSecurityService getAccessSecurityService() {
29 if ( accessSecurityService == null ) {
30 accessSecurityService = SpringContext.getBean(AccessSecurityService.class);
31 }
32 return accessSecurityService;
33 }
34
35
36
37
38 @Override
39 public Class<? extends BusinessRule> getBusinessRulesClass(Document document) {
40 String documentType = document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName();
41
42 if (getAccessSecurityService().isAccessSecurityControlledDocumentType(documentType)) {
43 return AccessSecurityAccountingDocumentRuleBase.class;
44 }
45
46 return super.getBusinessRulesClass(document);
47 }
48 }