001package org.kuali.ole.batch.impl;
002
003import org.apache.log4j.Logger;
004import org.kuali.ole.batch.export.BatchProcessExportData;
005import org.kuali.ole.batch.ingest.*;
006
007/**
008 * Created with IntelliJ IDEA.
009 * User: meenrajd
010 * Date: 7/8/13
011 * Time: 4:39 PM
012 * To change this template use File | Settings | File Templates.
013 */
014public class BatchProcessFactory {
015    private static final Logger LOG = Logger.getLogger(BatchProcessFactory.class);
016
017    /**
018     * Factory method to create and return the batch process based on the process type in the job
019     *
020     * @param processType
021     * @return
022     */
023    public static OLEBatchProcess createProcess(String processType) {
024        if (processType == null) {
025            LOG.error("::Process Type is NULL Cannot create Batch process::");
026            throw new RuntimeException("::Process Type is NULL Cannot create Batch process::");
027        }
028        if (processType.equalsIgnoreCase("Location Import")) {
029            return new BatchProcessLocationIngest();
030        } else if (processType.equals("Patron Import")) {
031            return new BatchProcessPatronIngest();
032        } else if (processType.equals("Order Record Import")) {
033            return new BatchProcessOrderIngest();
034        } else if (processType.equals("Batch Export")) {
035            return new BatchProcessExportData();
036        } else if (processType.equals("Invoice Import")) {
037            return new BatchProcessInvoiceIngest();
038        } else if (processType.equals("Batch Delete")) {
039            return new BatchProcessDeleteData();
040        } else if (processType.equals("Bib Import")) {
041            return new BatchProcessBibImport();
042        } else if (processType.equals("Claim Report")) {
043            return new OLEBatchProcessClaimReport();
044        } else if (processType.equals("Serial Record Import")) {
045            return new OLEBatchProcessSerialRecordImport();
046        } else {
047            return null;
048        }
049    }
050}