View Javadoc
1   /*
2    * Copyright 2005-2006 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.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/ecl2.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.fp.document.web.struts;
17  
18  import java.util.Map;
19  
20  import org.kuali.ole.fp.document.IndirectCostAdjustmentDocument;
21  import org.kuali.ole.fp.document.validation.impl.IndirectCostAdjustmentDocumentRuleConstants;
22  import org.kuali.ole.sys.OLEPropertyConstants;
23  import org.kuali.ole.sys.businessobject.SourceAccountingLine;
24  import org.kuali.ole.sys.businessobject.TargetAccountingLine;
25  import org.kuali.ole.sys.context.SpringContext;
26  import org.kuali.ole.sys.document.AccountingDocument;
27  import org.kuali.ole.sys.web.struts.KualiAccountingDocumentFormBase;
28  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
29  
30  /**
31   * This class is the action form for Indirect Cost Adjustment Document
32   */
33  public class IndirectCostAdjustmentForm extends KualiAccountingDocumentFormBase {
34  
35      /**
36       * Constructs a IndirectCostAdjustmentForm.java.
37       */
38      public IndirectCostAdjustmentForm() {
39          super();
40      }
41  
42      @Override
43      protected String getDefaultDocumentTypeName() {
44          return "OLE_ICA";
45      }
46      
47      /**
48       * @return Returns the Indirect Cost Adjustment Document
49       */
50      public IndirectCostAdjustmentDocument getIndirectCostAdjustmentDocument() {
51          return (IndirectCostAdjustmentDocument) getDocument();
52      }
53  
54      /**
55       * @param indirectCostAdjustmentDocument the <code>IndirectCostAdjustmentDocument</code> to set
56       */
57      public void setIndirectCostAdjustmentDocument(IndirectCostAdjustmentDocument indirectCostAdjustmentDocument) {
58          setDocument(indirectCostAdjustmentDocument);
59      }
60  
61      /**
62       * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewSourceAccountingLine(org.kuali.module.financial.document.FinancialDocument)
63       */
64      @Override
65      public SourceAccountingLine createNewSourceAccountingLine(AccountingDocument financialDocument) {
66          SourceAccountingLine sourceAccountingLine = super.createNewSourceAccountingLine(financialDocument);
67          String objectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.GRANT_OBJECT_CODE);
68  
69          sourceAccountingLine.setFinancialObjectCode(objectCode);
70          return sourceAccountingLine;
71      }
72  
73      /**
74       * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewTargetAccountingLine(org.kuali.module.financial.document.FinancialDocument)
75       */
76      @Override
77      public TargetAccountingLine createNewTargetAccountingLine(AccountingDocument financialDocument) {
78          TargetAccountingLine targetAccountingLine = super.createNewTargetAccountingLine(financialDocument);
79          String objectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.RECEIPT_OBJECT_CODE);
80  
81          targetAccountingLine.setFinancialObjectCode(objectCode);
82          return targetAccountingLine;
83      }
84  
85      /**
86       * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#getForcedReadOnlyFields()
87       */
88      @Override
89      public Map getForcedReadOnlyFields() {
90          Map map = super.getForcedReadOnlyFields();
91          map.put(OLEPropertyConstants.FINANCIAL_OBJECT_CODE, Boolean.TRUE);
92          return map;
93      }
94  
95  }