001/*
002 * Copyright 2005-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;
017
018import java.util.List;
019
020import org.kuali.ole.gl.document.service.CorrectionDocumentService;
021import org.kuali.ole.gl.service.ScrubberService;
022import org.kuali.ole.sys.batch.AbstractWrappedBatchStep;
023import org.kuali.ole.sys.batch.service.WrappedBatchExecutorService.CustomBatchExecutor;
024
025/**
026 * A step to run the scrubber process.
027 */
028public class CorrectionProcessScrubberStep extends AbstractWrappedBatchStep {
029    public static final String STEP_NAME = "correctionProcessScrubberStep";
030    private String documentId;
031    private CorrectionDocumentService correctionDocumentService;
032    private ScrubberService scrubberService;
033
034    /**
035     * @see org.kuali.ole.sys.batch.AbstractStep#getRequiredDirectoryNames()
036     */
037    @Override
038    public List<String> getRequiredDirectoryNames() {
039        return correctionDocumentService.getRequiredDirectoryNames();
040    }
041
042    @Override
043    protected CustomBatchExecutor getCustomBatchExecutor() {
044        return new CustomBatchExecutor() {
045            public boolean execute() {
046                scrubberService.scrubGroupReportOnly(correctionDocumentService.generateOutputOriginEntryFileName(documentId), documentId);
047                return true;
048            }
049        };
050    }
051    
052    public void setDocumentId(String documentId) {
053        this.documentId = documentId;
054    }
055
056    public void setCorrectionDocumentService(CorrectionDocumentService correctionDocumentService) {
057        this.correctionDocumentService = correctionDocumentService;
058    }
059
060    public void setScrubberService(ScrubberService scrubberService) {
061        this.scrubberService = scrubberService;
062    }
063}