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