Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing concurrency issue in VersionSpecificWorkerContextWrapper (#6554) #6648

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import ca.uhn.fhir.context.support.ConceptValidationOptions;
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.IValidationSupport.BaseConceptProperty;
import ca.uhn.fhir.context.support.IValidationSupport.CodeValidationIssue;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
Expand Down Expand Up @@ -817,6 +819,7 @@ private IValidationSupport.CodeValidationResult validateCodeInValueSet(
final boolean valueSetResultContainsInvalidDisplay = result.getIssues().stream()
.anyMatch(VersionSpecificWorkerContextWrapper::hasInvalidDisplayDetailCode);
if (codeSystemResult != null) {
result = copyCodeValidationResult(result);
for (IValidationSupport.CodeValidationIssue codeValidationIssue : codeSystemResult.getIssues()) {
/* Value set validation should already have checked the display name. If we get INVALID_DISPLAY
issues from code system validation, they will only repeat what was already caught.
Expand All @@ -830,6 +833,33 @@ private IValidationSupport.CodeValidationResult validateCodeInValueSet(
return result;
}

private IValidationSupport.CodeValidationResult copyCodeValidationResult(
IValidationSupport.CodeValidationResult toCopy) {
IValidationSupport.CodeValidationResult result = new IValidationSupport.CodeValidationResult();

List<CodeValidationIssue> issues = toCopy.getIssues();
List<BaseConceptProperty> properties = toCopy.getProperties();

result.setCode(toCopy.getCode())
.setCodeSystemName(toCopy.getCodeSystemName())
.setCodeSystemVersion(toCopy.getCodeSystemVersion())
.setDisplay(toCopy.getDisplay())
.setIssues(copyList(issues))
.setMessage(toCopy.getMessage())
.setSeverity(toCopy.getSeverity())
.setSourceDetails(toCopy.getSourceDetails())
.setProperties(copyList(properties));
return result;
}

private <T> List<T> copyList(List<T> issues) {
if (issues == null) {
return null;
} else {
return new ArrayList<>(issues);
}
}

private static boolean hasInvalidDisplayDetailCode(IValidationSupport.CodeValidationIssue theIssue) {
return theIssue.hasIssueDetailCode(INVALID_DISPLAY.getCode());
}
Expand Down
Loading