View Javadoc
1   /*
2    * Copyright 2005 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.document;
18  
19  import org.kuali.ole.fp.document.service.YearEndPendingEntryService;
20  import org.kuali.ole.sys.businessobject.AccountingLine;
21  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
22  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntrySourceDetail;
23  import org.kuali.ole.sys.context.SpringContext;
24  import org.kuali.ole.sys.document.AccountingDocument;
25  import org.kuali.ole.sys.document.AmountTotaling;
26  import org.kuali.ole.sys.document.ElectronicPaymentClaiming;
27  
28  
29  /**
30   * Year End version of the <code>DistributionOfIncomeAndExpenseDocument</code> the only functional difference between the YearEnd
31   * version and the non-yearEnd version of a document is the glpe's generation.
32   */
33  public class YearEndDistributionOfIncomeAndExpenseDocument extends DistributionOfIncomeAndExpenseDocument implements YearEndDocument, AmountTotaling, ElectronicPaymentClaiming, CapitalAssetEditable {
34      /**
35       * Constructs a YearEndDistributionOfIncomeAndExpenseDocument.java.
36       */
37      public YearEndDistributionOfIncomeAndExpenseDocument() {
38          super();
39      }
40  
41      /**
42       * This method calls the super class's overridden method to perform the general customization actions, then calls the 
43       * YearEndDocumentUtil matching method to perform year end specific customization activities.
44       * 
45       * @param accountingDocument The accounting document containing the general ledger pending entries being customized.
46       * @param accountingLine The accounting line the explicit general ledger pending entry was generated from.
47       * @param explicitEntry The explicit general ledger pending entry to be customized.
48       * 
49       * @see org.kuali.module.financial.rules.DistributeOfIncomeAndExpenseDocumentRule#customizeExplicitGeneralLedgerPendingEntry(org.kuali.ole.sys.document.AccountingDocument,
50       *      org.kuali.ole.sys.businessobject.AccountingLine, org.kuali.module.gl.bo.GeneralLedgerPendingEntry)
51       * @see YearEndDocumentUtil#customizeExplicitGeneralLedgerPendingEntry(TransactionalDocument, AccountingLine,
52       *      GeneralLedgerPendingEntry)
53       */
54      @Override
55      public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry) {
56          super.customizeExplicitGeneralLedgerPendingEntry(postable, explicitEntry);
57          AccountingLine accountingLine = (AccountingLine)postable;
58          SpringContext.getBean(YearEndPendingEntryService.class).customizeExplicitGeneralLedgerPendingEntry(this, accountingLine, explicitEntry);
59      }
60      
61      /**
62       * Overridden to populate object code from last year's offset definition
63       * @see org.kuali.ole.sys.document.AccountingDocumentBase#customizeOffsetGeneralLedgerPendingEntry(org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntrySourceDetail, org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry, org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry)
64       */
65      @Override
66      public boolean customizeOffsetGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail accountingLine, GeneralLedgerPendingEntry explicitEntry, GeneralLedgerPendingEntry offsetEntry) {
67          boolean success = super.customizeOffsetGeneralLedgerPendingEntry(accountingLine, explicitEntry, offsetEntry);
68          success &= SpringContext.getBean(YearEndPendingEntryService.class).customizeOffsetGeneralLedgerPendingEntry(this, accountingLine, explicitEntry, offsetEntry);
69          return success;
70      }
71  
72      @Override
73      public Class<? extends AccountingDocument> getDocumentClassForAccountingLineValueAllowedValidation() {
74          return DistributionOfIncomeAndExpenseDocument.class;
75      }
76  }