View Javadoc

1   /*
2    * Copyright 2008 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.module.purap.businessobject;
17  
18  import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
19  import org.kuali.ole.module.purap.document.RequisitionDocument;
20  import org.kuali.ole.sys.businessobject.AccountingLineParserBase;
21  import org.kuali.ole.sys.document.AccountingDocument;
22  
23  import static org.kuali.ole.sys.OLEPropertyConstants.*;
24  
25  /**
26   * This class is used to parse an PurApItem accounting line.
27   */
28  public class PurApAccountingLineParser extends AccountingLineParserBase {
29      protected static final String[] PURAP_FORMAT = {CHART_OF_ACCOUNTS_CODE, ACCOUNT_NUMBER, SUB_ACCOUNT_NUMBER, FINANCIAL_OBJECT_CODE, FINANCIAL_SUB_OBJECT_CODE, PROJECT_CODE, ORGANIZATION_REFERENCE_ID, PERCENT};
30  
31      /**
32       * Constructs a AuxiliaryVoucherAccountingLineParser.java.
33       */
34      public PurApAccountingLineParser() {
35          super();
36      }
37  
38      /**
39       * @see org.kuali.rice.krad.bo.AccountingLineParserBase#getSourceAccountingLineFormat()
40       */
41      @Override
42      public String[] getSourceAccountingLineFormat() {
43          return removeChartFromFormatIfNeeded(PURAP_FORMAT);
44      }
45  
46      /**
47       * @see org.kuali.rice.krad.bo.AccountingLineParser#getSourceAccountingLineClass(org.kuali.rice.krad.document.AccountingDocument)
48       */
49      @Override
50      protected Class getSourceAccountingLineClass(final AccountingDocument accountingDocument) {
51          if (accountingDocument instanceof RequisitionDocument)
52              return RequisitionAccount.class;
53          else if (accountingDocument instanceof PurchaseOrderDocument)
54              return PurchaseOrderAccount.class;
55          else return super.getSourceAccountingLineClass(accountingDocument);
56      }
57  
58  }