use of org.hisp.dhis.scheduling.TaskId in project dhis2-core by dhis2.
the class GetImportSummaryAction method execute.
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() {
TaskId taskId = new TaskId(category, currentUserService.getCurrentUser());
summary = (ImportSummary) notifier.getTaskSummary(taskId);
return SUCCESS;
}
use of org.hisp.dhis.scheduling.TaskId in project dhis2-core by dhis2.
the class GetImportSummaryAction method execute.
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() {
TaskId taskId = new TaskId(category, currentUserService.getCurrentUser());
summary = (ImportSummary) notifier.getTaskSummary(taskId);
return SUCCESS;
}
use of org.hisp.dhis.scheduling.TaskId in project dhis2-core by dhis2.
the class MetaDataImportAction method execute.
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
strategy = strategy != null ? strategy : ImportStrategy.NEW_AND_UPDATES;
User user = currentUserService.getCurrentUser();
TaskId taskId = new TaskId(TaskCategory.METADATA_IMPORT, user);
notifier.clear(taskId);
InputStream in = StreamUtils.wrapAndCheckCompressionFormat(new FileInputStream(upload));
MetadataImportParams importParams = createMetadataImportParams(taskId, strategy, atomicMode, dryRun).setFilename(uploadFileName);
if ("csv".equals(importFormat)) {
if (classKey != null && CSV_SUPPORTED_CLASSES.containsKey(classKey)) {
scheduler.executeTask(new ImportMetaDataCsvTask(importService, csvImportService, schemaService, importParams, in, CSV_SUPPORTED_CLASSES.get(classKey)));
}
} else if ("gml".equals(importFormat)) {
scheduler.executeTask(new ImportMetaDataGmlTask(gmlImportService, importParams, in));
} else if ("json".equals(importFormat) || "xml".equals(importFormat)) {
scheduler.executeTask(new ImportMetaDataTask(importService, schemaService, importParams, in, importFormat));
}
return SUCCESS;
}
use of org.hisp.dhis.scheduling.TaskId in project dhis2-core by dhis2.
the class DataIntegrityController method runAsyncDataIntegrity.
//--------------------------------------------------------------------------
// Start asynchronous data integrity task
//--------------------------------------------------------------------------
@PreAuthorize("hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')")
@RequestMapping(value = DataIntegrityController.RESOURCE_PATH, method = RequestMethod.POST)
public void runAsyncDataIntegrity(HttpServletResponse response, HttpServletRequest request) {
TaskId taskId = new TaskId(TaskCategory.DATAINTEGRITY, currentUserService.getCurrentUser());
notifier.clear(taskId);
scheduler.executeTask(new DataIntegrityTask(taskId, dataIntegrityService, notifier));
response.setHeader("Location", ContextUtils.getRootPath(request) + "/system/tasks/" + TaskCategory.DATAINTEGRITY);
response.setStatus(HttpServletResponse.SC_ACCEPTED);
}
use of org.hisp.dhis.scheduling.TaskId in project dhis2-core by dhis2.
the class CompleteDataSetRegistrationController method asyncImport.
private void asyncImport(ImportOptions importOptions, String format, HttpServletRequest request, HttpServletResponse response) throws IOException {
Pair<InputStream, Path> tmpFile = saveTmpFile(request.getInputStream());
TaskId taskId = new TaskId(TaskCategory.COMPLETE_DATA_SET_REGISTRATION_IMPORT, currentUserService.getCurrentUser());
scheduler.executeTask(new ImportCompleteDataSetRegistrationsTask(registrationExchangeService, sessionFactory, tmpFile.getLeft(), tmpFile.getRight(), importOptions, format, taskId));
response.setHeader("Location", ContextUtils.getRootPath(request) + "/system/tasks/" + TaskCategory.COMPLETE_DATA_SET_REGISTRATION_IMPORT);
response.setStatus(HttpServletResponse.SC_ACCEPTED);
}
Aggregations