ensureNotNull("Cannot find task with id " + taskId, "task", task);
TaskDefinition taskDefinition = task.getTaskDefinition();
if(taskDefinition != null) {
TaskFormHandler taskFormHandler = taskDefinition.getTaskFormHandler();
taskFormHandler.submitFormVariables(properties, task);
}
// complete or resolve the task
if (DelegationState.PENDING.equals(task.getDelegationState())) {
task.resolve();