Task task;
try {
task = taskService.createTaskQuery().taskId(taskId).singleResult();
} catch (ActivitiException e) {
throw new NotFoundException("Activiti Task " + taskId, e);
}
TaskFormData formData;
try {
formData = formService.getTaskFormData(task.getId());
} catch (ActivitiException e) {
throw new NotFoundException("Form for Activiti Task " + taskId, e);
}
if (!adminUser.equals(username)) {
SyncopeUser user = userDAO.find(username);
if (user == null) {
throw new NotFoundException("Syncope User " + username);
}
}
return new DefaultMapEntry(task, formData);
}