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    package org.kuali.kfs.gl.dataaccess;
017    
018    import java.util.Date;
019    import java.util.Iterator;
020    
021    import org.kuali.kfs.gl.businessobject.Reversal;
022    import org.kuali.kfs.gl.businessobject.Transaction;
023    
024    /**
025     * An interface that declares the methods needed for reversal services to interact with the database
026     */
027    public interface ReversalDao {
028        /**
029         * Saves a reversal record
030         * 
031         * @param re a reversal to save
032         */
033        public void save(Reversal re);
034    
035        /**
036         * Find the maximum transactionLedgerEntrySequenceNumber in the entry table for a specific transaction. This is used to make
037         * sure that rows added have a unique primary key.
038         * 
039         * @param t a transaction to find the maximum sequence number for
040         * @return the max sequence number for the given transaction
041         */
042        public int getMaxSequenceNumber(Transaction t);
043    
044        /**
045         * Looks up the reversal that matches the keys from the given transaction
046         * 
047         * @param t the given transaction
048         * @return the reversal that matches the keys of that transaction
049         */
050        public Reversal getByTransaction(Transaction t);
051    
052        /**
053         * Returns all reversals that should have reversed on or before the given date
054         * 
055         * @param before the date that reversals retrieved should reverse on or before
056         * @return an iterator of reversal records
057         */
058        public Iterator getByDate(Date before);
059    
060        /**
061         * Deletes a reversal record
062         * 
063         * @param re a reversal to delete
064         */
065        public void delete(Reversal re);
066    }