001/* 002 * Copyright 2005-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.impl; 017 018import org.kuali.ole.gl.batch.CollectorBatch; 019import org.kuali.ole.gl.batch.service.ScrubberProcess; 020import org.kuali.ole.gl.report.CollectorReportData; 021import org.kuali.ole.gl.service.ScrubberService; 022import org.kuali.ole.sys.context.SpringContext; 023import org.springframework.transaction.annotation.Transactional; 024 025/** 026 * The default implementation of ScrubberService 027 */ 028@Transactional 029public class ScrubberServiceImpl implements ScrubberService { 030 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ScrubberServiceImpl.class); 031 032 private ScrubberProcess reportOnlyScrubberProcess; 033 private ScrubberProcess scrubberProcess; 034 private ScrubberProcess demergerScrubberProcess; 035 036 protected static final String COLLECTOR_SCRUBBER_PROCESS_BEAN_NAME = "batchScrubberProcess"; 037 /** 038 * This process will call the scrubber in a read only mode. It will scrub a single group, won't create any output in origin 039 * entry. It will create a the scrubber report 040 * @param group the origin entry group to scrub for report 041 * @param documentNumber the id of documents which generated origin entries that should be scrubbed 042 * @see org.kuali.ole.gl.service.ScrubberService#scrubGroupReportOnly(org.kuali.ole.gl.businessobject.OriginEntryGroup) 043 */ 044 synchronized public void scrubGroupReportOnly(String fileName, String documentNumber) { 045 LOG.debug("scrubGroupReportOnly() started"); 046 047 reportOnlyScrubberProcess.scrubGroupReportOnly(fileName, documentNumber); 048 } 049 050 /** 051 * Scrubs all of the entries in all origin entry groups that are up for scrubbing 052 * @see org.kuali.ole.gl.service.ScrubberService#scrubEntries() 053 */ 054 public void scrubEntries() { 055 LOG.debug("scrubEntries() started"); 056 057 scrubberProcess.scrubEntries(); 058 } 059 060 /** 061 * Scrubs data read in by the Collector 062 * 063 * @param batch the data read by the Collector 064 * @param collectorReportData statistics about 065 * @param overrideOriginEntryService the implementation of origin entry service to use for this specific Collector scrub 066 * @param overrideOriginEntryGroupService the implementation of origin entry group service to use for this specific Collector scrub 067 * @return the status returned by the Scrubber 068 * @see org.kuali.ole.gl.service.ScrubberService#scrubCollectorBatch(org.kuali.ole.gl.batch.CollectorBatch, org.kuali.ole.gl.report.CollectorReportData, org.kuali.ole.gl.service.OriginEntryService, org.kuali.ole.gl.service.OriginEntryGroupService) 069 */ 070 public void scrubCollectorBatch(ScrubberStatus scrubberStatus, CollectorBatch batch, CollectorReportData collectorReportData) { 071 ScrubberProcess batchScrubberProcess = (ScrubberProcess) SpringContext.getService(COLLECTOR_SCRUBBER_PROCESS_BEAN_NAME); 072 batchScrubberProcess.scrubCollectorBatch(scrubberStatus, batch, collectorReportData); 073 } 074 075 public void performDemerger() { 076 LOG.debug("performDemerger() started"); 077 //new ScrubberProcessImpl(flexibleOffsetAccountService, accountingCycleCachingService, dateTimeService, offsetDefinitionService, objectCodeService, kualiConfigurationService, universityDateDao, persistenceService, scrubberValidator, generatedCostShareOriginEntryObjectCodeOverride, runDateService, batchFileDirectoryName, null, null, null, null, demergerReportWriterService, demergerRemovedTransactionsListingReportWriterService, null); 078 demergerScrubberProcess.performDemerger(); 079 } 080 081 082 /** 083 * Sets the reportOnlyScrubberProcess attribute value. 084 * @param reportOnlyScrubberProcess The reportOnlyScrubberProcess to set. 085 */ 086 public void setReportOnlyScrubberProcess(ScrubberProcess reportOnlyScrubberProcess) { 087 this.reportOnlyScrubberProcess = reportOnlyScrubberProcess; 088 } 089 090 /** 091 * Sets the scrubberProcess attribute value. 092 * @param scrubberProcess The scrubberProcess to set. 093 */ 094 public void setScrubberProcess(ScrubberProcess scrubberProcess) { 095 this.scrubberProcess = scrubberProcess; 096 } 097 098 /** 099 * Sets the demergerScrubberProcess attribute value. 100 * @param demergerScrubberProcess The demergerScrubberProcess to set. 101 */ 102 public void setDemergerScrubberProcess(ScrubberProcess demergerScrubberProcess) { 103 this.demergerScrubberProcess = demergerScrubberProcess; 104 } 105}