1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.ole.sys.document.authorization;
17  
18  import java.util.Set;
19  
20  import org.kuali.ole.coa.service.AccountPersistenceStructureService;
21  import org.kuali.ole.coa.service.AccountService;
22  import org.kuali.ole.sys.context.SpringContext;
23  import org.kuali.rice.core.api.parameter.ParameterEvaluatorService;
24  import org.kuali.rice.kns.document.MaintenanceDocument;
25  import org.kuali.rice.kns.document.authorization.MaintenanceDocumentPresentationControllerBase;
26  import org.kuali.rice.krad.bo.PersistableBusinessObject;
27  
28  public class FinancialSystemMaintenanceDocumentPresentationControllerBase extends MaintenanceDocumentPresentationControllerBase {
29  
30      private static ParameterEvaluatorService parameterEvaluatorService;
31  
32      
33  
34  
35  
36  
37      public Set<String> getConditionallyReadOnlyPropertyNames(MaintenanceDocument document) {
38          Set<String> readOnlyPropertyNames = super.getConditionallyReadOnlyPropertyNames(document);
39  
40          
41          if (!SpringContext.getBean(AccountService.class).accountsCanCrossCharts()) {
42              AccountPersistenceStructureService apsService = SpringContext.getBean(AccountPersistenceStructureService.class);
43              PersistableBusinessObject bo = document.getNewMaintainableObject().getBusinessObject();
44  
45              
46              Set<String> coaCodeNames = apsService.listChartOfAccountsCodeNames(bo);
47              readOnlyPropertyNames.addAll(coaCodeNames);
48  
49              
50              coaCodeNames = apsService.listCollectionChartOfAccountsCodeNames(bo);
51              readOnlyPropertyNames.addAll(coaCodeNames);
52          }
53  
54          return readOnlyPropertyNames;
55      }
56  
57      protected ParameterEvaluatorService getParameterEvaluatorService() {
58          if (parameterEvaluatorService == null) {
59              parameterEvaluatorService = SpringContext.getBean(ParameterEvaluatorService.class);
60          }
61          return parameterEvaluatorService;
62      }
63  }