@RequestParam(value="deleteReason", required=false) String deleteReason, HttpServletResponse response) {
Task taskToDelete = getTaskFromRequest(taskId);
if (taskToDelete.getExecutionId() != null) {
// Can't delete a task that is part of a process instance
throw new ActivitiForbiddenException("Cannot delete a task that is part of a process-instance.");
}
if (cascadeHistory != null) {
// Ignore delete-reason since the task-history (where the reason is recorded) will be deleted anyway
taskService.deleteTask(taskToDelete.getId(), cascadeHistory);