1 /* 2 * Copyright 2009 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.gl.batch.service; 17 18 import java.util.Iterator; 19 import java.util.List; 20 import java.util.Map; 21 22 import org.kuali.ole.gl.batch.service.impl.exception.FatalErrorException; 23 import org.kuali.ole.gl.businessobject.Balance; 24 import org.kuali.ole.gl.businessobject.OriginEntryFull; 25 import org.kuali.ole.sys.service.ReportWriterService; 26 27 public interface OrganizationReversionProcess { 28 /** 29 * Runs the organization reversion process. 30 * @param jobParameters the parameters used in the process 31 * @param organizationReversionCounts a Map of named statistics generated by running the process 32 */ 33 public abstract void organizationReversionProcess(Map jobParameters, Map<String, Integer> organizationReversionCounts); 34 35 /** 36 * This method initializes several properties needed for the process to run correctly 37 */ 38 public abstract void initializeProcess(); 39 40 /** 41 * Given a list of balances, this method generates the origin entries for the organization reversion/carry forward process, and saves those 42 * to an initialized origin entry group 43 * 44 * @param balances an iterator of balances to process; each balance returned by the iterator will be processed by this method 45 */ 46 public abstract void processBalances(Iterator<Balance> balances); 47 48 /** 49 * This method determines which origin entries (reversion, cash reversion, or carry forward) need to be generated for the current unit of work, 50 * and then delegates to the origin entry generation methods to create those entries 51 * 52 * @return a list of OriginEntries which need to be written 53 * @throws FatalErrorException thrown if object codes are missing in any of the generation methods 54 */ 55 public abstract List<OriginEntryFull> generateOutputOriginEntries() throws FatalErrorException; 56 57 /** 58 * This method generates cash reversion origin entries for the current organization reversion, and adds them to the given list 59 * 60 * @param originEntriesToWrite a list of OriginEntryFulls to stick generated origin entries into 61 * @throws FatalErrorException thrown if an origin entry's object code can't be found 62 */ 63 public abstract void generateCashReversions(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 64 65 /** 66 * Generates carry forward origin entries on a category by category basis (if the organization reversion record asks for that), assuming carry 67 * forwards are required for the current unit of work 68 * 69 * @param originEntriesToWrite a list of origin entries to write, which any generated origin entries should be added to 70 * @throws FatalErrorException thrown if an object code cannot be found 71 */ 72 public abstract void generateMany(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 73 74 /** 75 * If carry forwards need to be generated for this unit of work, this method will generate the origin entries to accomplish those object codes. 76 * Note: this will only be called if the organization reversion record tells the process to munge all carry forwards for all categories 77 * together; if the organization reversion record does not call for such a thing, then generateMany will be called 78 * 79 * @param originEntriesToWrite a list of origin entries to write, that any generated origin entries should be added to 80 * @throws FatalErrorException thrown if the current object code can't be found in the database 81 */ 82 public abstract void generateCarryForwards(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 83 84 /** 85 * If reversions are necessary, this will generate the origin entries for those reversions 86 * 87 * @param originEntriesToWrite the list of origin entries to add reversions into 88 * @throws FatalErrorException thrown if object code if the entry can't be found 89 */ 90 public abstract void generateReversions(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException; 91 92 /** 93 * This method calculates the totals for a given unit of work's reversion 94 * 95 * @throws FatalErrorException 96 */ 97 public abstract void calculateTotals() throws FatalErrorException; 98 99 /** 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 }