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 AutoClosePurchaseOrdersStep extends AbstractStep {
29      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AutoClosePurchaseOrdersStep.class);
30      private PurchaseOrderService purchaseOrderService;
31  
32      public AutoClosePurchaseOrdersStep() {
33          super();
34      }
35  
36      
37  
38  
39  
40  
41      public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
42          return purchaseOrderService.autoCloseFullyDisencumberedOrders();
43      }
44  
45      
46  
47  
48  
49  
50  
51      public boolean execute() throws InterruptedException {
52          try {
53              return execute(null, SpringContext.getBean(DateTimeService.class).getCurrentDate());
54          } catch (InterruptedException e) {
55              LOG.error("Exception occured executing step", e);
56              throw e;
57          } catch (RuntimeException e) {
58              LOG.error("Exception occured executing step", e);
59              throw e;
60          }
61      }
62  
63      public void setPurchaseOrderService(PurchaseOrderService purchaseOrderService) {
64          this.purchaseOrderService = purchaseOrderService;
65      }
66  
67  }