001/*
002 * Copyright 2006 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.service;
017
018import java.util.Date;
019import java.util.Iterator;
020
021import org.kuali.ole.gl.businessobject.LedgerEntryHolder;
022import org.kuali.ole.gl.businessobject.Reversal;
023import org.kuali.ole.gl.businessobject.Transaction;
024
025/**
026 * An interface with methods to interact with reversals
027 */
028public interface ReversalService {
029    /**
030     * Saves a reversal to the database
031     * 
032     * @param re the reversal to save
033     */
034    public void save(Reversal re);
035
036    /**
037     * Fetches or generates a reversal record, based on the given transaction
038     * 
039     * @param t a transaction to find a reversal record for
040     * @return a reversal record for the transaction
041     */
042    public Reversal getByTransaction(Transaction t);
043
044    /**
045     * Fetches all of the reversals that are set to reverse before or on the given date
046     * 
047     * @param before the date returned reversals should reverse on or before
048     * @return an Iterator of reversals
049     */
050    public Iterator getByDate(Date before);
051
052    /**
053     * Summarizes all of the reversal records set to reverse before or on the given date
054     * 
055     * @param before the date summarized reversals should reverse on or before
056     * @return a LedgerEntryHolder with the summary date
057     */
058    public LedgerEntryHolder getSummaryByDate(Date before);
059
060    /**
061     * Removes a reversal record from the persistence store
062     * 
063     * @param re the reversal to send to the happy reversal farm in the sky
064     */
065    public void delete(Reversal re);
066}