001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.module.financial.web.struts.form;
017:
018: import java.util.Map;
019:
020: import org.kuali.kfs.KFSPropertyConstants;
021: import org.kuali.kfs.bo.SourceAccountingLine;
022: import org.kuali.kfs.bo.TargetAccountingLine;
023: import org.kuali.kfs.context.SpringContext;
024: import org.kuali.kfs.document.AccountingDocument;
025: import org.kuali.kfs.service.ParameterService;
026: import org.kuali.kfs.web.struts.form.KualiAccountingDocumentFormBase;
027: import org.kuali.module.financial.document.IndirectCostAdjustmentDocument;
028: import org.kuali.module.financial.rules.IndirectCostAdjustmentDocumentRuleConstants;
029:
030: /**
031: * This class is the action form for Indirect Cost Adjustment Document
032: */
033: public class IndirectCostAdjustmentForm extends
034: KualiAccountingDocumentFormBase {
035:
036: /**
037: * Constructs a IndirectCostAdjustmentForm.java.
038: */
039: public IndirectCostAdjustmentForm() {
040: super ();
041: setDocument(new IndirectCostAdjustmentDocument());
042: }
043:
044: /**
045: * @return Returns the Indirect Cost Adjustment Document
046: */
047: public IndirectCostAdjustmentDocument getIndirectCostAdjustmentDocument() {
048: return (IndirectCostAdjustmentDocument) getDocument();
049: }
050:
051: /**
052: * @param indirectCostAdjustmentDocument the <code>IndirectCostAdjustmentDocument</code> to set
053: */
054: public void setIndirectCostAdjustmentDocument(
055: IndirectCostAdjustmentDocument indirectCostAdjustmentDocument) {
056: setDocument(indirectCostAdjustmentDocument);
057: }
058:
059: /**
060: * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewSourceAccountingLine(org.kuali.module.financial.document.FinancialDocument)
061: */
062: @Override
063: public SourceAccountingLine createNewSourceAccountingLine(
064: AccountingDocument financialDocument) {
065: SourceAccountingLine sourceAccountingLine = super
066: .createNewSourceAccountingLine(financialDocument);
067: String objectCode = SpringContext
068: .getBean(ParameterService.class)
069: .getParameterValue(
070: IndirectCostAdjustmentDocument.class,
071: IndirectCostAdjustmentDocumentRuleConstants.GRANT_OBJECT_CODE);
072:
073: sourceAccountingLine.setFinancialObjectCode(objectCode);
074: return sourceAccountingLine;
075: }
076:
077: /**
078: * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewTargetAccountingLine(org.kuali.module.financial.document.FinancialDocument)
079: */
080: @Override
081: public TargetAccountingLine createNewTargetAccountingLine(
082: AccountingDocument financialDocument) {
083: TargetAccountingLine targetAccountingLine = super
084: .createNewTargetAccountingLine(financialDocument);
085: String objectCode = SpringContext
086: .getBean(ParameterService.class)
087: .getParameterValue(
088: IndirectCostAdjustmentDocument.class,
089: IndirectCostAdjustmentDocumentRuleConstants.RECEIPT_OBJECT_CODE);
090:
091: targetAccountingLine.setFinancialObjectCode(objectCode);
092: return targetAccountingLine;
093: }
094:
095: /**
096: * @see org.kuali.core.web.struts.form.KualiTransactionalDocumentFormBase#getForcedReadOnlyFields()
097: */
098: @Override
099: public Map getForcedReadOnlyFields() {
100: Map map = super.getForcedReadOnlyFields();
101: map.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE,
102: Boolean.TRUE);
103: return map;
104: }
105:
106: }
|