001/* 002 * Copyright 2007 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.service.impl; 017 018import java.sql.Date; 019import java.util.Collection; 020 021import org.kuali.ole.gl.batch.CollectorBatch; 022import org.kuali.ole.gl.batch.CollectorScrubberProcess; 023import org.kuali.ole.gl.batch.service.CollectorScrubberService; 024import org.kuali.ole.gl.report.CollectorReportData; 025import org.kuali.ole.gl.service.ScrubberService; 026import org.kuali.ole.gl.service.impl.CollectorScrubberStatus; 027import org.kuali.ole.sys.dataaccess.UniversityDateDao; 028import org.kuali.rice.core.api.config.property.ConfigurationService; 029import org.kuali.rice.core.api.datetime.DateTimeService; 030import org.kuali.rice.krad.service.PersistenceService; 031import org.springframework.transaction.annotation.Transactional; 032 033/** 034 * An implementation of CollectorScrubberService 035 */ 036@Transactional 037public class CollectorScrubberServiceImpl implements CollectorScrubberService { 038 private DateTimeService dateTimeService; 039 private UniversityDateDao universityDateDao; 040 private ConfigurationService kualiConfigurationService; 041 private PersistenceService persistenceService; 042 private ScrubberService scrubberService; 043 private String batchFileDirectoryName; 044 045 /** 046 * uns the scrubber on the origin entries in the batch. Any OEs edits/removals result of the scrub and demerger are removed 047 * from the batch, and the same changes are reflected in the details in the same batch. 048 * 049 * @param batch the data read in by the Collector 050 * @param collectorReportData statistics generated by the scrub run on the Collector data 051 * @return an object with the collector scrubber status. 052 * @see org.kuali.ole.gl.batch.service.CollectorScrubberService#scrub(org.kuali.ole.gl.batch.CollectorBatch, 053 * org.kuali.ole.gl.report.CollectorReportData) 054 */ 055 public CollectorScrubberStatus scrub(CollectorBatch batch, CollectorReportData collectorReportData, String collectorFileDirectoryName) { 056 CollectorScrubberProcess collectorScrubberProcess = new CollectorScrubberProcess(batch, kualiConfigurationService, persistenceService, scrubberService, collectorReportData, dateTimeService, batchFileDirectoryName); 057 return collectorScrubberProcess.scrub(); 058 059 } 060 061 /** 062 * Removes any temporarily created origin entries and origin entry groups so that they won't be persisted after the transaction 063 * is committed. 064 * 065 * @param allStatusObjectsFromCollectorExecution a Collection of ScrubberStatus records to help find bad Collector data 066 067 * @see org.kuali.ole.gl.batch.service.CollectorScrubberService#removeTempGroups(java.util.Collection) 068 */ 069 070 //TODO: need to delete files 071 public void removeTempGroups(Collection<CollectorScrubberStatus> allStatusObjectsFromCollectorExecution) { 072 } 073 074 /** 075 * Finds the run date of the current Collector scrubber process 076 * @return the date of the process 077 */ 078 protected Date calculateRunDate() { 079 return dateTimeService.getCurrentSqlDate(); 080 } 081 082 /** 083 * Gets the dateTimeService attribute. 084 * 085 * @return Returns the dateTimeService. 086 */ 087 public DateTimeService getDateTimeService() { 088 return dateTimeService; 089 } 090 091 /** 092 * Sets the dateTimeService attribute value. 093 * 094 * @param dateTimeService The dateTimeService to set. 095 */ 096 public void setDateTimeService(DateTimeService dateTimeService) { 097 this.dateTimeService = dateTimeService; 098 } 099 100 /** 101 * Gets the kualiConfigurationService attribute. 102 * 103 * @return Returns the kualiConfigurationService. 104 */ 105 public ConfigurationService getConfigurationService() { 106 return kualiConfigurationService; 107 } 108 109 /** 110 * Sets the kualiConfigurationService attribute value. 111 * 112 * @param kualiConfigurationService The kualiConfigurationService to set. 113 */ 114 public void setConfigurationService(ConfigurationService kualiConfigurationService) { 115 this.kualiConfigurationService = kualiConfigurationService; 116 } 117 118 /** 119 * Sets the universityDateDao attribute value. 120 * 121 * @param universityDateDao The universityDateDao to set. 122 */ 123 public void setUniversityDateDao(UniversityDateDao universityDateDao) { 124 this.universityDateDao = universityDateDao; 125 } 126 127 /** 128 * Gets the persistenceService attribute. 129 * 130 * @return Returns the persistenceService. 131 */ 132 public PersistenceService getPersistenceService() { 133 return persistenceService; 134 } 135 136 /** 137 * Sets the persistenceService attribute value. 138 * 139 * @param persistenceService The persistenceService to set. 140 */ 141 public void setPersistenceService(PersistenceService persistenceService) { 142 this.persistenceService = persistenceService; 143 } 144 145 /** 146 * Gets the universityDateDao attribute. 147 * 148 * @return Returns the universityDateDao. 149 */ 150 public UniversityDateDao getUniversityDateDao() { 151 return universityDateDao; 152 } 153 154 /** 155 * Sets the scrubberService attribute value. 156 * 157 * @param scrubberService The scrubberService to set. 158 */ 159 public void setScrubberService(ScrubberService scrubberService) { 160 this.scrubberService = scrubberService; 161 } 162 163 /** 164 * Sets the batchFileDirectoryName attribute value. 165 * @param batchFileDirectoryName The batchFileDirectoryName to set. 166 */ 167 public void setBatchFileDirectoryName(String batchFileDirectoryName) { 168 this.batchFileDirectoryName = batchFileDirectoryName; 169 } 170 171 172}