diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java index cd822b2eb74..9d4073343ec 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java @@ -953,7 +953,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { OperationOutcome oo = validateAndReturnOutcome(vs); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo)); - assertEquals("The code 123 is not valid in the system https://bb", oo.getIssue().get(0).getDiagnostics()); + assertEquals("The code '123' is not valid in the system https://bb", oo.getIssue().get(0).getDiagnostics()); } @Test diff --git a/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java b/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java index d588627aaa3..6db9bf07365 100644 --- a/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java +++ b/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java @@ -29,7 +29,7 @@ import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.r5.profilemodel.PEBuilder; -import org.hl7.fhir.r5.terminologies.ValueSetExpander; +import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome; import org.hl7.fhir.r5.utils.validation.IResourceValidator; import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier; import org.hl7.fhir.utilities.TimeTracker; @@ -163,7 +163,7 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(ValueSet theValueSet, boolean cacheOk, boolean heiarchical, boolean incompleteOk) { + public ValueSetExpansionOutcome expandVS(ValueSet theValueSet, boolean cacheOk, boolean heiarchical, boolean incompleteOk) { return null; } @@ -180,7 +180,7 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext severity = IssueSeverity.fromCode(result.getSeverityCode()); } ConceptDefinitionComponent definition = new ConceptDefinitionComponent().setCode(result.getCode()); - return new ValidationResult(severity, result.getMessage(), theSystem, definition, null, null); + return new ValidationResult(severity, result.getMessage(), theSystem, theVersion, definition, null, null); } @Override @@ -199,7 +199,7 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext ConceptDefinitionComponent definition = new ConceptDefinitionComponent(); definition.setCode(theCode); definition.setDisplay(outcome.getDisplay()); - return new ValidationResult(theSystem, definition, null); + return new ValidationResult(theSystem, theVersion, definition, null); } return new ValidationResult(IssueSeverity.ERROR, "Unknown code[" + theCode + "] in system[" + @@ -223,17 +223,17 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(ValueSet theSource, boolean theCacheOk, boolean theHierarchical) { + public ValueSetExpansionOutcome expandVS(ValueSet theSource, boolean theCacheOk, boolean theHierarchical) { throw new UnsupportedOperationException(Msg.code(2128)); } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(ConceptSetComponent theInc, boolean theHierarchical, boolean theNoInactive) throws TerminologyServiceException { + public ValueSetExpansionOutcome expandVS(ConceptSetComponent theInc, boolean theHierarchical, boolean theNoInactive) throws TerminologyServiceException { ValueSet input = new ValueSet(); input.getCompose().setInactive(!theNoInactive); //TODO GGG/DO is this valid? input.getCompose().addInclude(theInc); IValidationSupport.ValueSetExpansionOutcome output = myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), null, input); - return new ValueSetExpander.ValueSetExpansionOutcome((ValueSet) output.getValueSet(), output.getError(), null); + return new ValueSetExpansionOutcome((ValueSet) output.getValueSet(), output.getError(), null); } @Override @@ -368,7 +368,7 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(Resource src,ElementDefinitionBindingComponent theBinding, boolean theCacheOk, boolean theHierarchical) throws FHIRException { + public ValueSetExpansionOutcome expandVS(Resource src,ElementDefinitionBindingComponent theBinding, boolean theCacheOk, boolean theHierarchical) throws FHIRException { throw new UnsupportedOperationException(Msg.code(230)); } @@ -476,4 +476,15 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext public PEBuilder getProfiledElementBuilder(PEBuilder.PEElementPropertiesPolicy thePEElementPropertiesPolicy, boolean theB) { throw new UnsupportedOperationException(Msg.code(2261)); } + + @Override + public boolean isForPublication() { + return false; + } + + @Override + public void setForPublication(boolean b) { + throw new UnsupportedOperationException(Msg.code(2350)); + + } } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java index 6ec2eaca6b4..76685eb2ea6 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java @@ -27,7 +27,9 @@ import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.profilemodel.PEBuilder; -import org.hl7.fhir.r5.terminologies.ValueSetExpander; + +import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome; +import org.hl7.fhir.r5.terminologies.utilities.TerminologyServiceErrorClass; import org.hl7.fhir.r5.utils.validation.IResourceValidator; import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier; import org.hl7.fhir.utilities.TimeTracker; @@ -239,15 +241,16 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo if (theResult != null) { String code = theResult.getCode(); String display = theResult.getDisplay(); + String issueSeverity = theResult.getSeverityCode(); String message = theResult.getMessage(); if (isNotBlank(code)) { - retVal = new ValidationResult(theSystem, new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent() + retVal = new ValidationResult(theSystem, null, new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent() .setCode(code) .setDisplay(display), null); } else if (isNotBlank(issueSeverity)) { - retVal = new ValidationResult(ValidationMessage.IssueSeverity.fromCode(issueSeverity), message, ValueSetExpander.TerminologyServiceErrorClass.UNKNOWN, null); + retVal = new ValidationResult(ValidationMessage.IssueSeverity.fromCode(issueSeverity), message, TerminologyServiceErrorClass.UNKNOWN, null); } } @@ -260,7 +263,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(org.hl7.fhir.r5.model.ValueSet source, boolean cacheOk, boolean Hierarchical) { + public ValueSetExpansionOutcome expandVS(org.hl7.fhir.r5.model.ValueSet source, boolean cacheOk, boolean Hierarchical) { IBaseResource convertedSource; try { convertedSource = myVersionCanonicalizer.valueSetFromValidatorCanonical(source); @@ -279,18 +282,18 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo } String error = expanded.getError(); - ValueSetExpander.TerminologyServiceErrorClass result = null; + TerminologyServiceErrorClass result = null; - return new ValueSetExpander.ValueSetExpansionOutcome(convertedResult, error, result); + return new ValueSetExpansionOutcome(convertedResult, error, result); } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(Resource src, org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent binding, boolean cacheOk, boolean Hierarchical) { + public ValueSetExpansionOutcome expandVS(Resource src, org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent binding, boolean cacheOk, boolean Hierarchical) { throw new UnsupportedOperationException(Msg.code(663)); } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(ValueSet.ConceptSetComponent inc, boolean hierarchical, boolean noInactive) throws TerminologyServiceException { + public ValueSetExpansionOutcome expandVS(ValueSet.ConceptSetComponent inc, boolean hierarchical, boolean noInactive) throws TerminologyServiceException { throw new UnsupportedOperationException(Msg.code(664)); } @@ -464,7 +467,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo } @Override - public ValueSetExpander.ValueSetExpansionOutcome expandVS(ValueSet source, boolean cacheOk, boolean heiarchical, boolean incompleteOk) { + public ValueSetExpansionOutcome expandVS(ValueSet source, boolean cacheOk, boolean heiarchical, boolean incompleteOk) { return null; } @@ -643,6 +646,17 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo VersionCanonicalizer versionCanonicalizer = new VersionCanonicalizer(theValidationSupport.getFhirContext()); return new VersionSpecificWorkerContextWrapper(new ValidationSupportContext(theValidationSupport), versionCanonicalizer); } + + @Override + public boolean isForPublication() { + return false; + } + + @Override + public void setForPublication(boolean b) { + throw new UnsupportedOperationException(Msg.code(2351)); + + } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java index 9db9746737c..ce52adea40d 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java @@ -980,7 +980,7 @@ public class FhirInstanceValidatorDstu3Test { ourLog.info(output.getMessages().get(0).getLocationString()); ourLog.info(output.getMessages().get(0).getMessage()); assertEquals("/f:Patient", output.getMessages().get(0).getLocationString()); - assertEquals("Undefined element 'foo'", output.getMessages().get(0).getMessage()); + assertEquals("Undefined element 'foo' at /f:Patient", output.getMessages().get(0).getMessage()); } @Test diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index 39ee6c6793f..df0c1fbafe5 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -1040,7 +1040,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest { ourLog.info(output.getMessages().get(0).getLocationString()); ourLog.info(output.getMessages().get(0).getMessage()); assertEquals("/f:Patient", output.getMessages().get(0).getLocationString()); - assertEquals("Undefined element 'foo'", output.getMessages().get(0).getMessage()); + assertEquals("Undefined element 'foo' at /f:Patient", output.getMessages().get(0).getMessage()); assertEquals(28, output.getMessages().get(0).getLocationCol().intValue()); assertEquals(4, output.getMessages().get(0).getLocationLine().intValue()); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4b/validation/FhirInstanceValidatorR4BTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4b/validation/FhirInstanceValidatorR4BTest.java index 0acd25a0ffd..cb935d72f75 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4b/validation/FhirInstanceValidatorR4BTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4b/validation/FhirInstanceValidatorR4BTest.java @@ -985,7 +985,7 @@ public class FhirInstanceValidatorR4BTest extends BaseTest { ourLog.info(output.getMessages().get(0).getLocationString()); ourLog.info(output.getMessages().get(0).getMessage()); assertEquals("/f:Patient", output.getMessages().get(0).getLocationString()); - assertEquals("Undefined element 'foo'", output.getMessages().get(0).getMessage()); + assertEquals("Undefined element 'foo' at /f:Patient", output.getMessages().get(0).getMessage()); assertEquals(28, output.getMessages().get(0).getLocationCol().intValue()); assertEquals(4, output.getMessages().get(0).getLocationLine().intValue()); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java index a1eeede3aba..e41debcbcff 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java @@ -42,8 +42,8 @@ import org.hl7.fhir.r5.model.StringType; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent; -import org.hl7.fhir.r5.terminologies.ValueSetExpander; -import org.hl7.fhir.r5.utils.validation.IResourceValidator; +import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpander;; +import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome; import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor; import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher; import org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel; @@ -150,7 +150,7 @@ public class FhirInstanceValidatorR5Test { ValueSet valueset = new ValueSet(); valueset.setExpansion(retVal); - return new ValueSetExpander.ValueSetExpansionOutcome(valueset); + return new ValueSetExpansionOutcome(valueset); }); when(myMockSupport.isCodeSystemSupported(any(), nullable(String.class))).thenAnswer(new Answer() { @Override @@ -624,7 +624,7 @@ public class FhirInstanceValidatorR5Test { ourLog.info(output.getMessages().get(0).getLocationString()); ourLog.info(output.getMessages().get(0).getMessage()); assertEquals("/f:Patient", output.getMessages().get(0).getLocationString()); - assertEquals("Undefined element 'foo'", output.getMessages().get(0).getMessage()); + assertEquals("Undefined element 'foo' at /f:Patient", output.getMessages().get(0).getMessage()); } @Test diff --git a/pom.xml b/pom.xml index e2d82d70664..7370c9e2baf 100644 --- a/pom.xml +++ b/pom.xml @@ -893,7 +893,7 @@ - 6.0.1 + 6.0.10 1.0.3 -Dfile.encoding=UTF-8 -Xmx2048m