001/* 002 * Copyright 2009 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 */ 016package org.kuali.ole.gl.batch.service; 017 018import java.util.Iterator; 019import java.util.List; 020import java.util.Map; 021 022import org.kuali.ole.gl.batch.service.impl.exception.FatalErrorException; 023import org.kuali.ole.gl.businessobject.Balance; 024import org.kuali.ole.gl.businessobject.OriginEntryFull; 025import org.kuali.ole.sys.service.ReportWriterService; 026 027public interface OrganizationReversionProcess { 028 /** 029 * Runs the organization reversion process. 030 * @param jobParameters the parameters used in the process 031 * @param organizationReversionCounts a Map of named statistics generated by running the process 032 */ 033 public abstract void organizationReversionProcess(Map jobParameters, Map<String, Integer> organizationReversionCounts); 034 035 /** 036 * This method initializes several properties needed for the process to run correctly 037 */ 038 public abstract void initializeProcess(); 039 040 /** 041 * Given a list of balances, this method generates the origin entries for the organization reversion/carry forward process, and saves those 042 * to an initialized origin entry group 043 * 044 * @param balances an iterator of balances to process; each balance returned by the iterator will be processed by this method 045 */ 046 public abstract void processBalances(Iterator<Balance> balances); 047 048 /** 049 * This method determines which origin entries (reversion, cash reversion, or carry forward) need to be generated for the current unit of work, 050 * and then delegates to the origin entry generation methods to create those entries 051 * 052 * @return a list of OriginEntries which need to be written 053 * @throws FatalErrorException thrown if object codes are missing in any of the generation methods 054 */ 055 public abstract List<OriginEntryFull> generateOutputOriginEntries() throws FatalErrorException; 056 057 /** 058 * This method generates cash reversion origin entries for the current organization reversion, and adds them to the given list 059 * 060 * @param originEntriesToWrite a list of OriginEntryFulls to stick generated origin entries into 061 * @throws FatalErrorException thrown if an origin entry's object code can't be found 062 */ 063 public abstract void generateCashReversions(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 064 065 /** 066 * Generates carry forward origin entries on a category by category basis (if the organization reversion record asks for that), assuming carry 067 * forwards are required for the current unit of work 068 * 069 * @param originEntriesToWrite a list of origin entries to write, which any generated origin entries should be added to 070 * @throws FatalErrorException thrown if an object code cannot be found 071 */ 072 public abstract void generateMany(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 073 074 /** 075 * If carry forwards need to be generated for this unit of work, this method will generate the origin entries to accomplish those object codes. 076 * Note: this will only be called if the organization reversion record tells the process to munge all carry forwards for all categories 077 * together; if the organization reversion record does not call for such a thing, then generateMany will be called 078 * 079 * @param originEntriesToWrite a list of origin entries to write, that any generated origin entries should be added to 080 * @throws FatalErrorException thrown if the current object code can't be found in the database 081 */ 082 public abstract void generateCarryForwards(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 083 084 /** 085 * If reversions are necessary, this will generate the origin entries for those reversions 086 * 087 * @param originEntriesToWrite the list of origin entries to add reversions into 088 * @throws FatalErrorException thrown if object code if the entry can't be found 089 */ 090 public abstract void generateReversions(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 091 092 /** 093 * This method calculates the totals for a given unit of work's reversion 094 * 095 * @throws FatalErrorException 096 */ 097 public abstract void calculateTotals() throws FatalErrorException; 098 099 /** 100 * Writes out the encapsulated origin entry ledger report to the given reportWriterService 101 * @param reportWriterService the report to write the ledger summary report to 102 */ 103 public abstract void writeLedgerSummaryReport(ReportWriterService reportWriterService); 104 105 /** 106 * Sets the holdGeneratedOriginEntries attribute value. 107 * 108 * @param holdGeneratedOriginEntries The holdGeneratedOriginEntries to set. 109 */ 110 public abstract void setHoldGeneratedOriginEntries(boolean holdGeneratedOriginEntries); 111 112 /** 113 * Gets the generatedOriginEntries attribute. 114 * 115 * @return Returns the generatedOriginEntries. 116 */ 117 public abstract List<OriginEntryFull> getGeneratedOriginEntries(); 118 119 /** 120 * Returns the total number of balances for the previous fiscal year 121 * 122 * @return the total number of balances for the previous fiscal year 123 */ 124 public abstract int getBalancesRead(); 125 126 /** 127 * Returns the total number of balances selected for inclusion in this process 128 * 129 * @return the total number of balances selected for inclusion in this process 130 */ 131 public abstract int getBalancesSelected(); 132}