Search in sources :

Example 1 with DataIntegrityTask

use of org.hisp.dhis.dataintegrity.tasks.DataIntegrityTask 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);
}
Also used : TaskId(org.hisp.dhis.scheduling.TaskId) DataIntegrityTask(org.hisp.dhis.dataintegrity.tasks.DataIntegrityTask) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DataIntegrityTask (org.hisp.dhis.dataintegrity.tasks.DataIntegrityTask)1 TaskId (org.hisp.dhis.scheduling.TaskId)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1