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  
27  /**
28   * This is the business object that represents the <code>{@link YearEndDocument}</code> version of
29   * <code>{@link GeneralErrorCorrectionDocument}</code> in Kuali. This is a transactional document that will eventually post
30   * transactions to the G/L. It integrates with workflow and also contains two groupings of accounting lines: from and to. From lines
31   * are the source lines, to lines are the target lines. This document is exactly the same as the non-<code>{@link YearEndDocument}</code>
32   * version except that it has slightly different routing and that it only allows posting to the year end accounting period for a
33   * year.
34   */
35  public class YearEndGeneralErrorCorrectionDocument extends GeneralErrorCorrectionDocument implements YearEndDocument, AmountTotaling, CapitalAssetEditable {
36  
37      /**
38       * Initializes the array lists and some basic info.
39       */
40      public YearEndGeneralErrorCorrectionDocument() {
41          super();
42      }
43      
44      /**
45       * Set attributes of an explicit pending entry according to rules specific to GeneralErrorCorrectionDocument.<br/> <br/> Uses
46       * <code>{@link YearEndDocumentUtil#customizeExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntry)}</code>
47       * 
48       * @param accountingDocument The accounting document containing the general ledger pending entries being customized.
49       * @param accountingLine The accounting line the explicit general ledger pending entry was generated from.
50       * @param explicitEntry The explicit general ledger pending entry to be customized.
51       * 
52       * @see org.kuali.ole.fp.document.validation.impl.GeneralErrorCorrectionDocumentRule#customizeExplicitGeneralLedgerPendingEntry(org.kuali.ole.sys.document.AccountingDocument,
53       *      org.kuali.rice.krad.bo.AccountingLine, org.kuali.module.gl.bo.GeneralLedgerPendingEntry)
54       * @see YearEndDocumentUtil#customizeExplicitGeneralLedgerPendingEntry(TransactionalDocument, AccountingLine,
55       *      GeneralLedgerPendingEntry)
56       */
57      @Override
58      public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry) {
59          super.customizeExplicitGeneralLedgerPendingEntry(postable, explicitEntry);
60          SpringContext.getBean(YearEndPendingEntryService.class).customizeExplicitGeneralLedgerPendingEntry(this, (AccountingLine)postable, explicitEntry);
61      }
62      
63      /**
64       * Overridden to populate object code from last year's offset definition
65       * @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)
66       */
67      @Override
68      public boolean customizeOffsetGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail accountingLine, GeneralLedgerPendingEntry explicitEntry, GeneralLedgerPendingEntry offsetEntry) {
69          boolean success = super.customizeOffsetGeneralLedgerPendingEntry(accountingLine, explicitEntry, offsetEntry);
70          success &= SpringContext.getBean(YearEndPendingEntryService.class).customizeOffsetGeneralLedgerPendingEntry(this, accountingLine, explicitEntry, offsetEntry);
71          return success;
72      }
73  
74      @Override
75      public Class<? extends AccountingDocument> getDocumentClassForAccountingLineValueAllowedValidation() {
76          return GeneralErrorCorrectionDocument.class;
77      }
78  }