View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.fp.document.web.struts;
20  
21  import java.util.Map;
22  
23  import org.kuali.kfs.fp.document.IndirectCostAdjustmentDocument;
24  import org.kuali.kfs.fp.document.validation.impl.IndirectCostAdjustmentDocumentRuleConstants;
25  import org.kuali.kfs.sys.KFSPropertyConstants;
26  import org.kuali.kfs.sys.businessobject.SourceAccountingLine;
27  import org.kuali.kfs.sys.businessobject.TargetAccountingLine;
28  import org.kuali.kfs.sys.context.SpringContext;
29  import org.kuali.kfs.sys.document.AccountingDocument;
30  import org.kuali.kfs.sys.web.struts.KualiAccountingDocumentFormBase;
31  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
32  
33  /**
34   * This class is the action form for Indirect Cost Adjustment Document
35   */
36  public class IndirectCostAdjustmentForm extends KualiAccountingDocumentFormBase {
37  
38      /**
39       * Constructs a IndirectCostAdjustmentForm.java.
40       */
41      public IndirectCostAdjustmentForm() {
42          super();
43      }
44  
45      @Override
46      protected String getDefaultDocumentTypeName() {
47          return "ICA";
48      }
49      
50      /**
51       * @return Returns the Indirect Cost Adjustment Document
52       */
53      public IndirectCostAdjustmentDocument getIndirectCostAdjustmentDocument() {
54          return (IndirectCostAdjustmentDocument) getDocument();
55      }
56  
57      /**
58       * @param indirectCostAdjustmentDocument the <code>IndirectCostAdjustmentDocument</code> to set
59       */
60      public void setIndirectCostAdjustmentDocument(IndirectCostAdjustmentDocument indirectCostAdjustmentDocument) {
61          setDocument(indirectCostAdjustmentDocument);
62      }
63  
64      /**
65       * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewSourceAccountingLine(org.kuali.module.financial.document.FinancialDocument)
66       */
67      @Override
68      public SourceAccountingLine createNewSourceAccountingLine(AccountingDocument financialDocument) {
69          SourceAccountingLine sourceAccountingLine = super.createNewSourceAccountingLine(financialDocument);
70          String objectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.GRANT_OBJECT_CODE);
71  
72          sourceAccountingLine.setFinancialObjectCode(objectCode);
73          return sourceAccountingLine;
74      }
75  
76      /**
77       * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewTargetAccountingLine(org.kuali.module.financial.document.FinancialDocument)
78       */
79      @Override
80      public TargetAccountingLine createNewTargetAccountingLine(AccountingDocument financialDocument) {
81          TargetAccountingLine targetAccountingLine = super.createNewTargetAccountingLine(financialDocument);
82          String objectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.RECEIPT_OBJECT_CODE);
83  
84          targetAccountingLine.setFinancialObjectCode(objectCode);
85          return targetAccountingLine;
86      }
87  
88      /**
89       * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#getForcedReadOnlyFields()
90       */
91      @Override
92      public Map getForcedReadOnlyFields() {
93          Map map = super.getForcedReadOnlyFields();
94          map.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, Boolean.TRUE);
95          return map;
96      }
97  
98  }