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.module.purap.batch;
17  
18  import org.kuali.ole.module.purap.service.PdpExtractService;
19  import org.kuali.ole.sys.batch.AbstractStep;
20  import org.kuali.ole.sys.util.KfsDateUtils;
21  import org.kuali.rice.core.api.datetime.DateTimeService;
22  
23  import java.util.Date;
24  
25  public class ExtractPdpStep extends AbstractStep {
26      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ExtractPdpStep.class);
27  
28      private PdpExtractService pdpExtractService;
29      private DateTimeService dateTimeService;
30  
31      public ExtractPdpStep() {
32          super();
33      }
34  
35      /**
36       * @see org.kuali.ole.sys.batch.Step#execute(java.lang.String, java.util.Date)
37       */
38      public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
39          LOG.debug("execute() started");
40  
41          pdpExtractService.extractPayments(KfsDateUtils.convertToSqlDate(jobRunDate));
42          return true;
43      }
44  
45      public boolean execute() throws InterruptedException {
46          try {
47              return execute(null, dateTimeService.getCurrentDate());
48          } catch (InterruptedException e) {
49              LOG.error("Exception occured executing step", e);
50              throw e;
51          } catch (RuntimeException e) {
52              LOG.error("Exception occured executing step", e);
53              throw e;
54          }
55      }
56  
57      public void setPdpExtractService(PdpExtractService pdpExtractService) {
58          this.pdpExtractService = pdpExtractService;
59      }
60  
61      public void setDateTimeService(DateTimeService dateTimeService) {
62          this.dateTimeService = dateTimeService;
63      }
64  }