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.report.CollectorReportData;
019    import org.kuali.kfs.gl.service.ScrubberService;
020    import org.kuali.kfs.gl.service.impl.ScrubberStatus;
021    import org.kuali.kfs.sys.batch.AbstractWrappedBatchStep;
022    import org.kuali.kfs.sys.batch.service.WrappedBatchExecutorService.CustomBatchExecutor;
023    
024    /**
025     * A step to run the scrubber process.
026     */
027    public class CollectorScrubberStep extends AbstractWrappedBatchStep {
028        public static final String STEP_NAME = "collectorScrubberStep";
029        private ScrubberStatus scrubberStatus;
030        private CollectorBatch batch;
031        private CollectorReportData collectorReportData;
032        private ScrubberService scrubberService;
033    
034        @Override
035        protected CustomBatchExecutor getCustomBatchExecutor() {
036            return new CustomBatchExecutor() {
037                public boolean execute() {
038                    scrubberService.scrubCollectorBatch(scrubberStatus, batch, collectorReportData);
039                    return true;
040                }
041            };
042        }
043        
044        public void setScrubberStatus(ScrubberStatus scrubberStatus) {
045            this.scrubberStatus = scrubberStatus;
046        }
047        public void setBatch(CollectorBatch batch) {
048            this.batch = batch;
049        }
050        public void setCollectorReportData(CollectorReportData collectorReportData) {
051            this.collectorReportData = collectorReportData;
052        }
053        public void setScrubberService(ScrubberService scrubberService) {
054            this.scrubberService = scrubberService;
055        }
056    }