From dbc29da6bee03c82d6ef4fd5c515ba873438aa0f Mon Sep 17 00:00:00 2001 From: NSSuresh11 Date: Thu, 14 Mar 2019 11:51:22 +0530 Subject: [PATCH] OLE-9427 : Quick imports stopped working --- .../rest/controller/BatchRestController.java | 20 ++++++++++++++++--- ole-app/olefs/src/main/webapp/batchProcess.js | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java index 8fae3db66a..2efeee1139 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java @@ -14,7 +14,9 @@ import org.kuali.ole.oleng.batch.process.model.BatchJobDetails; import org.kuali.ole.oleng.batch.process.model.BatchProcessJob; import org.kuali.ole.oleng.batch.process.model.BatchScheduleJob; +import org.kuali.ole.oleng.batch.profile.model.BatchProcessProfile; import org.kuali.ole.oleng.dao.DescribeDAO; +import org.kuali.ole.oleng.handler.BatchProfileRequestHandler; import org.kuali.ole.oleng.rest.controller.OleNgControllerBase; import org.kuali.ole.oleng.scheduler.OleNGBatchJobScheduler; import org.kuali.ole.oleng.util.BatchExcelReportUtil; @@ -72,6 +74,9 @@ public class BatchRestController extends OleNgControllerBase { @Autowired private DescribeDAO describeDAO; + @Autowired + private BatchProfileRequestHandler batchProfileRequestHandler; + public DescribeDAO getDescribeDAO() { return describeDAO; } @@ -95,23 +100,24 @@ public String UploadFile(@RequestParam("profileId") String profileId, @RequestPa originalFilename = file.getOriginalFilename(); extension = FilenameUtils.getExtension(originalFilename); } - + BatchProcessProfile batchProcessProfile = getBatchProfileRequestHandler().getBatchProcessProfileById(Long.parseLong(profileId)); BatchProcessJob batchProcessJob = new BatchProcessJob(); batchProcessJob.setJobType(OleNGConstants.ADHOC); batchProcessJob.setProfileType(batchType); batchProcessJob.setBatchProfileId(Long.parseLong(profileId)); - batchProcessJob.setBatchProfileName(profileName); + batchProcessJob.setBatchProfileName(batchProcessProfile.getBatchProcessProfileName()); batchProcessJob.setCreatedBy(GlobalVariables.getUserSession().getPrincipalName()); batchProcessJob.setCreatedOn(new Timestamp(new Date().getTime())); batchProcessJob.setNumOfRecordsInFile(Integer.parseInt(numOfRecordsInFile)); batchProcessJob.setOutputFileFormat(outputFormat); + batchProcessJob.setJobName(batchType); batchProcessJob.setStatus(OleNGConstants.RUNNING); getBusinessObjectService().save(batchProcessJob); BatchJobDetails batchJobDetails = getBatchUtil().createBatchJobDetailsEntry(batchProcessJob, originalFilename); getBusinessObjectService().save(batchJobDetails); - JSONObject response = processBatch(uploadedDirectory, batchType, profileName, extension, batchJobDetails); + JSONObject response = processBatch(uploadedDirectory, batchType, profileId, extension, batchJobDetails); return response.toString(); } } @@ -706,4 +712,12 @@ private boolean isJobRunning(long jobId) { } return false; } + + public BatchProfileRequestHandler getBatchProfileRequestHandler() { + return batchProfileRequestHandler; + } + + public void setBatchProfileRequestHandler(BatchProfileRequestHandler batchProfileRequestHandler) { + this.batchProfileRequestHandler = batchProfileRequestHandler; + } } diff --git a/ole-app/olefs/src/main/webapp/batchProcess.js b/ole-app/olefs/src/main/webapp/batchProcess.js index beff9e9888..08994ae53f 100644 --- a/ole-app/olefs/src/main/webapp/batchProcess.js +++ b/ole-app/olefs/src/main/webapp/batchProcess.js @@ -29,7 +29,7 @@ batchProcessAPP.service('fileUpload', ['$http', function ($http) { $scope.batchProcessStatus = "Batch process job initiated...."; angular.element(document.getElementById('run'))[0].disabled = true; angular.element(document.getElementById('file'))[0].disabled = true; - angular.element(document.getElementById('profileName'))[0].disabled = true; + angular.element(document.getElementById('profileId'))[0].disabled = true; doPostRequestWithMultiPartData($scope, $http, uploadUrl, fd, function (response) { var data = response.data; var filePathName = data.filePathName;