01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.gl.batch;
17:
18: import org.kuali.kfs.batch.AbstractStep;
19: import org.kuali.module.gl.GLConstants;
20: import org.kuali.module.gl.service.OriginEntryGroupService;
21:
22: /**
23: * A step which runs the process to remove old origin entry groups and associated origin entries
24: */
25: public class ClearOldOriginEntryStep extends AbstractStep {
26: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
27: .getLogger(ClearOldOriginEntryStep.class);
28: private OriginEntryGroupService originEntryGroupService;
29:
30: /**
31: * Peforms the process of clearing old origin entry groups and entries
32: *
33: * @param the name of the job that this step is a part of
34: * @return that the job completed successfully
35: * @see org.kuali.kfs.batch.Step#execute(java.lang.String)
36: */
37: public boolean execute(String jobName) {
38: LOG.debug("performStep() started");
39: String daysStr = getParameterService().getParameterValue(
40: getClass(), GLConstants.RETAIN_DAYS);
41: int days = Integer.parseInt(daysStr);
42: originEntryGroupService.deleteOlderGroups(days);
43: return true;
44: }
45:
46: /**
47: * Sets the originEntryService attribute, allowing injection of an implementation of the service
48: *
49: * @param oes
50: * @see org.kuali.module.gl.service.OriginEntryGroupService
51: */
52: public void setOriginEntryGroupService(OriginEntryGroupService oes) {
53: originEntryGroupService = oes;
54: }
55: }
|