1 package org.kuali.ole.batch.controller;
2
3 import org.apache.commons.io.IOUtils;
4 import org.kuali.ole.OLEConstants;
5 import org.kuali.ole.batch.bo.OLEBatchProcessJobDetailsBo;
6 import org.kuali.ole.batch.bo.OLEBatchProcessScheduleBo;
7 import org.kuali.ole.batch.document.OLEBatchProcessDefinitionDocument;
8 import org.kuali.ole.batch.form.OLEBatchProcessJobDetailsForm;
9 import org.kuali.ole.batch.helper.OLEBatchProcessDataHelper;
10 import org.kuali.ole.batch.service.OLEBatchSchedulerService;
11 import org.kuali.ole.sys.batch.BatchFile;
12 import org.kuali.ole.sys.batch.BatchFileUtils;
13 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
14 import org.kuali.rice.krad.service.BusinessObjectService;
15 import org.kuali.rice.krad.service.KRADServiceLocator;
16 import org.kuali.rice.krad.util.GlobalVariables;
17 import org.kuali.rice.krad.web.controller.TransactionalDocumentControllerBase;
18 import org.kuali.rice.krad.web.form.UifFormBase;
19 import org.quartz.CronExpression;
20 import org.springframework.stereotype.Controller;
21 import org.springframework.validation.BindingResult;
22 import org.springframework.web.bind.annotation.ModelAttribute;
23 import org.springframework.web.bind.annotation.RequestMapping;
24 import org.springframework.web.servlet.ModelAndView;
25
26 import javax.servlet.http.HttpServletRequest;
27 import javax.servlet.http.HttpServletResponse;
28 import java.io.File;
29 import java.io.FileInputStream;
30 import java.io.InputStream;
31 import java.sql.Timestamp;
32 import java.text.ParseException;
33 import java.text.SimpleDateFormat;
34 import java.util.*;
35
36
37
38
39
40
41
42
43
44
45 @Controller
46 @RequestMapping(value = "/oleBatchProcessJobController")
47 public class OLEBatchProcessJobDetailsController extends TransactionalDocumentControllerBase {
48
49 private OLEBatchProcessDataHelper oleBatchProcessDataHelper;
50 private BusinessObjectService businessObjectService;
51 private OLEBatchSchedulerService schedulerService;
52 private static HashMap<String, String> batchProcessJobStatusMap = new HashMap<String, String>();
53
54 public OLEBatchSchedulerService getSchedulerService() {
55 if (schedulerService == null) {
56 schedulerService = GlobalResourceLoader.getService("oleSchedulerService");
57 }
58 return schedulerService;
59 }
60
61 public BusinessObjectService getBusinessObjectService() {
62 if (businessObjectService == null)
63 businessObjectService = KRADServiceLocator.getBusinessObjectService();
64 return businessObjectService;
65 }
66
67 private OLEBatchProcessDataHelper getOLEBatchProcessDataHelper() {
68
69 if (oleBatchProcessDataHelper == null) {
70 oleBatchProcessDataHelper = OLEBatchProcessDataHelper.getInstance();
71 }
72 return oleBatchProcessDataHelper;
73 }
74
75 @Override
76 protected OLEBatchProcessJobDetailsForm createInitialForm(HttpServletRequest request) {
77 OLEBatchProcessJobDetailsForm oleBatchProcessJobDetailsForm = new OLEBatchProcessJobDetailsForm();
78 GlobalVariables.getUserSession().addObject("formId", oleBatchProcessJobDetailsForm.getFormKey());
79 List<OLEBatchProcessJobDetailsBo> oLEBatchProcessJobDetailsBoList = (List<OLEBatchProcessJobDetailsBo>) getBusinessObjectService().findAllOrderBy(OLEBatchProcessJobDetailsBo.class,"jobId",false);
80 oleBatchProcessJobDetailsForm.setoLEBatchProcessJobDetailsBoList(oLEBatchProcessJobDetailsBoList);
81 return oleBatchProcessJobDetailsForm;
82 }
83
84 @RequestMapping(params = "methodToCall=stopButton")
85 public ModelAndView stopButton(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
86 HttpServletRequest request, HttpServletResponse response) throws Exception {
87 OLEBatchProcessJobDetailsForm oLEBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
88 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oLEBatchProcessJobDetailsForm);
89 batchProcessJobStatusMap.put(jobDetailsBo.getJobId(), OLEConstants.OLEBatchProcess.JOB_STATUS_STOPPED);
90 return getUIFModelAndView(oLEBatchProcessJobDetailsForm);
91 }
92
93 @RequestMapping(params = "methodToCall=startButton")
94 public ModelAndView restartButton(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
95 HttpServletRequest request, HttpServletResponse response) throws Exception {
96 OLEBatchProcessJobDetailsForm oLEBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
97 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oLEBatchProcessJobDetailsForm);
98 jobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_RUNNING);
99 getBusinessObjectService().save(jobDetailsBo);
100 List<OLEBatchProcessJobDetailsBo> oleBatchProcessJobDetailsBoList = (List<OLEBatchProcessJobDetailsBo>) getBusinessObjectService().findAllOrderBy(OLEBatchProcessJobDetailsBo.class,"jobId",false);
101 oLEBatchProcessJobDetailsForm.setoLEBatchProcessJobDetailsBoList(oleBatchProcessJobDetailsBoList);
102 getSchedulerService().startJob(jobDetailsBo.getJobId());
103 return getUIFModelAndView(oLEBatchProcessJobDetailsForm);
104 }
105
106 @RequestMapping(params = "methodToCall=resumeButton")
107 public ModelAndView resumeButton(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
108 HttpServletRequest request, HttpServletResponse response) throws Exception {
109 OLEBatchProcessJobDetailsForm oLEBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
110 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oLEBatchProcessJobDetailsForm);
111 if (jobDetailsBo.getPerCompleted().equalsIgnoreCase(String.format("%.2f", Float.valueOf(100)) + "%")) {
112 jobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_COMPLETED);
113 } else {
114 jobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_RUNNING);
115 getSchedulerService().resumeJob(jobDetailsBo.getJobId());
116 }
117 getBusinessObjectService().save(jobDetailsBo);
118
119
120 for(OLEBatchProcessJobDetailsBo oleBatchProcessJobDetailsBo:oLEBatchProcessJobDetailsForm.getoLEBatchProcessJobDetailsBoList()){
121 if(oleBatchProcessJobDetailsBo.getJobId().equals(jobDetailsBo.getJobId())){
122 oleBatchProcessJobDetailsBo.setStatus(jobDetailsBo.getStatus());
123 break;
124 }
125 }
126 return getUIFModelAndView(oLEBatchProcessJobDetailsForm);
127 }
128
129 @RequestMapping(params = "methodToCall=removeButton")
130 public ModelAndView removeButton(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
131 HttpServletRequest request, HttpServletResponse response) throws Exception {
132 OLEBatchProcessJobDetailsForm oLEBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
133 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oLEBatchProcessJobDetailsForm);
134 getOLEBatchProcessDataHelper().deleteBatchFailureFile(jobDetailsBo.getBatchProcessType(), jobDetailsBo.getJobId() + "_FailureRecord" + "_" + jobDetailsBo.getUploadFileName());
135 jobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_CANCELLED);
136 getBusinessObjectService().save(jobDetailsBo);
137
138
139 for(OLEBatchProcessJobDetailsBo oleBatchProcessJobDetailsBo:oLEBatchProcessJobDetailsForm.getoLEBatchProcessJobDetailsBoList()){
140 if(oleBatchProcessJobDetailsBo.getJobId().equals(jobDetailsBo.getJobId())){
141 oleBatchProcessJobDetailsBo.setStatus(jobDetailsBo.getStatus());
142 break;
143 }
144 }
145 getSchedulerService().deleteJob(jobDetailsBo.getJobId());
146 return getUIFModelAndView(oLEBatchProcessJobDetailsForm);
147 }
148
149 @RequestMapping(params = "methodToCall=pauseButton")
150 public ModelAndView pauseButton(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
151 HttpServletRequest request, HttpServletResponse response) throws Exception {
152 OLEBatchProcessJobDetailsForm oLEBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
153 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oLEBatchProcessJobDetailsForm);
154 if (jobDetailsBo.getPerCompleted().equalsIgnoreCase(String.format("%.2f", Float.valueOf(100)) + "%")) {
155 jobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_COMPLETED);
156 } else {
157 jobDetailsBo.setStatus(OLEConstants.OLEBatchProcess.JOB_STATUS_PAUSED);
158 getSchedulerService().pauseJob(jobDetailsBo.getJobId());
159 }
160 getBusinessObjectService().save(jobDetailsBo);
161
162
163 for(OLEBatchProcessJobDetailsBo oleBatchProcessJobDetailsBo:oLEBatchProcessJobDetailsForm.getoLEBatchProcessJobDetailsBoList()){
164 if(oleBatchProcessJobDetailsBo.getJobId().equals(jobDetailsBo.getJobId())){
165 oleBatchProcessJobDetailsBo.setStatus(jobDetailsBo.getStatus());
166 break;
167 }
168 }
169 return getUIFModelAndView(oLEBatchProcessJobDetailsForm);
170 }
171
172 @RequestMapping(params = "methodToCall=openViewReport")
173 public ModelAndView openViewReport(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
174 HttpServletRequest request, HttpServletResponse response) {
175 OLEBatchProcessJobDetailsForm oLEBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
176 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oLEBatchProcessJobDetailsForm);
177 if (jobDetailsBo.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
178 jobDetailsBo.setUploadFileName(getOLEBatchProcessDataHelper().getExportPathUrl(jobDetailsBo));
179 } else if (jobDetailsBo.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)) {
180 jobDetailsBo.setBibErrorPath(getOLEBatchProcessDataHelper().getBibPathUrl(jobDetailsBo));
181 } else if (jobDetailsBo.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_DELETE)) {
182 jobDetailsBo.setBatchDeletePath(getOLEBatchProcessDataHelper().getDeletePathUrl(jobDetailsBo));
183 } else if (jobDetailsBo.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.SERIAL_RECORD_IMPORT)) {
184 jobDetailsBo.setSerialCSVErrorPath(getOLEBatchProcessDataHelper().getSerialCSVPathUrl(jobDetailsBo));
185 }
186 List<OLEBatchProcessJobDetailsBo> oleBatchProcessJobDetailsBoList = (List<OLEBatchProcessJobDetailsBo>) getBusinessObjectService().findAllOrderBy(OLEBatchProcessJobDetailsBo.class,"jobId",false);
187 oLEBatchProcessJobDetailsForm.setoLEBatchProcessJobDetailsBoList(oleBatchProcessJobDetailsBoList);
188 oLEBatchProcessJobDetailsForm.setOleBatchProcessJobDetailsBo(jobDetailsBo);
189
190 return getUIFModelAndView(oLEBatchProcessJobDetailsForm);
191 }
192
193 @RequestMapping(params = "methodToCall=downLoadFile")
194 public ModelAndView downLoadFile(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
195 HttpServletRequest request, HttpServletResponse response) throws Exception {
196
197 OLEBatchProcessJobDetailsForm oleBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
198
199 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oleBatchProcessJobDetailsForm);
200 if (jobDetailsBo != null) {
201 Map map = new HashMap();
202 map.put("batchProcessId", jobDetailsBo.getBatchProcessId());
203 List<OLEBatchProcessDefinitionDocument> oleBatchProcessDefinitionDocumentList = (List<OLEBatchProcessDefinitionDocument>) getBusinessObjectService().findMatching(OLEBatchProcessDefinitionDocument.class, map);
204 if (oleBatchProcessDefinitionDocumentList != null && oleBatchProcessDefinitionDocumentList.size() > 0) {
205 OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = oleBatchProcessDefinitionDocumentList.get(0);
206 File file = null;
207 if (oleBatchProcessDefinitionDocument.getBatchProcessType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
208 file = new File(getBatchProcessFilePath(oleBatchProcessDefinitionDocument.getBatchProcessType() , jobDetailsBo.getJobId()) + jobDetailsBo.getJobId() + OLEConstants.OLEBatchProcess.DELETED_BIB_IDS_FILE_NAME);
209 } else {
210 file = new File(getBatchProcessFilePath(oleBatchProcessDefinitionDocument.getBatchProcessType() , jobDetailsBo.getJobId()) + jobDetailsBo.getJobId() + "_FailureRecord" + "_" + jobDetailsBo.getUploadFileName());
211 }
212 if (!file.exists() || !file.isFile()) {
213 throw new RuntimeException("Error: non-existent file or directory provided");
214 }
215 File containingDirectory = file.getParentFile();
216 if (!BatchFileUtils.isDirectoryAccessible(containingDirectory.getAbsolutePath())) {
217 throw new RuntimeException("Error: inaccessible directory provided");
218 }
219
220 BatchFile batchFile = new BatchFile();
221 batchFile.setFile(file);
222 response.setContentType("application/octet-stream");
223 response.setHeader("Content-disposition", "attachment; filename=" + file.getName());
224 response.setHeader("Expires", "0");
225 response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
226 response.setHeader("Pragma", "public");
227 response.setContentLength((int) file.length());
228
229 InputStream fis = new FileInputStream(file);
230 IOUtils.copy(fis, response.getOutputStream());
231 response.getOutputStream().flush();
232 }
233 }
234 return null;
235 }
236
237 @RequestMapping(params = "methodToCall=downLoadErrorAttachmentFile")
238 public ModelAndView downLoadErrorAttachmentFile(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
239 HttpServletRequest request, HttpServletResponse response) throws Exception {
240 OLEBatchProcessJobDetailsForm oleBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
241 OLEBatchProcessJobDetailsBo jobDetailsBo = getJobBo(oleBatchProcessJobDetailsForm);
242 if (jobDetailsBo != null) {
243 Map map = new HashMap();
244 map.put("batchProcessId", jobDetailsBo.getBatchProcessId());
245 List<OLEBatchProcessDefinitionDocument> oleBatchProcessDefinitionDocumentList = (List<OLEBatchProcessDefinitionDocument>) getBusinessObjectService().findMatching(OLEBatchProcessDefinitionDocument.class, map);
246 if (oleBatchProcessDefinitionDocumentList != null && oleBatchProcessDefinitionDocumentList.size() > 0) {
247 OLEBatchProcessDefinitionDocument oleBatchProcessDefinitionDocument = oleBatchProcessDefinitionDocumentList.get(0);
248 String uploadFileName = jobDetailsBo.getUploadFileName();
249 String errorFileName = null;
250 String[] fileNames = uploadFileName.split(",");
251 errorFileName = fileNames.length == 2 ? fileNames[0]:uploadFileName;
252 if(errorFileName.endsWith(".mrc")){
253 errorFileName = errorFileName.replace(".mrc",".txt");
254 }
255 else if(errorFileName.endsWith(".INV")){
256 errorFileName = errorFileName.replace(".INV",".txt");
257 }
258 else if(errorFileName.endsWith(".edi")){
259 errorFileName = errorFileName.replace(".edi",".txt");
260 }
261 File file = new File(getBatchProcessFilePath(oleBatchProcessDefinitionDocument.getBatchProcessType() , jobDetailsBo.getJobId()) + jobDetailsBo.getJobId() + "_FailureRecord" + "_" + errorFileName);
262 if (!file.exists() || !file.isFile()) {
263 throw new RuntimeException("Error: non-existent file or directory provided");
264 }
265 File containingDirectory = file.getParentFile();
266 if (!BatchFileUtils.isDirectoryAccessible(containingDirectory.getAbsolutePath())) {
267 throw new RuntimeException("Error: inaccessible directory provided");
268 }
269 BatchFile batchFile = new BatchFile();
270 batchFile.setFile(file);
271 response.setContentType("application/octet-stream");
272 response.setHeader("Content-disposition", "attachment; filename=" + file.getName());
273 response.setHeader("Expires", "0");
274 response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
275 response.setHeader("Pragma", "public");
276 response.setContentLength((int) file.length());
277
278 InputStream fis = new FileInputStream(file);
279 IOUtils.copy(fis, response.getOutputStream());
280 response.getOutputStream().flush();
281 }
282 }
283 return null;
284 }
285
286 @RequestMapping(params = "methodToCall=jobDocHandler")
287 public ModelAndView jobDocHandler(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
288 HttpServletRequest request, HttpServletResponse response) throws Exception {
289 OLEBatchProcessJobDetailsForm oleBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
290 ModelAndView modelAndView = super.docHandler(oleBatchProcessJobDetailsForm, result, request, response);
291 String documentClass = request.getParameter("documentClass");
292 if (documentClass != null && OLEBatchProcessScheduleBo.class.toString().contains(documentClass)) {
293 List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBoList = (List<OLEBatchProcessScheduleBo>) getBusinessObjectService().findAll(OLEBatchProcessScheduleBo.class);
294 for (OLEBatchProcessScheduleBo oleBatchProcessScheduleBo : oleBatchProcessScheduleBoList) {
295 oleBatchProcessScheduleBo.setBatchProfileName(getBatchProcessDocument(oleBatchProcessScheduleBo.getBatchProcessId()).getBatchProcessProfileName());
296 }
297 oleBatchProcessJobDetailsForm.setOleBatchProcessScheduleBoList(oleBatchProcessScheduleBoList);
298 oneTimeDate(oleBatchProcessScheduleBoList);
299 } else {
300 List<OLEBatchProcessJobDetailsBo> oLEBatchProcessJobDetailsBoList = (List<OLEBatchProcessJobDetailsBo>) getBusinessObjectService().findAllOrderBy(OLEBatchProcessJobDetailsBo.class,"jobId",false);
301 oleBatchProcessJobDetailsForm.setoLEBatchProcessJobDetailsBoList(oLEBatchProcessJobDetailsBoList);
302 }
303 return modelAndView;
304 }
305
306 private OLEBatchProcessDefinitionDocument getBatchProcessDocument(String batchProcessId) {
307 Map map = new HashMap();
308 map.put("batchProcessId", batchProcessId);
309 OLEBatchProcessDefinitionDocument batchProcessDefinitionDocument = getBusinessObjectService().findByPrimaryKey(OLEBatchProcessDefinitionDocument.class, map);
310 return batchProcessDefinitionDocument;
311 }
312
313 private String getBatchProcessFilePath(String batchProceesType , String jobId) {
314 String batchProcessLocation = getOLEBatchProcessDataHelper().getBatchProcessFilePath(batchProceesType , jobId);
315 return batchProcessLocation;
316 }
317
318
319
320
321
322 private void runJobNow(String jobName) {
323 OLEBatchSchedulerService schedulerService = GlobalResourceLoader.getService("oleSchedulerService");
324 try {
325 schedulerService.startJob(jobName);
326 } catch (Exception e) {
327 LOG.error("Error while starting job with job id :: " + jobName);
328 }
329 }
330
331 private void oneTimeDate(List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBoList) {
332
333 try {
334 for (OLEBatchProcessScheduleBo oleBatchProcessScheduleBo : oleBatchProcessScheduleBoList) {
335 CronExpression exp = new CronExpression(oleBatchProcessScheduleBo.getCronExpression());
336 Date date = exp.getNextValidTimeAfter(new Date());
337 if (date != null) {
338 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
339 Timestamp nextRunTime = new Timestamp(date.getTime());
340 oleBatchProcessScheduleBo.setNextRunTime(nextRunTime);
341 }
342 }
343 } catch (ParseException e) {
344 LOG.error("Error while validating cron exp::" + oleBatchProcessScheduleBoList.get(0).getCronExpression(), e);
345 }
346
347
348 }
349
350 @RequestMapping(params = "methodToCall=removeScheduleJob")
351 public ModelAndView removeScheduleJob(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
352 HttpServletRequest request, HttpServletResponse response) throws Exception {
353 OLEBatchProcessJobDetailsForm oleBatchProcessJobDetailsForm = (OLEBatchProcessJobDetailsForm) form;
354 Map map = new HashMap();
355 map.put("scheduleId", request.getParameter("scheduleId"));
356 OLEBatchProcessScheduleBo scheduleBo = getBusinessObjectService().findByPrimaryKey(OLEBatchProcessScheduleBo.class, map);
357 getOLEBatchProcessDataHelper().deleteBatchFailureFile(scheduleBo.getBatchProcessType(), scheduleBo.getScheduleId() + "_Scheduled" + "_" + scheduleBo.getUploadFileName());
358 getBusinessObjectService().delete(scheduleBo);
359 removeJob(scheduleBo.getScheduleId());
360 List<OLEBatchProcessScheduleBo> oleBatchProcessScheduleBoList = (List<OLEBatchProcessScheduleBo>) getBusinessObjectService().findAll(OLEBatchProcessScheduleBo.class);
361 oleBatchProcessJobDetailsForm.setOleBatchProcessScheduleBoList(oleBatchProcessScheduleBoList);
362 return getUIFModelAndView(oleBatchProcessJobDetailsForm);
363 }
364
365 private void removeJob(String jobName) {
366 OLEBatchSchedulerService schedulerService = GlobalResourceLoader.getService("oleSchedulerService");
367 try {
368 schedulerService.deleteJob(jobName);
369 } catch (Exception e) {
370 LOG.error("Error while removing job with schedule id :: " + jobName);
371 }
372 }
373
374 private OLEBatchProcessJobDetailsBo getJobBo(OLEBatchProcessJobDetailsForm oleBatchProcessJobDetailsForm) {
375 Map map = new HashMap();
376 map.put("jobId", oleBatchProcessJobDetailsForm.getJobId());
377 OLEBatchProcessJobDetailsBo jobDetailsBo = getBusinessObjectService().findByPrimaryKey(OLEBatchProcessJobDetailsBo.class, map);
378 return jobDetailsBo;
379 }
380
381 public static HashMap<String, String> getBatchProcessJobStatusMap() {
382 return batchProcessJobStatusMap;
383 }
384
385 public static void setBatchProcessJobStatusMap(String jobId, String jobStatus) {
386 batchProcessJobStatusMap.put(jobId, jobStatus);
387 }
388
389 public static void removeStatusFromBatchProcess(String jobId) {
390 if (getBatchProcessJobStatusMap() != null)
391 batchProcessJobStatusMap.remove(jobId);
392 }
393
394 public static String getBatchProcessJobStatus(String jobId) {
395 String jobStatus = null;
396 if (getBatchProcessJobStatusMap() != null) {
397 jobStatus = batchProcessJobStatusMap.get(jobId);
398 if (jobStatus != null)
399 return jobStatus;
400 else {
401 return OLEConstants.OLEBatchProcess.JOB_STATUS_RUNNING;
402 }
403 } else {
404 return OLEConstants.OLEBatchProcess.JOB_STATUS_RUNNING;
405 }
406 }
407 }