View Javadoc
1   package org.kuali.ole.batch.controller;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.ole.DataCarrierService;
5   import org.kuali.ole.OLEConstants;
6   import org.kuali.ole.OLEPropertyConstants;
7   import org.kuali.ole.batch.bo.OLEBatchProcessJobDetailsBo;
8   import org.kuali.ole.batch.bo.OLEBatchProcessScheduleBo;
9   import org.kuali.ole.batch.document.OLEBatchProcessDefinitionDocument;
10  import org.kuali.ole.batch.form.OLEBatchProcessDefinitionForm;
11  import org.kuali.ole.batch.helper.OLEBatchProcessDataHelper;
12  import org.kuali.ole.batch.helper.OLESchedulerHelper;
13  import org.kuali.ole.batch.keyvalue.*;
14  import org.kuali.ole.batch.rule.OLEBatchProcessRule;
15  import org.kuali.ole.batch.service.OLEBatchSchedulerService;
16  import org.kuali.ole.select.document.OLEInvoiceIngestLoadReport;
17  import org.kuali.rice.core.api.config.property.ConfigContext;
18  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19  import org.kuali.rice.krad.service.KRADServiceLocator;
20  import org.kuali.rice.krad.uif.UifConstants;
21  import org.kuali.rice.krad.uif.UifParameters;
22  import org.kuali.rice.krad.util.GlobalVariables;
23  import org.kuali.rice.krad.util.KRADConstants;
24  import org.kuali.rice.krad.web.controller.TransactionalDocumentControllerBase;
25  import org.kuali.rice.krad.web.form.DocumentFormBase;
26  import org.kuali.rice.krad.web.form.UifFormBase;
27  import org.springframework.stereotype.Controller;
28  import org.springframework.validation.BindingResult;
29  import org.springframework.web.bind.annotation.ModelAttribute;
30  import org.springframework.web.bind.annotation.RequestMapping;
31  import org.springframework.web.multipart.MultipartFile;
32  import org.springframework.web.servlet.ModelAndView;
33  
34  import javax.servlet.http.HttpServletRequest;
35  import javax.servlet.http.HttpServletResponse;
36  import java.sql.Timestamp;
37  import java.util.*;
38  
39  /**
40   * Created with IntelliJ IDEA.
41   * User: adityas
42   * Date: 7/12/13
43   * Time: 8:32 PM
44   * To change this template use File | Settings | File Templates.
45   */
46  @Controller
47  @RequestMapping(value = "/oleBatchProcessDefinitionController")
48  public class OLEBatchProcessDefinitionController extends TransactionalDocumentControllerBase {
49  
50      @Override
51      protected DocumentFormBase createInitialForm(HttpServletRequest request) {
52          OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = new OLEBatchProcessDefinitionForm();
53          return oleBatchProcessDefinitionForm;
54      }
55  
56      private OLEBatchProcessDataHelper oleBatchProcessDataHelper;
57      private OLEBatchProcessRule oleBatchProcessRule;
58  
59      public OLEBatchProcessRule getOleBatchProcessRule() {
60          if (oleBatchProcessRule == null) {
61              oleBatchProcessRule = new OLEBatchProcessRule();
62          }
63          return oleBatchProcessRule;
64      }
65  
66      private OLEBatchProcessDataHelper getOLEBatchProcessDataHelper() {
67  
68          if (oleBatchProcessDataHelper == null) {
69              oleBatchProcessDataHelper = OLEBatchProcessDataHelper.getInstance();
70          }
71          return oleBatchProcessDataHelper;
72      }
73  
74      @RequestMapping(params = "methodToCall=startBatch")
75      public ModelAndView startBatch(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
76                                 HttpServletRequest request, HttpServletResponse response) throws Exception {
77          ModelAndView modelAndView = super.docHandler(form,result,request,response);
78          boolean isValidated = getOleBatchProcessRule().canPerformBatchImport(GlobalVariables.getUserSession().getPrincipalId())
79                  || getOleBatchProcessRule().canPerformBatchExport(GlobalVariables.getUserSession().getPrincipalId())
80                  || getOleBatchProcessRule().canPerformBatchDelete(GlobalVariables.getUserSession().getPrincipalId());
81          if(!isValidated) {
82            GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.OLEBatchProcess.ERROR_AUTHORIZATION);
83            ((OLEBatchProcessDefinitionForm) form).setPermissionFlag(false);
84          }
85          OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
86          OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
87          oleBatchProcessDefinitionDocument.setChunkSize(10000);
88          oleBatchProcessDefinitionDocument.setMaxRecordsInFile(100000);
89          oleBatchProcessDefinitionDocument.setMaxNumberOfThreads(10);
90          return modelAndView;
91      }
92  
93  
94      @RequestMapping(params = "methodToCall=runNowRoute")
95      public ModelAndView runNowRoute(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
96                                      HttpServletRequest request, HttpServletResponse response) throws Exception {
97          OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
98          OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
99          buildProcessDefinitionDocument(oleBatchProcessDefinitionDocument);
100         oleBatchProcessDefinitionForm.setDocument(oleBatchProcessDefinitionDocument);
101 
102 
103         boolean isValid = getOleBatchProcessRule().canPerformBatchImport(GlobalVariables.getUserSession().getPrincipalId())
104                 || getOleBatchProcessRule().canPerformBatchExport(GlobalVariables.getUserSession().getPrincipalId())
105                 || getOleBatchProcessRule().canPerformBatchDelete(GlobalVariables.getUserSession().getPrincipalId());
106         if (!isValid) {
107             GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.OLEBatchProcess.ERROR_AUTHORIZATION);
108             return getUIFModelAndView(oleBatchProcessDefinitionForm);
109         }
110 
111         if (oleBatchProcessDefinitionDocument.getBatchProcessId() != null)
112             return getUIFModelAndView(oleBatchProcessDefinitionForm);
113         boolean isValidated = getOleBatchProcessRule().batchValidations(oleBatchProcessDefinitionForm);
114         if (!isValidated) {
115             return getUIFModelAndView(oleBatchProcessDefinitionForm);
116         }
117         if (oleBatchProcessDefinitionDocument.getBatchProcessType() != null && oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_INVOICE) && !oleBatchProcessDefinitionDocument.isContinueImportFlag()) {
118             String fileName = oleBatchProcessDefinitionDocument.getIngestedFile().getOriginalFilename();
119             List<OLEInvoiceIngestLoadReport> oleInvoiceIngestLoadReportList = (List<OLEInvoiceIngestLoadReport>) getBusinessObjectService().findAll(OLEInvoiceIngestLoadReport.class);
120             if (oleInvoiceIngestLoadReportList != null && oleInvoiceIngestLoadReportList.size() > 0) {
121                 List<String> fileNames = new ArrayList<>();
122                 for (OLEInvoiceIngestLoadReport oleInvoiceIngestLoadReport : oleInvoiceIngestLoadReportList) {
123                     fileNames.add(oleInvoiceIngestLoadReport.getFileName());
124                 }
125                 if (fileNames != null && fileNames.size() > 0) {
126                     if (fileNames.contains(fileName)) {
127                         oleBatchProcessDefinitionDocument.setFileFlag(true);
128                         return getUIFModelAndView(oleBatchProcessDefinitionForm);
129                     } else {
130 
131                     }
132                 }
133             }
134         }
135         oleBatchProcessDefinitionDocument.setUser(GlobalVariables.getUserSession().getPrincipalName());
136         oleBatchProcessDefinitionDocument.setLinkToJob(true);
137         oleBatchProcessDefinitionDocument.getDocumentHeader().setDocumentDescription(OLEConstants.OLEBatchProcess.NEW_BATCH_PRCS_DOCUMENT + oleBatchProcessDefinitionDocument.getDocumentNumber());
138         saveJob(oleBatchProcessDefinitionForm);
139         ModelAndView modelAndView = super.save(oleBatchProcessDefinitionForm, result, request, response);
140         String jobName = null;
141         if (oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList() != null && oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().size() > 0) {
142             OLEBatchProcessJobDetailsBo jobDetailsBo = oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0);
143             jobName = jobDetailsBo.getJobId();
144             jobDetailsBo.setJobName(oleBatchProcessDefinitionDocument.getBatchProcessName());
145             KRADServiceLocator.getBusinessObjectService().save(jobDetailsBo);
146         }
147         if (!oleBatchProcessDefinitionDocument.getBatchProcessType().equals(OLEConstants.OLEBatchProcess.CLAIM_REPORT) && oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList() != null && oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().size() > 0) {
148             // for order import
149             if (oleBatchProcessDefinitionDocument.getBatchProcessType().equals(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)) {
150                 if (oleBatchProcessDefinitionDocument.getEdiFile() == null) {
151                     createBatchProcessJobFile(oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0), oleBatchProcessDefinitionDocument.getMarcFile(), null, oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_JOB);
152                 } else {
153                     createBatchProcessJobFile(oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0), oleBatchProcessDefinitionDocument.getMarcFile(), oleBatchProcessDefinitionDocument.getEdiFile(), oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_JOB);
154                 }
155             }
156             // for serial record import
157             else if (oleBatchProcessDefinitionDocument.getBatchProcessType().equals(OLEConstants.OLEBatchProcess.SERIAL_RECORD_IMPORT)) {
158                 if (oleBatchProcessDefinitionDocument.getInputFormat().equalsIgnoreCase("xml")) {
159                     createBatchProcessJobFile(oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0), oleBatchProcessDefinitionDocument.getIngestedFile(), null, oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_JOB);
160                 } else {
161                     createBatchProcessJobFile(oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0), oleBatchProcessDefinitionDocument.getSerialRecordDocumentFile(), oleBatchProcessDefinitionDocument.getSerialRecordTypeFile(), oleBatchProcessDefinitionDocument.getSerialRecordHistoryFile(), oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_JOB);
162                 }
163             } else if (oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
164                 if (oleBatchProcessDefinitionDocument.getLoadIdFromFile().equalsIgnoreCase("true")) {
165                     createBatchProcessJobFile(oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0), oleBatchProcessDefinitionDocument.getIngestedFile(), null, oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_JOB);
166                 }
167             }
168             // for other than   serial record import & Order Import
169             else {
170                 createBatchProcessJobFile(oleBatchProcessDefinitionDocument.getOleBatchProcessJobDetailsBoList().get(0), oleBatchProcessDefinitionDocument.getIngestedFile(), null, oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_JOB);
171             }
172 
173         }
174         if (jobName != null) {
175             runJobNow(jobName);
176         }
177         oleBatchProcessDefinitionDocument.setAfterSubmitFlag(true);
178         oleBatchProcessDefinitionForm.setNavigationBatchProcessId(oleBatchProcessDefinitionDocument.getBatchProcessId());
179         return modelAndView;
180     }
181 
182     /**
183      * This method saves the job
184      * @param
185      */
186     private OLEBatchProcessJobDetailsBo saveJob(DocumentFormBase form) {
187         Timestamp timestamp = new Timestamp(new Date().getTime());
188         OLEBatchProcessJobDetailsBo oleBatchProcessJobDetailsBo = new OLEBatchProcessJobDetailsBo();
189         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
190         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
191         String profileName = oleBatchProcessDefinitionDocument.getBatchProcessProfileName();
192         if (oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)) {
193             if(oleBatchProcessDefinitionDocument.getEdiFile() != null) {
194                 MultipartFile marcFile = oleBatchProcessDefinitionDocument.getMarcFile();
195                 MultipartFile ediFile = oleBatchProcessDefinitionDocument.getEdiFile();
196                 oleBatchProcessJobDetailsBo.setUploadFileName(marcFile.getOriginalFilename() + "," + ediFile.getOriginalFilename());
197                 oleBatchProcessDefinitionDocument.setUploadFileName(marcFile.getOriginalFilename() + "," + ediFile.getOriginalFilename());
198                 oleBatchProcessDefinitionDocument.setMarcFileName(marcFile.getOriginalFilename());
199                 oleBatchProcessDefinitionDocument.setEdiFileName(ediFile.getOriginalFilename());
200             }
201             else{
202                 MultipartFile ingestFile = oleBatchProcessDefinitionDocument.getMarcFile();
203                 oleBatchProcessJobDetailsBo.setUploadFileName(ingestFile.getOriginalFilename());
204                 oleBatchProcessDefinitionDocument.setUploadFileName(ingestFile.getOriginalFilename());
205                 oleBatchProcessDefinitionDocument.setMarcFileName(ingestFile.getOriginalFilename());
206             }
207         } else if (oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.SERIAL_RECORD_IMPORT)) {
208             if (oleBatchProcessDefinitionDocument.getInputFormat().equalsIgnoreCase("xml")) {
209                 MultipartFile ingestFile = oleBatchProcessDefinitionDocument.getIngestedFile();
210                 oleBatchProcessJobDetailsBo.setUploadFileName(ingestFile.getOriginalFilename());
211                 oleBatchProcessDefinitionDocument.setUploadFileName(ingestFile.getOriginalFilename());
212             } else {
213                 MultipartFile documentFile = oleBatchProcessDefinitionDocument.getSerialRecordDocumentFile();
214                 MultipartFile typeFile = oleBatchProcessDefinitionDocument.getSerialRecordTypeFile();
215                 MultipartFile historyFile = oleBatchProcessDefinitionDocument.getSerialRecordHistoryFile();
216                 oleBatchProcessJobDetailsBo.setUploadFileName((documentFile != null ? documentFile.getOriginalFilename() + "," : "")
217                         + (typeFile != null ? typeFile.getOriginalFilename() + "," : "")
218                         + (historyFile != null ? historyFile.getOriginalFilename() : ""));
219                 oleBatchProcessDefinitionDocument.setSerialRecordDocumentFileName(documentFile != null ? documentFile.getOriginalFilename() : null);
220                 oleBatchProcessDefinitionDocument.setSerialRecordTypeFileName(typeFile != null ? typeFile.getOriginalFilename() : null);
221                 oleBatchProcessDefinitionDocument.setSerialRecordHistoryFileName(historyFile != null ? historyFile.getOriginalFilename() : null);
222             }
223             oleBatchProcessDefinitionDocument.setOutputFormat(oleBatchProcessDefinitionDocument.getInputFormat());
224         } else if (oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT) && oleBatchProcessDefinitionDocument.getLoadIdFromFile().equalsIgnoreCase("true")) {
225             MultipartFile ingestFile = oleBatchProcessDefinitionDocument.getIngestedFile();
226             oleBatchProcessJobDetailsBo.setUploadFileName(ingestFile.getOriginalFilename());
227             oleBatchProcessDefinitionDocument.setUploadFileName(ingestFile.getOriginalFilename());
228         } else if (!oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)
229                 && !oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.CLAIM_REPORT)
230                 && !oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.SERIAL_RECORD_IMPORT)) {
231             MultipartFile ingestFile = oleBatchProcessDefinitionDocument.getIngestedFile();
232             oleBatchProcessJobDetailsBo.setUploadFileName(ingestFile.getOriginalFilename());
233             oleBatchProcessDefinitionDocument.setUploadFileName(ingestFile.getOriginalFilename());
234         }
235         oleBatchProcessJobDetailsBo.setCreateTime(timestamp);
236         if (oleBatchProcessDefinitionDocument.isScheduleFlag()) {
237             oleBatchProcessJobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_SCHEDULED);
238             //   oleBatchProcessJobDetailsBo.setStatus(profileName + " " + OLEConstants.OLEBatchProcess.JOB_STATUS_SCHEDULED);
239         } else {
240             oleBatchProcessJobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_RUNNING);
241             // oleBatchProcessJobDetailsBo.setStatus(profileName + " " + OLEConstants.OLEBatchProcess.JOB_STATUS_RUNNING);
242         }
243         String loginUser = GlobalVariables.getUserSession().getPrincipalName();
244         oleBatchProcessJobDetailsBo.setUserName(loginUser);
245         oleBatchProcessJobDetailsBo.setBatchProfileName(profileName);
246         oleBatchProcessJobDetailsBo.setBatchProcessType(oleBatchProcessDefinitionDocument.getBatchProcessType());
247         List<OLEBatchProcessJobDetailsBo> oleBatchProcessJobDetailsBos = new ArrayList<OLEBatchProcessJobDetailsBo>();
248         oleBatchProcessJobDetailsBos.add(oleBatchProcessJobDetailsBo);
249         oleBatchProcessDefinitionDocument.setOleBatchProcessJobDetailsBoList(oleBatchProcessJobDetailsBos);
250         oleBatchProcessJobDetailsBo.setStartTime(timestamp);
251         DataCarrierService dataCarrierService = GlobalResourceLoader.getService(OLEConstants.DATA_CARRIER_SERVICE);
252         dataCarrierService.addData("oleBatchProcessJobDetailsBo",oleBatchProcessJobDetailsBo);
253         return oleBatchProcessJobDetailsBo;
254     }
255 
256     private void saveSchedule(OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm) {
257         // OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm)form;
258         Timestamp timestamp = new Timestamp(new Date().getTime());
259         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
260 
261         oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().setScheduleType(oleBatchProcessDefinitionDocument.getScheduleType());
262         oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().setOneTimeOrRecurring(oleBatchProcessDefinitionDocument.getOneTimeOrRecurring());
263         OLEBatchProcessScheduleBo oleBatchProcessScheduleBo = oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo();
264         if (oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)) {
265             if(oleBatchProcessDefinitionDocument.getEdiFile() != null) {
266                 MultipartFile marcFile = oleBatchProcessDefinitionDocument.getMarcFile();
267                 MultipartFile ediFile = oleBatchProcessDefinitionDocument.getEdiFile();
268                 oleBatchProcessScheduleBo.setUploadFileName(marcFile.getOriginalFilename() + "," + ediFile.getOriginalFilename());
269                 oleBatchProcessDefinitionDocument.setUploadFileName(marcFile.getOriginalFilename() + "," + ediFile.getOriginalFilename());
270                 oleBatchProcessDefinitionDocument.setMarcFileName(marcFile.getOriginalFilename());
271                 oleBatchProcessDefinitionDocument.setEdiFileName(ediFile.getOriginalFilename());
272             }
273             else{
274                 MultipartFile ingestFile = oleBatchProcessDefinitionDocument.getMarcFile();
275                 oleBatchProcessScheduleBo.setUploadFileName(ingestFile.getOriginalFilename());
276                 oleBatchProcessDefinitionDocument.setMarcFileName(ingestFile.getOriginalFilename());
277             }
278         } else if ((oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT) && oleBatchProcessDefinitionDocument.getLoadIdFromFile().equalsIgnoreCase(String.valueOf(Boolean.TRUE))) || !oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
279             MultipartFile ingestFile = oleBatchProcessDefinitionDocument.getIngestedFile();
280             oleBatchProcessScheduleBo.setUploadFileName(ingestFile.getOriginalFilename());
281             oleBatchProcessDefinitionDocument.setUploadFileName(ingestFile.getOriginalFilename());
282         }
283         oleBatchProcessScheduleBo.setCreateTime(timestamp);
284         String loginUser = GlobalVariables.getUserSession().getPrincipalName();
285         oleBatchProcessScheduleBo.setUserName(loginUser);
286         String cronExpression = null;
287         if (!oleBatchProcessDefinitionDocument.getCronOrSchedule().equals(OLEConstants.OLEBatchProcess.PROVIDED_CRON)) {
288             OLESchedulerHelper oleSchedulerHelper = OLESchedulerHelper.getInstance();
289             cronExpression = oleSchedulerHelper.getCronExpression(oleBatchProcessScheduleBo);
290         } else {
291             cronExpression = oleBatchProcessDefinitionDocument.getEnteredCronExp();
292         }
293         boolean validCronExpression = org.quartz.CronExpression.isValidExpression(cronExpression);
294         if (!validCronExpression) {
295             GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.OLEBatchProcess.ERROR_CRON_EXPRESSION);
296             return;
297         }
298         oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().setCronExpression(cronExpression);
299         oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().setWeekDays(oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().getWeekDays());
300         oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().setBatchProcessType(oleBatchProcessDefinitionDocument.getBatchProcessType());
301         List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBos = new ArrayList<OLEBatchProcessScheduleBo>();
302         oleBatchProcessScheduleBos.add(oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo());
303         oleBatchProcessDefinitionDocument.setOleBatchProcessScheduleBoList(oleBatchProcessScheduleBos);
304     }
305 
306     @Override
307     @RequestMapping(params = "methodToCall=route")
308     public ModelAndView route(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
309                               HttpServletRequest request, HttpServletResponse response) {
310         ModelAndView modelAndView = null;
311         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
312         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
313         buildProcessDefinitionDocument(oleBatchProcessDefinitionDocument);
314         oleBatchProcessDefinitionForm.setDocument(oleBatchProcessDefinitionDocument);
315         oleBatchProcessDefinitionDocument.getDocumentHeader().setDocumentDescription(OLEConstants.OLEBatchProcess.NEW_BATCH_PRCS_DOCUMENT + oleBatchProcessDefinitionDocument.getDocumentNumber());
316         boolean isValidated = getOleBatchProcessRule().batchValidations(oleBatchProcessDefinitionForm);
317         if (!isValidated) {
318             return getUIFModelAndView(oleBatchProcessDefinitionForm);
319         }
320         oleBatchProcessDefinitionDocument.setUser(GlobalVariables.getUserSession().getPrincipalName());
321         if (!oleBatchProcessDefinitionDocument.isRunNowFlag()) {
322             saveSchedule(oleBatchProcessDefinitionForm);
323             boolean updateDocFlag = false;
324             if (oleBatchProcessDefinitionDocument.getBatchProcessId() != null) {
325                 updateDocFlag = true;
326                 if (oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo() != null) {
327                     rescheduleJob(oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().getScheduleId(), oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBo().getCronExpression());
328                 }
329             }
330 
331             try {
332                 modelAndView = super.save(oleBatchProcessDefinitionForm, result, request, response);
333                 if (oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBoList() != null && oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBoList().size() > 0 && !updateDocFlag) {
334                     if (oleBatchProcessDefinitionDocument.getBatchProcessType().equals(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)) {
335                         createBatchProcessSchedulerFile(oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBoList().get(0), oleBatchProcessDefinitionDocument.getMarcFile(), oleBatchProcessDefinitionDocument.getEdiFile(), oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_SCHEDULE);
336                     } else if ((oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT) && oleBatchProcessDefinitionDocument.getLoadIdFromFile().equalsIgnoreCase(String.valueOf(Boolean.TRUE))) || !oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
337                         createBatchProcessSchedulerFile(oleBatchProcessDefinitionDocument.getOleBatchProcessScheduleBoList().get(0), oleBatchProcessDefinitionDocument.getIngestedFile(), null, oleBatchProcessDefinitionDocument.getBatchProcessType(), OLEConstants.OLEBatchProcess.PROFILE_SCHEDULE);
338                     }
339                 }
340             } catch (Exception e) {
341                 LOG.error("Error when scheduling the job :" + e);
342             }
343             OLEBatchProcessScheduleBo scheduleBo = ((OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument()).getOleBatchProcessScheduleBo();
344             try {
345                 addToBatchScheduler(scheduleBo.getScheduleId(), scheduleBo.getCronExpression());
346             } catch (Exception e) {
347                 throw new RuntimeException(e);
348             }
349             oleBatchProcessDefinitionDocument.setRescheduleFlag(true);
350             oleBatchProcessDefinitionDocument.setAfterSubmitFlag(true);
351         }
352         return modelAndView;
353     }
354 
355     @Override
356     @RequestMapping(params = "methodToCall=save")
357     public ModelAndView save(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
358                              HttpServletRequest request, HttpServletResponse response) throws Exception {
359         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
360         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
361         oleBatchProcessDefinitionDocument.getDocumentHeader().setDocumentDescription(OLEConstants.OLEBatchProcess.NEW_BATCH_PRCS_DOCUMENT + oleBatchProcessDefinitionDocument.getDocumentNumber());
362         boolean isValidated = getOleBatchProcessRule().batchValidations(oleBatchProcessDefinitionForm);
363         if (!isValidated) {
364             return getUIFModelAndView(oleBatchProcessDefinitionForm);
365         }
366         return super.save(oleBatchProcessDefinitionForm, result, request, response);
367     }
368 
369     @RequestMapping(params = "methodToCall=clear")
370     public ModelAndView clear(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
371                               HttpServletRequest request, HttpServletResponse response) {
372         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
373         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
374         oleBatchProcessDefinitionDocument.setScheduleFlag(false);
375         oleBatchProcessDefinitionDocument.setBatchProcessName("");
376         oleBatchProcessDefinitionDocument.setBatchProcessProfileName("");
377         oleBatchProcessDefinitionDocument.setBatchProcessType("");
378         oleBatchProcessDefinitionDocument.setBatchProcessKRMSProfile("");
379         oleBatchProcessDefinitionDocument.setChunkSize(0);
380         return getUIFModelAndView(oleBatchProcessDefinitionForm);
381     }
382 
383     /**
384      * Ads the scheduled record id as the jobName and sets the trigger for the cronExpression supplied
385      * @param jobName
386      * @param cronExpression
387      */
388     private void addToBatchScheduler(String jobName, String cronExpression) throws Exception {
389         OLEBatchSchedulerService schedulerService = GlobalResourceLoader.getService("oleSchedulerService");
390         schedulerService.initializeJobsForModule(jobName);
391         schedulerService.initializeTriggersForModule(jobName, cronExpression);
392     }
393 
394     /**
395      * Runs the process for the profile selected and takes the scheduled record id as the job name
396      *
397      * @param jobName
398      */
399     private void runJobNow(String jobName) {
400         OLEBatchSchedulerService schedulerService = GlobalResourceLoader.getService("oleSchedulerService");
401         try {
402             schedulerService.startJob(jobName);
403         } catch (Exception e) {
404             LOG.error("Error while starting job with job id :: "+jobName);
405         }
406     }
407 
408    /* private String getBatchProcessFilePath(String batchProceesType) {
409 
410         String batchProcessLocation = getOLEBatchProcessDataHelper().getBatchProcessFilePath(batchProceesType);
411         return batchProcessLocation;
412     }*/
413 
414     private void createBatchProcessJobFile(OLEBatchProcessJobDetailsBo batchProcessJobDetailsBo, MultipartFile ingestFile1, MultipartFile ingestFile2, String batchProceesType, String jobType) throws Exception {
415         if (ingestFile2 == null) {
416             String ingestFileName = batchProcessJobDetailsBo.getJobId() + jobType + "_" + ingestFile1.getOriginalFilename();
417             getOLEBatchProcessDataHelper().createBatchProcessFile(batchProceesType, ingestFileName, new String(ingestFile1.getBytes()), batchProcessJobDetailsBo.getJobId());
418         } else {
419 
420             String mrcFileName = batchProcessJobDetailsBo.getJobId() + jobType + "_" + ingestFile1.getOriginalFilename();
421             String ediFileName = batchProcessJobDetailsBo.getJobId() + jobType + "_" + ingestFile2.getOriginalFilename();
422             if(ediFileName != null){
423                 getOLEBatchProcessDataHelper().createBatchProcessFile(batchProceesType, mrcFileName, ediFileName, new String(ingestFile1.getBytes()), new String(ingestFile2.getBytes()) ,batchProcessJobDetailsBo.getJobId() );
424             }
425            /* else {
426                 getOLEBatchProcessDataHelper().createBatchProcessFile(batchProceesType, mrcFileName, new String(ingestFile1.getBytes()), new String(ingestFile2.getBytes()));
427             }*/
428 
429         }
430 
431     }
432 
433     private void createBatchProcessJobFile(OLEBatchProcessJobDetailsBo batchProcessJobDetailsBo, MultipartFile ingestFile1, MultipartFile ingestFile2, MultipartFile ingestFile3, String batchProceesType, String jobType) throws Exception {
434         if (ingestFile1 != null || ingestFile2 != null || ingestFile3 != null) {
435             String documentFileName = ingestFile1 != null ? batchProcessJobDetailsBo.getJobId() + jobType + "_" + ingestFile1.getOriginalFilename() : null;
436             String typeFileName = ingestFile2 != null ? batchProcessJobDetailsBo.getJobId() + jobType + "_" + ingestFile2.getOriginalFilename() : null;
437             String historyFileName = ingestFile3 != null ? batchProcessJobDetailsBo.getJobId() + jobType + "_" + ingestFile3.getOriginalFilename() : null;
438             getOLEBatchProcessDataHelper().createBatchProcessFile(batchProceesType, documentFileName, typeFileName, historyFileName, ingestFile1 !=null ? new String(ingestFile1.getBytes()) : null, ingestFile2 !=null ? new String(ingestFile2.getBytes()) : null, ingestFile3 !=null ? new String(ingestFile3.getBytes()) : null ,batchProcessJobDetailsBo.getJobId());
439         }
440     }
441 
442     private void createBatchProcessSchedulerFile(OLEBatchProcessScheduleBo oleBatchProcessScheduleBo, MultipartFile ingestFile1, MultipartFile ingestFile2, String batchProceesType, String jobType) throws Exception {
443         if (ingestFile2 == null && ingestFile1!=null) {
444             String ingestFileName = oleBatchProcessScheduleBo.getScheduleId() + jobType + "_" + ingestFile1.getOriginalFilename();
445             getOLEBatchProcessDataHelper().createBatchProcessFile(batchProceesType, ingestFileName, new String(ingestFile1.getBytes()), oleBatchProcessScheduleBo.getScheduleId());
446         }
447         else  if (ingestFile2 != null && ingestFile1!=null) {
448             String mrcFileName = oleBatchProcessScheduleBo.getScheduleId() + jobType + "_" + ingestFile1.getOriginalFilename();
449             String ediFileName = oleBatchProcessScheduleBo.getScheduleId() + jobType + "_" + ingestFile2.getOriginalFilename();
450             getOLEBatchProcessDataHelper().createBatchProcessFile(batchProceesType, mrcFileName, ediFileName, new String(ingestFile1.getBytes()), new String(ingestFile2.getBytes()) , oleBatchProcessScheduleBo.getScheduleId());
451 
452         }
453 
454     }
455 
456     @RequestMapping(params = "methodToCall=docHandler")
457     public ModelAndView docHandler(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
458                                    HttpServletRequest request, HttpServletResponse response) throws Exception {
459         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
460         String batchProcessId= request.getParameter("batchProcessId");
461         ModelAndView modelAndView = super.docHandler(oleBatchProcessDefinitionForm,result,request,response);
462         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
463         batchProcessId= oleBatchProcessDefinitionDocument.getBatchProcessId();
464         if(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT.equals(oleBatchProcessDefinitionDocument.getBatchProcessType()) && oleBatchProcessDefinitionDocument.getUploadFileName()!=null) {
465             String[] fileNames = oleBatchProcessDefinitionDocument.getUploadFileName().split(",");
466             if(fileNames.length == 2) {
467                 oleBatchProcessDefinitionDocument.setMarcFileName(fileNames[0]);
468                 oleBatchProcessDefinitionDocument.setEdiFileName(fileNames[1]);
469             }
470             else {
471                 oleBatchProcessDefinitionDocument.setMarcFileName(fileNames[0]);
472             }
473         }
474 
475         if(oleBatchProcessDefinitionDocument.getCronOrSchedule()!=null) {
476             Map batchProcessMap = new HashMap();
477             batchProcessMap.put("batchProcessId", batchProcessId);
478             List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBoList = (List<OLEBatchProcessScheduleBo>) getBusinessObjectService().findMatching(OLEBatchProcessScheduleBo.class, batchProcessMap);
479             if(oleBatchProcessScheduleBoList!=null && oleBatchProcessScheduleBoList.size() > 0){
480                 oleBatchProcessDefinitionDocument.setOleBatchProcessScheduleBo(oleBatchProcessScheduleBoList.get(0));
481                 oleBatchProcessDefinitionDocument.setScheduleFlag(true);
482             }
483         }
484         if (oleBatchProcessDefinitionDocument != null && oleBatchProcessDefinitionDocument.getDocumentHeader() != null
485                 && oleBatchProcessDefinitionDocument.getDocumentHeader().getWorkflowDocument() != null
486                 && oleBatchProcessDefinitionDocument.getDocumentHeader().getWorkflowDocument().isSaved()) {
487             oleBatchProcessDefinitionDocument.setAfterSubmitFlag(true);
488         }
489         return modelAndView;
490     }
491 
492     @RequestMapping(params = "methodToCall=reschedule")
493     public ModelAndView reschedule(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
494                                    HttpServletRequest request, HttpServletResponse response) throws Exception {
495         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
496         String batchProcessId = request.getParameter("batchProcessId");
497         ModelAndView modelAndView = null;
498         if (batchProcessId != null) {
499             Map batchProcessMap = new HashMap();
500             batchProcessMap.put("batchProcessId", batchProcessId);
501             List<OLEBatchProcessDefinitionDocument> oleBatchProcessDefinitionDocuments = (List<OLEBatchProcessDefinitionDocument>) getBusinessObjectService().findMatching(OLEBatchProcessDefinitionDocument.class, batchProcessMap);
502             if (oleBatchProcessDefinitionDocuments.size() > 0) {
503                 oleBatchProcessDefinitionForm.setDocId(oleBatchProcessDefinitionDocuments.get(0).getDocumentNumber());
504                 modelAndView = super.docHandler(oleBatchProcessDefinitionForm, result, request, response);
505                 OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
506                 oleBatchProcessDefinitionDocument.setRescheduleFlag(false);
507                 if(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT.equals(oleBatchProcessDefinitionDocument.getBatchProcessType()) && oleBatchProcessDefinitionDocument.getUploadFileName()!=null) {
508                     String[] fileNames = oleBatchProcessDefinitionDocument.getUploadFileName().split(",");
509                     if(fileNames.length == 2) {
510                         oleBatchProcessDefinitionDocument.setMarcFileName(fileNames[0]);
511                         oleBatchProcessDefinitionDocument.setEdiFileName(fileNames[1]);
512                     }
513                     else {
514                         oleBatchProcessDefinitionDocument.setMarcFileName(fileNames[0]);
515                     }
516                 }
517                 if (oleBatchProcessDefinitionDocument.getCronOrSchedule() != null) {
518                     List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBoList = (List<OLEBatchProcessScheduleBo>) getBusinessObjectService().findMatching(OLEBatchProcessScheduleBo.class, batchProcessMap);
519                     if (oleBatchProcessScheduleBoList != null && oleBatchProcessScheduleBoList.size() > 0) {
520                         oleBatchProcessDefinitionDocument.setOleBatchProcessScheduleBo(oleBatchProcessScheduleBoList.get(0));
521                         oleBatchProcessDefinitionDocument.setScheduleFlag(true);
522                     }
523                 }
524             }
525         }
526 
527         return modelAndView;
528     }
529 
530     private void rescheduleJob(String scheduleId, String cronExp) {
531         OLEBatchSchedulerService schedulerService = GlobalResourceLoader.getService("oleSchedulerService");
532         try {
533             schedulerService.rescheduleJob(scheduleId, cronExp);
534         } catch (Exception e) {
535             LOG.error("Error while removing job with schedule id :: " + scheduleId);
536         }
537     }
538 
539     @RequestMapping(params = "methodToCall=close")
540     public ModelAndView close(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
541                                       HttpServletRequest request, HttpServletResponse response) throws Exception {
542         String baseUrl = ConfigContext.getCurrentContextConfig().getProperty(OLEPropertyConstants.OLE_URL_BASE);
543         String url = baseUrl + "/portal.do";
544         Properties props = new Properties();
545         props.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.REFRESH);
546         if (StringUtils.isNotBlank(form.getReturnFormKey())) {
547             props.put(UifParameters.FORM_KEY, form.getReturnFormKey());
548         }
549         return performRedirect(form, url, props);
550     }
551 
552     @RequestMapping(params = "methodToCall=populateField")
553     public ModelAndView populateField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
554                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
555         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
556 
557         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
558         oleBatchProcessDefinitionForm.setBatchProcessType(oleBatchProcessDefinitionDocument.getProcessTypeHidden());
559         oleBatchProcessDefinitionDocument.setBatchProcessType(oleBatchProcessDefinitionDocument.getProcessTypeHidden());
560         oleBatchProcessDefinitionDocument.setBatchProcessProfileName(oleBatchProcessDefinitionDocument.getProcessNameHidden());
561 
562         buildProcessDefinitionDocument(oleBatchProcessDefinitionDocument);
563         oleBatchProcessDefinitionForm.setDocument(oleBatchProcessDefinitionDocument);
564         return super.refresh(form,result,request,response);
565     }
566 
567     @RequestMapping(params = "methodToCall=refreshPageView")
568     public ModelAndView refreshPageView(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
569                                       HttpServletRequest request, HttpServletResponse response) throws Exception {
570 
571         return super.refresh(form,result,request,response);
572     }
573 
574 
575     @RequestMapping(params = "methodToCall=profileId")
576     public ModelAndView profileId(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
577                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
578         OLEBatchProcessDefinitionForm oleBatchProcessDefinitionForm = (OLEBatchProcessDefinitionForm) form;
579         OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = (OLEBatchProcessDefinitionDocument) oleBatchProcessDefinitionForm.getDocument();
580         buildProcessDefinitionDocument(oleBatchProcessDefinitionDocument);
581         oleBatchProcessDefinitionForm.setDocument(oleBatchProcessDefinitionDocument);
582         return super.refresh(form,result,request,response);
583     }
584 
585     private void buildProcessDefinitionDocument(OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument) {
586         if (OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
587             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessBibImportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
588         } else if (OLEConstants.OLEBatchProcess.BATCH_INVOICE.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
589             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessInvoiceImportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
590         } else if (OLEConstants.OLEBatchProcess.BATCH_ORDER_IMPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
591             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessOrderImportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
592             oleBatchProcessDefinitionDocument.setBatchProcessKRMSProfile(OLEBatchProcessOrderImportProfileValueFinder.getKrmsValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
593             oleBatchProcessDefinitionDocument.setMarcOnly(OLEBatchProcessOrderImportProfileValueFinder.getMarcValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
594         } else if (OLEConstants.OLEBatchProcess.PATRON_IMPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
595             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessPatronImportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
596         } else if (OLEConstants.OLEBatchProcess.CLAIM_REPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
597             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessClaimImportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
598         } else if (OLEConstants.OLEBatchProcess.SERIAL_RECORD_IMPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
599             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessSerialRecordProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
600         } else if (OLEConstants.OLEBatchProcess.LOCATION_IMPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
601             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessLocationImportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
602         } else if (OLEConstants.OLEBatchProcess.BATCH_DELETE.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
603             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessBatchDeleteProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
604         } else if (OLEConstants.OLEBatchProcess.BATCH_EXPORT.equalsIgnoreCase(oleBatchProcessDefinitionDocument.getBatchProcessType())) {
605             oleBatchProcessDefinitionDocument.setBatchProcessProfileId(OLEBatchProcessBatchExportProfileValueFinder.getValue(oleBatchProcessDefinitionDocument.getBatchProcessProfileName()));
606             oleBatchProcessDefinitionDocument.getLoadIdFromFile();
607         }
608     }
609 
610 
611 }