001/*
002 * Copyright 2005-2006 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.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/ecl2.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 */
016package org.kuali.ole.fp.document.web.struts;
017
018import java.util.Map;
019
020import org.kuali.ole.fp.document.IndirectCostAdjustmentDocument;
021import org.kuali.ole.fp.document.validation.impl.IndirectCostAdjustmentDocumentRuleConstants;
022import org.kuali.ole.sys.OLEPropertyConstants;
023import org.kuali.ole.sys.businessobject.SourceAccountingLine;
024import org.kuali.ole.sys.businessobject.TargetAccountingLine;
025import org.kuali.ole.sys.context.SpringContext;
026import org.kuali.ole.sys.document.AccountingDocument;
027import org.kuali.ole.sys.web.struts.KualiAccountingDocumentFormBase;
028import org.kuali.rice.coreservice.framework.parameter.ParameterService;
029
030/**
031 * This class is the action form for Indirect Cost Adjustment Document
032 */
033public class IndirectCostAdjustmentForm extends KualiAccountingDocumentFormBase {
034
035    /**
036     * Constructs a IndirectCostAdjustmentForm.java.
037     */
038    public IndirectCostAdjustmentForm() {
039        super();
040    }
041
042    @Override
043    protected String getDefaultDocumentTypeName() {
044        return "OLE_ICA";
045    }
046    
047    /**
048     * @return Returns the Indirect Cost Adjustment Document
049     */
050    public IndirectCostAdjustmentDocument getIndirectCostAdjustmentDocument() {
051        return (IndirectCostAdjustmentDocument) getDocument();
052    }
053
054    /**
055     * @param indirectCostAdjustmentDocument the <code>IndirectCostAdjustmentDocument</code> to set
056     */
057    public void setIndirectCostAdjustmentDocument(IndirectCostAdjustmentDocument indirectCostAdjustmentDocument) {
058        setDocument(indirectCostAdjustmentDocument);
059    }
060
061    /**
062     * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewSourceAccountingLine(org.kuali.module.financial.document.FinancialDocument)
063     */
064    @Override
065    public SourceAccountingLine createNewSourceAccountingLine(AccountingDocument financialDocument) {
066        SourceAccountingLine sourceAccountingLine = super.createNewSourceAccountingLine(financialDocument);
067        String objectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.GRANT_OBJECT_CODE);
068
069        sourceAccountingLine.setFinancialObjectCode(objectCode);
070        return sourceAccountingLine;
071    }
072
073    /**
074     * @see org.kuali.module.financial.web.struts.form.KualiFinancialDocumentFormBase#createNewTargetAccountingLine(org.kuali.module.financial.document.FinancialDocument)
075     */
076    @Override
077    public TargetAccountingLine createNewTargetAccountingLine(AccountingDocument financialDocument) {
078        TargetAccountingLine targetAccountingLine = super.createNewTargetAccountingLine(financialDocument);
079        String objectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.RECEIPT_OBJECT_CODE);
080
081        targetAccountingLine.setFinancialObjectCode(objectCode);
082        return targetAccountingLine;
083    }
084
085    /**
086     * @see org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase#getForcedReadOnlyFields()
087     */
088    @Override
089    public Map getForcedReadOnlyFields() {
090        Map map = super.getForcedReadOnlyFields();
091        map.put(OLEPropertyConstants.FINANCIAL_OBJECT_CODE, Boolean.TRUE);
092        return map;
093    }
094
095}