001 /* 002 * Copyright 2011 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 */ 016 017 package org.kuali.kfs.fp.document; 018 019 import java.util.ArrayList; 020 021 import org.kuali.kfs.fp.businessobject.CapitalAssetInformation; 022 import org.kuali.kfs.fp.document.service.YearEndPendingEntryService; 023 import org.kuali.kfs.sys.KFSConstants; 024 import org.kuali.kfs.sys.businessobject.AccountingLine; 025 import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry; 026 import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail; 027 import org.kuali.kfs.sys.context.SpringContext; 028 import org.kuali.kfs.sys.document.AccountingDocument; 029 import org.kuali.kfs.sys.document.AmountTotaling; 030 import org.kuali.rice.kns.exception.ValidationException; 031 import org.kuali.rice.kns.util.ObjectUtils; 032 033 /** 034 * This is the business object that represents the <code>{@link YearEndDocument}</code> version of 035 * <code>{@link GeneralErrorCorrectionDocument}</code> in Kuali. This is a transactional document that will eventually post 036 * transactions to the G/L. It integrates with workflow and also contains two groupings of accounting lines: from and to. From lines 037 * are the source lines, to lines are the target lines. This document is exactly the same as the non-<code>{@link YearEndDocument}</code> 038 * version except that it has slightly different routing and that it only allows posting to the year end accounting period for a 039 * year. 040 */ 041 public class YearEndGeneralErrorCorrectionDocument extends GeneralErrorCorrectionDocument implements YearEndDocument, AmountTotaling, CapitalAssetEditable { 042 043 /** 044 * Initializes the array lists and some basic info. 045 */ 046 public YearEndGeneralErrorCorrectionDocument() { 047 super(); 048 } 049 050 /** 051 * Set attributes of an explicit pending entry according to rules specific to GeneralErrorCorrectionDocument.<br/> <br/> Uses 052 * <code>{@link YearEndDocumentUtil#customizeExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntry)}</code> 053 * 054 * @param accountingDocument The accounting document containing the general ledger pending entries being customized. 055 * @param accountingLine The accounting line the explicit general ledger pending entry was generated from. 056 * @param explicitEntry The explicit general ledger pending entry to be customized. 057 * 058 * @see org.kuali.kfs.fp.document.validation.impl.GeneralErrorCorrectionDocumentRule#customizeExplicitGeneralLedgerPendingEntry(org.kuali.kfs.sys.document.AccountingDocument, 059 * org.kuali.rice.kns.bo.AccountingLine, org.kuali.module.gl.bo.GeneralLedgerPendingEntry) 060 * @see YearEndDocumentUtil#customizeExplicitGeneralLedgerPendingEntry(TransactionalDocument, AccountingLine, 061 * GeneralLedgerPendingEntry) 062 */ 063 @Override 064 public void customizeExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail postable, GeneralLedgerPendingEntry explicitEntry) { 065 super.customizeExplicitGeneralLedgerPendingEntry(postable, explicitEntry); 066 SpringContext.getBean(YearEndPendingEntryService.class).customizeExplicitGeneralLedgerPendingEntry(this, (AccountingLine)postable, explicitEntry); 067 } 068 069 /** 070 * Overridden to populate object code from last year's offset definition 071 * @see org.kuali.kfs.sys.document.AccountingDocumentBase#customizeOffsetGeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) 072 */ 073 @Override 074 public boolean customizeOffsetGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySourceDetail accountingLine, GeneralLedgerPendingEntry explicitEntry, GeneralLedgerPendingEntry offsetEntry) { 075 boolean success = super.customizeOffsetGeneralLedgerPendingEntry(accountingLine, explicitEntry, offsetEntry); 076 success &= SpringContext.getBean(YearEndPendingEntryService.class).customizeOffsetGeneralLedgerPendingEntry(this, accountingLine, explicitEntry, offsetEntry); 077 return success; 078 } 079 080 @Override 081 public Class<? extends AccountingDocument> getDocumentClassForAccountingLineValueAllowedValidation() { 082 return GeneralErrorCorrectionDocument.class; 083 } 084 }