use of org.hisp.dhis.scheduling.JobConfiguration in project dhis2-core by dhis2.
the class DataValueSetController method startAsyncImport.
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
/**
* Starts an asynchronous import task.
*
* @param importOptions the ImportOptions.
* @param format the resource representation format.
* @param request the HttpRequest.
*/
private WebMessage startAsyncImport(ImportOptions importOptions, String format, HttpServletRequest request) throws IOException {
InputStream inputStream = saveTmp(request.getInputStream());
JobConfiguration jobId = new JobConfiguration("dataValueImport", DATAVALUE_IMPORT, currentUserService.getCurrentUser().getUid(), true);
taskExecutor.executeTask(new ImportDataValueTask(dataValueSetService, adxDataService, sessionFactory, inputStream, importOptions, jobId, format));
return jobConfigurationReport(jobId).setLocation("/system/tasks/" + DATAVALUE_IMPORT);
}
use of org.hisp.dhis.scheduling.JobConfiguration in project dhis2-core by dhis2.
the class PdfFormController method sendFormPdfDataSet.
@PostMapping("/dataSet")
@PreAuthorize("hasRole('ALL') or hasRole('F_DATAVALUE_ADD')")
@ResponseBody
public WebMessage sendFormPdfDataSet(HttpServletRequest request) throws Exception {
JobConfiguration jobId = new JobConfiguration("inMemoryDataValueImport", JobType.DATAVALUE_IMPORT, currentUserService.getCurrentUser().getUid(), true);
notifier.clear(jobId);
InputStream in = request.getInputStream();
in = StreamUtils.wrapAndCheckCompressionFormat(in);
ImportSummary summary = dataValueSetService.importDataValueSetPdf(in, ImportOptions.getDefaultImportOptions(), jobId);
return importSummary(summary);
}
use of org.hisp.dhis.scheduling.JobConfiguration in project dhis2-core by dhis2.
the class PushAnalysisController method sendPushAnalysis.
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/{uid}/run")
public void sendPushAnalysis(@PathVariable() String uid) throws WebMessageException, IOException {
PushAnalysis pushAnalysis = pushAnalysisService.getByUid(uid);
if (pushAnalysis == null) {
throw new WebMessageException(notFound("Push analysis with uid " + uid + " was not found"));
}
JobConfiguration pushAnalysisJobConfiguration = new JobConfiguration("pushAnalysisJob from controller", JobType.PUSH_ANALYSIS, "", new PushAnalysisJobParameters(uid), true, true);
schedulingManager.executeNow(pushAnalysisJobConfiguration);
}
use of org.hisp.dhis.scheduling.JobConfiguration in project dhis2-core by dhis2.
the class ResourceTableController method resourceTables.
@RequestMapping(method = { RequestMethod.PUT, RequestMethod.POST })
@PreAuthorize("hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')")
@ResponseBody
public WebMessage resourceTables() {
JobConfiguration resourceTableJob = new JobConfiguration("inMemoryResourceTableJob", JobType.RESOURCE_TABLE, currentUserService.getCurrentUser().getUid(), true);
schedulingManager.executeNow(resourceTableJob);
return jobConfigurationReport(resourceTableJob);
}
use of org.hisp.dhis.scheduling.JobConfiguration in project dhis2-core by dhis2.
the class ResourceTableController method monitoring.
@RequestMapping(value = "/monitoring", method = { RequestMethod.PUT, RequestMethod.POST })
@PreAuthorize("hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')")
@ResponseBody
public WebMessage monitoring() {
JobConfiguration monitoringJob = new JobConfiguration("inMemoryMonitoringJob", JobType.MONITORING, "", new MonitoringJobParameters(), true, true);
schedulingManager.executeNow(monitoringJob);
return jobConfigurationReport(monitoringJob);
}
Aggregations