Skip to content

Commit

Permalink
OLE-9427 : Quick imports stopped working
Browse files Browse the repository at this point in the history
  • Loading branch information
NSSuresh111975 committed Mar 14, 2019
1 parent 1c7eb98 commit dbc29da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,6 +74,9 @@ public class BatchRestController extends OleNgControllerBase {
@Autowired
private DescribeDAO describeDAO;

@Autowired
private BatchProfileRequestHandler batchProfileRequestHandler;

public DescribeDAO getDescribeDAO() {
return describeDAO;
}
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -706,4 +712,12 @@ private boolean isJobRunning(long jobId) {
}
return false;
}

public BatchProfileRequestHandler getBatchProfileRequestHandler() {
return batchProfileRequestHandler;
}

public void setBatchProfileRequestHandler(BatchProfileRequestHandler batchProfileRequestHandler) {
this.batchProfileRequestHandler = batchProfileRequestHandler;
}
}
2 changes: 1 addition & 1 deletion ole-app/olefs/src/main/webapp/batchProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dbc29da

Please sign in to comment.