1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.ole.module.purap.batch;
17  
18  import org.kuali.ole.module.purap.document.service.PurchaseOrderService;
19  import org.kuali.ole.sys.batch.AbstractStep;
20  import org.kuali.ole.sys.context.SpringContext;
21  import org.kuali.rice.core.api.datetime.DateTimeService;
22  
23  import java.util.Date;
24  
25  
26  
27  
28  public class AutoCloseRecurringOrdersStep extends AbstractStep {
29      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AutoCloseRecurringOrdersStep.class);
30  
31      private PurchaseOrderService purchaseOrderService;
32  
33      public AutoCloseRecurringOrdersStep() {
34          super();
35      }
36  
37      
38  
39  
40  
41  
42      public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
43          return purchaseOrderService.autoCloseRecurringOrders();
44      }
45  
46      
47  
48  
49  
50  
51  
52      public boolean execute() throws InterruptedException {
53          try {
54              return execute(null, SpringContext.getBean(DateTimeService.class).getCurrentDate());
55          } catch (InterruptedException e) {
56              LOG.error("Exception occured executing step", e);
57              throw e;
58          } catch (RuntimeException e) {
59              LOG.error("Exception occured executing step", e);
60              throw e;
61          }
62      }
63  
64      public void setPurchaseOrderService(PurchaseOrderService purchaseOrderService) {
65          this.purchaseOrderService = purchaseOrderService;
66      }
67  
68  
69  }