View Javadoc
1   /*
2    * Copyright 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  
17  package org.kuali.ole.fp.businessobject;
18  
19  import static org.kuali.ole.sys.OLEPropertyConstants.ACCOUNT_NUMBER;
20  import static org.kuali.ole.sys.OLEPropertyConstants.AMOUNT;
21  import static org.kuali.ole.sys.OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE;
22  import static org.kuali.ole.sys.OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE;
23  import static org.kuali.ole.sys.OLEPropertyConstants.ORGANIZATION_REFERENCE_ID;
24  import static org.kuali.ole.sys.OLEPropertyConstants.PROJECT_CODE;
25  import static org.kuali.ole.sys.OLEPropertyConstants.SUB_ACCOUNT_NUMBER;
26  
27  import java.util.Map;
28  
29  import org.kuali.ole.fp.document.IndirectCostAdjustmentDocument;
30  import org.kuali.ole.fp.document.validation.impl.IndirectCostAdjustmentDocumentRuleConstants;
31  import org.kuali.ole.sys.businessobject.AccountingLineParserBase;
32  import org.kuali.ole.sys.businessobject.SourceAccountingLine;
33  import org.kuali.ole.sys.businessobject.TargetAccountingLine;
34  import org.kuali.ole.sys.context.SpringContext;
35  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
36  
37  /**
38   * This class represents an <code>IndirectCostAdjustmentDocument</code> accounting line parser.
39   * 
40   * @see org.kuali.ole.fp.document.IndirectCostAdjustmentDocument
41   */
42  public class IndirectCostAdjustmentDocumentAccountingLineParser extends AccountingLineParserBase {
43      protected static final String[] ICA_FORMAT = { CHART_OF_ACCOUNTS_CODE, ACCOUNT_NUMBER, SUB_ACCOUNT_NUMBER, FINANCIAL_SUB_OBJECT_CODE, PROJECT_CODE, ORGANIZATION_REFERENCE_ID, AMOUNT };
44  
45      /**
46       * @see org.kuali.rice.krad.bo.AccountingLineParserBase#getSourceAccountingLineFormat()
47       */
48      @Override
49      public String[] getSourceAccountingLineFormat() {
50          return removeChartFromFormatIfNeeded(ICA_FORMAT);
51      }
52  
53      /**
54       * @see org.kuali.rice.krad.bo.AccountingLineParserBase#getTargetAccountingLineFormat()
55       */
56      @Override
57      public String[] getTargetAccountingLineFormat() {
58          return removeChartFromFormatIfNeeded(ICA_FORMAT);
59      }
60  
61      /**
62       * @see org.kuali.rice.krad.bo.AccountingLineParserBase#performCustomSourceAccountingLinePopulation(java.util.Map,
63       *      org.kuali.rice.krad.bo.SourceAccountingLine, java.lang.String)
64       */
65      @Override
66      protected void performCustomSourceAccountingLinePopulation(Map<String, String> attributeValueMap, SourceAccountingLine sourceAccountingLine, String accountingLineAsString) {
67          super.performCustomSourceAccountingLinePopulation(attributeValueMap, sourceAccountingLine, accountingLineAsString);
68          String financialObjectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.GRANT_OBJECT_CODE);
69          sourceAccountingLine.setFinancialObjectCode(financialObjectCode);
70      }
71  
72      /**
73       * @see org.kuali.rice.krad.bo.AccountingLineParserBase#performCustomTargetAccountingLinePopulation(java.util.Map,
74       *      org.kuali.rice.krad.bo.TargetAccountingLine, java.lang.String)
75       */
76      @Override
77      protected void performCustomTargetAccountingLinePopulation(Map<String, String> attributeValueMap, TargetAccountingLine targetAccountingLine, String accountingLineAsString) {
78          super.performCustomTargetAccountingLinePopulation(attributeValueMap, targetAccountingLine, accountingLineAsString);
79          String financialObjectCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString(IndirectCostAdjustmentDocument.class, IndirectCostAdjustmentDocumentRuleConstants.RECEIPT_OBJECT_CODE);
80          targetAccountingLine.setFinancialObjectCode(financialObjectCode);
81      }
82  
83  }