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.sys.document;
17  
18  import java.util.List;
19  
20  import org.kuali.ole.sys.businessobject.FinancialSystemDocumentHeader;
21  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
22  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper;
23  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntrySourceDetail;
24  import org.kuali.rice.core.api.util.type.KualiDecimal;
25  import org.kuali.rice.krad.bo.DocumentHeader;
26  
27  /**
28   * A collection of methods needed by anything - document or otherwise - that plans to generate
29   * General Ledger pending entries.
30   */
31  public interface GeneralLedgerPendingEntrySource {
32      
33      /**
34       * Creates any GeneralLedgerPostingEntry's that are based on a document, not those based on GeneralLedgerPendingEntrySourceDetail entries 
35       * @param sequenceHelper a sequence helper for the method to create more general ledger pending entries
36       * @return true if the pending entries were able to be successfully created and added to this GeneralLedgerPendingEntrySource; false if an error condition occurred with mean that GLPEs were not correctly generated
37       */
38      public boolean generateDocumentGeneralLedgerPendingEntries(GeneralLedgerPendingEntrySequenceHelper sequenceHelper);
39  
40      /**
41       * @return the fiscal year when this "helper" was posted
42       */
43      public Integer getPostingYear();
44      
45      /**
46       * This method determines if the passed in GeneralLedgerPendingEntrySourceDetail is a debit or not.
47       * @param postable
48       * @return true if the given GeneralLedgerPendingEntrySourceDetail is a debit, false if it is a credit
49       */
50      public boolean isDebit(GeneralLedgerPendingEntrySourceDetail postable);
51      
52      /**
53       * Returns a document header associated with this general ledger posting helper
54       * @return a document header, having information which should be put into the generated GeneralLedgerPendingEntry records
55       */
56      public FinancialSystemDocumentHeader getFinancialSystemDocumentHeader();
57  
58      /**
59       * Returns a document header associated with this general ledger posting helper
60       * @return a document header, having information which should be put into the generated GeneralLedgerPendingEntry records
61       */
62      public DocumentHeader getDocumentHeader();
63      
64      /**
65       * Requests that the posting helper removes any general ledger pending entries it might be holding, so that new ones can be generated
66       */
67      public void clearAnyGeneralLedgerPendingEntries();
68      
69      /**
70       * Returns a list of any GeneralLedgerPostables this helper has, to create GeneralLedgerPendingEntries
71       * @return a list of GeneralLedgerPostables
72       */
73      public List<GeneralLedgerPendingEntrySourceDetail> getGeneralLedgerPendingEntrySourceDetails();
74          
75      /**
76       * Adds an UNSAVED general ledger pending entry to the GeneralLedgerPendingEntrySource, which the GLPESource can do with as it pleases
77       * @param entry the completed entry to give back to the helper to handle
78       */
79      public void addPendingEntry(GeneralLedgerPendingEntry entry);
80      
81      /**
82       * A method to determine what the actual amount, based off of a GeneralLedgerPendingEntrySourceDetail, should be for the resultant GeneralLedgerPendingEntry
83       * @param glpeSourceDetail the detail line from the general ledger pending entry source to find an amount for
84       * @return The amount that will be used to populate the amount on the generated general ledger pending entry for the given source detail
85       */
86      public KualiDecimal getGeneralLedgerPendingEntryAmountForDetail(GeneralLedgerPendingEntrySourceDetail glpeSourceDetail);
87      
88      /**
89       * This method returns the financial document type code. It's required to return the appropriate financial document type code only if poster class is not assignable from  org.kuali.rice.krad.document.
90       * @return the document type code
91       */
92      public String getFinancialDocumentTypeCode();
93      
94      /**
95       * Generates any number of general ledger pending entries from a given general ledger pending entry source detail and adds them to this general ledger pending entry source
96       * @param glpeSourceDetail the source detail line to generate general ledger pending entries for 
97       * @param sequenceHelper the sequence helper which will assign sequence number to generated general ledger pending entries
98       * @return true if general ledger pending entry generation was successful; false if an error condition prevented the successful generation of the pending entries
99       */
100     public boolean generateGeneralLedgerPendingEntries(GeneralLedgerPendingEntrySourceDetail glpeSourceDetail, GeneralLedgerPendingEntrySequenceHelper sequenceHelper);
101 
102 }