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 java.util.HashMap;
19: import java.util.Map;
20:
21: import org.kuali.kfs.batch.AbstractStep;
22: import org.kuali.module.gl.bo.OriginEntryGroup;
23: import org.kuali.module.gl.service.OrganizationReversionProcessService;
24: import org.springframework.util.StopWatch;
25:
26: /**
27: * A step that runs the reversion and carry forward process. The end of year version of the process is supposed to be run before the
28: * end of a fiscal year for reporting purposes; therefore, it uses current year accounts instead of prior year accounts.
29: */
30: public class OrganizationReversionEndOfYearStep extends AbstractStep {
31: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
32: .getLogger(OrganizationReversionEndOfYearStep.class);
33: private OrganizationReversionProcessService organizationReversionProcessService;
34:
35: /**
36: * Runs the organization reversion process, retrieving parameter, creating the origin entry group for output entries, and
37: * generating the reports on the process.
38: *
39: * @param jobName the name of the job this step is being run as part of
40: * @return true if the job completed successfully, false if otherwise
41: * @see org.kuali.kfs.batch.Step#execute(java.lang.String)
42: */
43: public boolean execute(String jobName) {
44: StopWatch stopWatch = new StopWatch();
45: stopWatch.start(jobName);
46:
47: OriginEntryGroup outputGroup = organizationReversionProcessService
48: .createOrganizationReversionProcessOriginEntryGroup();
49: Map jobParameters = organizationReversionProcessService
50: .getJobParameters();
51: Map<String, Integer> organizationReversionCounts = new HashMap<String, Integer>();
52:
53: organizationReversionProcessService
54: .organizationReversionProcessEndOfYear(outputGroup,
55: jobParameters, organizationReversionCounts);
56:
57: organizationReversionProcessService
58: .generateOrganizationReversionProcessReports(
59: outputGroup, jobParameters,
60: organizationReversionCounts);
61:
62: stopWatch.stop();
63: LOG.info(jobName + " took "
64: + (stopWatch.getTotalTimeSeconds() / 60.0)
65: + " minutes to complete");
66: return true;
67: }
68:
69: /**
70: * Sets the organizationREversionProcessService (not to be confused with the OrganizationReversionService, which doesn't do a
71: * process, but which does all the database stuff associated with OrganizationReversion records; it's off in Chart), which
72: * allows the injection of an implementation of the service.
73: *
74: * @param organizationReversionProcessService the implementation of the organizationReversionProcessService to set
75: * @see org.kuali.module.gl.service.OrganizationReversionProcessService
76: */
77: public void setOrganizationReversionProcessService(
78: OrganizationReversionProcessService organizationReversionProcessService) {
79: this.organizationReversionProcessService = organizationReversionProcessService;
80: }
81: }
|