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