View Javadoc
1   /*
2    * Copyright 2007 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.batch.service.impl;
17  
18  import java.sql.Date;
19  import java.util.Collection;
20  
21  import org.kuali.ole.gl.batch.CollectorBatch;
22  import org.kuali.ole.gl.batch.CollectorScrubberProcess;
23  import org.kuali.ole.gl.batch.service.CollectorScrubberService;
24  import org.kuali.ole.gl.report.CollectorReportData;
25  import org.kuali.ole.gl.service.ScrubberService;
26  import org.kuali.ole.gl.service.impl.CollectorScrubberStatus;
27  import org.kuali.ole.sys.dataaccess.UniversityDateDao;
28  import org.kuali.rice.core.api.config.property.ConfigurationService;
29  import org.kuali.rice.core.api.datetime.DateTimeService;
30  import org.kuali.rice.krad.service.PersistenceService;
31  import org.springframework.transaction.annotation.Transactional;
32  
33  /**
34   * An implementation of CollectorScrubberService
35   */
36  @Transactional
37  public class CollectorScrubberServiceImpl implements CollectorScrubberService {
38      private DateTimeService dateTimeService;
39      private UniversityDateDao universityDateDao;
40      private ConfigurationService kualiConfigurationService;
41      private PersistenceService persistenceService;
42      private ScrubberService scrubberService;
43      private String batchFileDirectoryName;
44  
45      /**
46       * uns the scrubber on the origin entries in the batch. Any OEs edits/removals result of the scrub and demerger are removed
47       * from the batch, and the same changes are reflected in the details in the same batch.
48       * 
49       * @param batch the data read in by the Collector
50       * @param collectorReportData statistics generated by the scrub run on the Collector data
51       * @return an object with the collector scrubber status.
52       * @see org.kuali.ole.gl.batch.service.CollectorScrubberService#scrub(org.kuali.ole.gl.batch.CollectorBatch,
53       *      org.kuali.ole.gl.report.CollectorReportData)
54       */
55      public CollectorScrubberStatus scrub(CollectorBatch batch, CollectorReportData collectorReportData, String collectorFileDirectoryName) {
56          CollectorScrubberProcess collectorScrubberProcess = new CollectorScrubberProcess(batch, kualiConfigurationService, persistenceService, scrubberService, collectorReportData, dateTimeService, batchFileDirectoryName);
57          return collectorScrubberProcess.scrub();
58          
59      }
60  
61      /**
62       * Removes any temporarily created origin entries and origin entry groups so that they won't be persisted after the transaction
63       * is committed.
64       * 
65       * @param allStatusObjectsFromCollectorExecution a Collection of ScrubberStatus records to help find bad Collector data
66  
67       * @see org.kuali.ole.gl.batch.service.CollectorScrubberService#removeTempGroups(java.util.Collection)
68       */
69      
70      //TODO: need to delete files
71      public void removeTempGroups(Collection<CollectorScrubberStatus> allStatusObjectsFromCollectorExecution) {
72      }
73  
74      /**
75       * Finds the run date of the current Collector scrubber process
76       * @return the date of the process
77       */
78      protected Date calculateRunDate() {
79          return dateTimeService.getCurrentSqlDate();
80      }
81  
82      /**
83       * Gets the dateTimeService attribute.
84       * 
85       * @return Returns the dateTimeService.
86       */
87      public DateTimeService getDateTimeService() {
88          return dateTimeService;
89      }
90  
91      /**
92       * Sets the dateTimeService attribute value.
93       * 
94       * @param dateTimeService The dateTimeService to set.
95       */
96      public void setDateTimeService(DateTimeService dateTimeService) {
97          this.dateTimeService = dateTimeService;
98      }
99  
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 }