View Javadoc
1   /*
2    * Copyright 2010 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl1.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.coa.document.authorization;
17  
18  import java.util.Set;
19  
20  import org.kuali.ole.coa.service.AccountService;
21  import org.kuali.ole.sys.OLEPropertyConstants;
22  import org.kuali.ole.sys.context.SpringContext;
23  import org.kuali.ole.sys.document.authorization.FinancialSystemMaintenanceDocumentPresentationControllerBase;
24  import org.kuali.rice.kns.document.MaintenanceDocument;
25  import org.kuali.rice.krad.util.KRADConstants;
26  
27  public class IndirectCostRecoveryRateMaintenanceDocumentPresentationController extends FinancialSystemMaintenanceDocumentPresentationControllerBase {
28      public static final String COA_CODE_NAME = KRADConstants.ADD_PREFIX + "." + OLEPropertyConstants.INDIRECT_COST_RECOVERY_RATE_DETAILS + "." + OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE;
29  
30      /**
31       * @see org.kuali.rice.krad.document.authorization.MaintenanceDocumentPresentationControllerBase#getConditionallyReadOnlyPropertyNames(org.kuali.rice.kns.document.MaintenanceDocument)
32       * 
33       * This methods adds the extra chart code field in IndirectCostRecoveryRateDetails, as the potential reference account doesn't exist in
34       * the collection, and thus isn't included in AccountPersistenceStructureService.listChartOfAccountsCodeNames as in the super's method.
35       */
36      @Override
37      public Set<String> getConditionallyReadOnlyPropertyNames(MaintenanceDocument document) {
38          Set<String> readOnlyPropertyNames = super.getConditionallyReadOnlyPropertyNames(document);
39  
40          // if accounts can't cross charts, then add the extra chartOfAccountsCode fields to be displayed readOnly
41          if (!SpringContext.getBean(AccountService.class).accountsCanCrossCharts()) { 
42              readOnlyPropertyNames.add(COA_CODE_NAME);
43          }
44          
45          return readOnlyPropertyNames;                
46      }
47      
48  }