001/*
002 * Copyright 2007-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.io.File;
019
020import org.kuali.ole.gl.businessobject.Balance;
021import org.kuali.ole.gl.businessobject.LedgerBalanceHistory;
022import org.kuali.ole.gl.businessobject.OriginEntryInformation;
023
024
025/**
026 * Interface for BalancingService
027 */
028public interface BalancingService {    
029    /**
030     * Handle for batch processes to kick off balancing
031     * @return boolean true when success
032     */
033    public boolean runBalancing();
034    
035    /**
036     * @return input poster file. Returns null if no file found.
037     */
038    public abstract File getPosterInputFile();
039
040    /**
041     * @return output poster error file. Returns null if no file found.
042     */
043    public abstract File getPosterErrorOutputFile();
044
045    /**
046     * @return input reversal file. Returns null if no file found.
047     */
048    public abstract File getReversalInputFile();
049
050    /**
051     * @return output reversal error file. Returns null if no file found.
052     */
053    public abstract File getReversalErrorOutputFile();
054    
055    /**
056     * @return input ICR file. Returns null if no file found.
057     */
058    public abstract File getICRInputFile();
059
060    /**
061     * @return output ICR error file. Returns null if no file found.
062     */
063    public abstract File getICRErrorOutputFile();
064    
065    /**
066     * @return system parameter for NUMBER_OF_PAST_FISCAL_YEARS_TO_CONSIDER
067     */
068    public abstract int getPastFiscalYearsToConsider();
069    
070    /**
071     * @return system parameter for NUMBER_OF_COMPARISON_FAILURES_TO_PRINT_PER_REPORT
072     */
073    public abstract int getComparisonFailuresToPrintPerReport();
074    
075    /**
076     * @param businessObjectName name of the BO for which to return the label
077     * @return functional short labels for tables affected in this process
078     */
079    public abstract String getShortTableLabel(String businessObjectName);
080    
081    /**
082     * Gets an OriginEntryInformation for the parsed line. This needs to be handled separately for GL and Labor because Labor is a special case
083     * of GL (positionNumber + emplid). Could be done with an OriginEntryHistory interface but in the interest of not mucking with
084     * OriginEntries the is done with delegation.
085     * @param inputLine line that was read from getPosterInputFilename
086     * @param lineNumber line number we are currently reading from getPosterInputFilename
087     * @return parsed line into an object as per inputLine parameter
088     */
089    public abstract OriginEntryInformation getOriginEntry(String inputLine, int lineNumber);
090    
091    /**
092     * Update the entry history table
093     * @param mode of post, e.g. MODE_REVERSAL
094     * @param originEntry representing the update details
095     */
096    public abstract void updateEntryHistory(Integer postMode, OriginEntryInformation originEntry);
097    
098    /**
099     * Updates the balance history table
100     * @param originEntry representing the update details
101     */
102    public abstract void updateBalanceHistory(Integer postMode, OriginEntryInformation originEntry);
103    
104    /**
105     * Returns a Balance object for the parameters of the passed in LedgerBalanceHistory. Necessary for generic amount comparision since
106     * it may be either labor or gl.
107     * @param ledgerBalanceHistory to retrieve the Balance object for
108     * @return balance object adhereing to the Balance interface
109     */
110    public abstract Balance getBalance(LedgerBalanceHistory ledgerBalanceHistory);
111    
112    /**
113     * In order to avoid file system scans this class caches poster input and poster error filenames. In rare cases they may want to be reset.
114     */
115    public abstract void clearPosterFileCache();
116    
117    /**
118     * Removes the data from the History tables.
119     */
120    public abstract void clearHistories();
121    
122    /**
123     * Returns filenames used by process. Comma separated
124     */
125    public abstract String getFilenames();
126}