ACL acl = readACL(taskMetadata, action);
authorize(resultTask, action, acl);
}
if (ITaskWithState.class.isAssignableFrom(taskClass)) {
ITaskWithState taskWithState = (ITaskWithState) resultTask;
taskWithState.setState(taskState);
if (taskWithState.getState().equals(TaskState.FAILED)) {
requireParameter(failureCode, "failure code");
taskWithState.setFailureCode(failureCode);
taskWithState.setFailureReason(failureReason == null ? "" : failureReason);
} else {
forbidParameter(failureCode, "failure code");
forbidParameter(failureReason, "failure reason");
}
}