001/*
002 * Copyright 2007 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.Collection;
019
020import org.kuali.ole.gl.batch.CollectorBatch;
021import org.kuali.ole.gl.report.CollectorReportData;
022import org.kuali.ole.gl.service.impl.CollectorScrubberStatus;
023
024/**
025 * An interface declaring the methods needed to scrub Collector data
026 */
027public interface CollectorScrubberService {
028    /**
029     * Runs the scrubber on the origin entries in the batch. Any OEs edits/removals result of the scrub and demerger are removed
030     * from the batch, and the same changes are reflected in the details in the same batch.
031     * 
032     * @param batch the data read in by the Collector
033     * @param collectorReportData statistics generated by the scrub run on the Collector data
034     * @return an object with the collector scrubber status. Note that it contains references to at least 4 origin entry groups, and
035     *         the origin entry group service and origin entry service under which these groups and their entries are stored. The
036     *         groups and their entries are created to facilitate the scrub and reporting processes, and they should not be
037     *         persisted after the collector finishes running. Therefore, an collection of all CollectorScrubberStatus objects
038     *         returned in a single collector execution (i.e. from a nightly job) must be passed into a parameter to the
039     *         {@link #removeTempGroups(Collection)} method.. The service definitions are needed because the collector may choose to
040     *         store temporary origin entries and origin entry groups in another service segregated from the database.
041     */
042    public CollectorScrubberStatus scrub(CollectorBatch batch, CollectorReportData collectorReportData, String collectorFileDirectoryName);
043
044    /**
045     * Removes any temporarily created origin entries and origin entry groups so that they won't be persisted after the transaction
046     * is committed.
047     * 
048     * @param allStatusObjectsFromCollectorExecution a Collection of ScrubberStatus records to help find bad Collector data
049     */
050    public void removeTempGroups(Collection<CollectorScrubberStatus> allStatusObjectsFromCollectorExecution);
051}