1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.batch;
17
18 import org.kuali.ole.select.batch.service.VendorToOleExtractService;
19 import org.kuali.ole.sys.batch.AbstractStep;
20 import org.kuali.ole.sys.batch.BatchInputFileType;
21 import org.kuali.ole.sys.batch.service.BatchInputFileService;
22
23 import java.util.ArrayList;
24 import java.util.Date;
25 import java.util.List;
26
27 public class VendorToOleExtractStep extends AbstractStep {
28
29
30 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(VendorToOleExtractStep.class);
31
32 private BatchInputFileService batchInputFileService;
33 private BatchInputFileType marcInputFileType;
34 private VendorToOleExtractService vendorToOleExtractService;
35
36 public VendorToOleExtractStep() {
37 super();
38 }
39
40 public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
41
42 boolean processSuccess = true;
43 List<String> fileNamesToLoad = batchInputFileService.listInputFileNamesWithDoneFile(marcInputFileType);
44 if (fileNamesToLoad != null && fileNamesToLoad.size() > 0) {
45 List<String> processedFiles = new ArrayList();
46 for (String inputFileName : fileNamesToLoad) {
47
48 processSuccess = vendorToOleExtractService.loadVendorToOleEtl();
49 if (processSuccess) {
50 processedFiles.add(inputFileName);
51 }
52 }
53 } else
54 processSuccess = vendorToOleExtractService.loadVendorToOleEtl();
55 return processSuccess;
56
57 }
58
59 public boolean execute() throws InterruptedException {
60 try {
61 return execute(null, null);
62 } catch (InterruptedException e) {
63 LOG.error("Exception occured executing step", e);
64 throw e;
65 } catch (RuntimeException e) {
66 LOG.error("Exception occured executing step", e);
67 throw e;
68 }
69 }
70
71 public BatchInputFileService getBatchInputFileService() {
72 return batchInputFileService;
73 }
74
75 public void setBatchInputFileService(BatchInputFileService batchInputFileService) {
76 this.batchInputFileService = batchInputFileService;
77 }
78
79 public BatchInputFileType getMarcInputFileType() {
80 return marcInputFileType;
81 }
82
83 public void setMarcInputFileType(BatchInputFileType marcInputFileType) {
84 this.marcInputFileType = marcInputFileType;
85 }
86
87 public VendorToOleExtractService getVendorToOleExtractService() {
88 return vendorToOleExtractService;
89 }
90
91 public void setVendorToOleExtractService(VendorToOleExtractService vendorToOleExtractService) {
92 this.vendorToOleExtractService = vendorToOleExtractService;
93 }
94
95 }