1 /*
2 * Copyright 2005-2006 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.ole.gl.service.impl;
17
18 import org.kuali.ole.gl.batch.CollectorBatch;
19 import org.kuali.ole.gl.batch.service.ScrubberProcess;
20 import org.kuali.ole.gl.report.CollectorReportData;
21 import org.kuali.ole.gl.service.ScrubberService;
22 import org.kuali.ole.sys.context.SpringContext;
23 import org.springframework.transaction.annotation.Transactional;
24
25 /**
26 * The default implementation of ScrubberService
27 */
28 @Transactional
29 public class ScrubberServiceImpl implements ScrubberService {
30 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ScrubberServiceImpl.class);
31
32 private ScrubberProcess reportOnlyScrubberProcess;
33 private ScrubberProcess scrubberProcess;
34 private ScrubberProcess demergerScrubberProcess;
35
36 protected static final String COLLECTOR_SCRUBBER_PROCESS_BEAN_NAME = "batchScrubberProcess";
37 /**
38 * This process will call the scrubber in a read only mode. It will scrub a single group, won't create any output in origin
39 * entry. It will create a the scrubber report
40 * @param group the origin entry group to scrub for report
41 * @param documentNumber the id of documents which generated origin entries that should be scrubbed
42 * @see org.kuali.ole.gl.service.ScrubberService#scrubGroupReportOnly(org.kuali.ole.gl.businessobject.OriginEntryGroup)
43 */
44 synchronized public void scrubGroupReportOnly(String fileName, String documentNumber) {
45 LOG.debug("scrubGroupReportOnly() started");
46
47 reportOnlyScrubberProcess.scrubGroupReportOnly(fileName, documentNumber);
48 }
49
50 /**
51 * Scrubs all of the entries in all origin entry groups that are up for scrubbing
52 * @see org.kuali.ole.gl.service.ScrubberService#scrubEntries()
53 */
54 public void scrubEntries() {
55 LOG.debug("scrubEntries() started");
56
57 scrubberProcess.scrubEntries();
58 }
59
60 /**
61 * Scrubs data read in by the Collector
62 *
63 * @param batch the data read by the Collector
64 * @param collectorReportData statistics about
65 * @param overrideOriginEntryService the implementation of origin entry service to use for this specific Collector scrub
66 * @param overrideOriginEntryGroupService the implementation of origin entry group service to use for this specific Collector scrub
67 * @return the status returned by the Scrubber
68 * @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)
69 */
70 public void scrubCollectorBatch(ScrubberStatus scrubberStatus, CollectorBatch batch, CollectorReportData collectorReportData) {
71 ScrubberProcess batchScrubberProcess = (ScrubberProcess) SpringContext.getService(COLLECTOR_SCRUBBER_PROCESS_BEAN_NAME);
72 batchScrubberProcess.scrubCollectorBatch(scrubberStatus, batch, collectorReportData);
73 }
74
75 public void performDemerger() {
76 LOG.debug("performDemerger() started");
77 //new ScrubberProcessImpl(flexibleOffsetAccountService, accountingCycleCachingService, dateTimeService, offsetDefinitionService, objectCodeService, kualiConfigurationService, universityDateDao, persistenceService, scrubberValidator, generatedCostShareOriginEntryObjectCodeOverride, runDateService, batchFileDirectoryName, null, null, null, null, demergerReportWriterService, demergerRemovedTransactionsListingReportWriterService, null);
78 demergerScrubberProcess.performDemerger();
79 }
80
81
82 /**
83 * Sets the reportOnlyScrubberProcess attribute value.
84 * @param reportOnlyScrubberProcess The reportOnlyScrubberProcess to set.
85 */
86 public void setReportOnlyScrubberProcess(ScrubberProcess reportOnlyScrubberProcess) {
87 this.reportOnlyScrubberProcess = reportOnlyScrubberProcess;
88 }
89
90 /**
91 * Sets the scrubberProcess attribute value.
92 * @param scrubberProcess The scrubberProcess to set.
93 */
94 public void setScrubberProcess(ScrubberProcess scrubberProcess) {
95 this.scrubberProcess = scrubberProcess;
96 }
97
98 /**
99 * 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 }