View Javadoc

1   package org.kuali.ole.batch.impl;
2   
3   import org.apache.log4j.Logger;
4   import org.kuali.ole.batch.delete.BatchProcessDeleteData;
5   import org.kuali.ole.batch.export.BatchProcessExportData;
6   import org.kuali.ole.batch.ingest.BatchProcessInvoiceIngest;
7   import org.kuali.ole.batch.ingest.BatchProcessLocationIngest;
8   import org.kuali.ole.batch.ingest.BatchProcessOrderIngest;
9   import org.kuali.ole.batch.ingest.BatchProcessPatronIngest;
10  import org.kuali.ole.batch.ingest.BatchProcessBibImport;
11  
12  /**
13   * Created with IntelliJ IDEA.
14   * User: meenrajd
15   * Date: 7/8/13
16   * Time: 4:39 PM
17   * To change this template use File | Settings | File Templates.
18   */
19  public class BatchProcessFactory {
20      private static final Logger LOG = Logger.getLogger(BatchProcessFactory.class);
21  
22      /**
23       * Factory method to create and return the batch process based on the process type in the job
24       *
25       * @param processType
26       * @return
27       */
28      public static OLEBatchProcess createProcess(String processType) {
29          if (processType == null) {
30              LOG.error("::Process Type is NULL Cannot create Batch process::");
31              throw new RuntimeException("::Process Type is NULL Cannot create Batch process::");
32          }
33          if (processType.equalsIgnoreCase("Location Import")) {
34              return new BatchProcessLocationIngest();
35          } else if (processType.equals("Patron Import")) {
36              return new BatchProcessPatronIngest();
37          } else if (processType.equals("Order Record Import")) {
38              return new BatchProcessOrderIngest();
39          } else if (processType.equals("Batch Export")) {
40              return new BatchProcessExportData();
41          } else if (processType.equals("Invoice Import")) {
42              return new BatchProcessInvoiceIngest();
43          } else if (processType.equals("Batch Delete")) {
44              return new BatchProcessDeleteData();
45          } else if (processType.equals("Bib Import")) {
46              return new BatchProcessBibImport();
47          } else {
48              return null;
49          }
50      }
51  }