diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java index ebddca35be0..2a2503789cb 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java @@ -208,5 +208,10 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements public ValueSet resolveValueSet(FHIRPathEngine engine, Object appContext, String url) { return null; } + + @Override + public boolean paramIsType(String name, int index) { + return false; + } } } diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java index f379ee2cf0a..a6ac95966dc 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java @@ -196,6 +196,7 @@ import org.hl7.fhir.r5.utils.validation.constants.BindingKind; import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPolicy; import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy; import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.validation.instance.advisor.BasePolicyAdvisorForFullValidation; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Order; @@ -1075,6 +1076,18 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil public ReferenceValidationPolicy getReferencePolicy() { return ReferenceValidationPolicy.IGNORE; } + + @Override + public IValidationPolicyAdvisor getPolicyAdvisor() { + return new BasePolicyAdvisorForFullValidation(getReferencePolicy()); + } + + @Override + public IValidationPolicyAdvisor setPolicyAdvisor(IValidationPolicyAdvisor policyAdvisor) { + return null; + } + + } diff --git a/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/rules/config/MdmRuleValidatorTest.java b/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/rules/config/MdmRuleValidatorTest.java index a30d7dfc8bb..a3e4acb2fd1 100644 --- a/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/rules/config/MdmRuleValidatorTest.java +++ b/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/rules/config/MdmRuleValidatorTest.java @@ -76,7 +76,7 @@ public class MdmRuleValidatorTest extends BaseR4Test { try { setMdmRuleJson("bad-rules-bad-fhirpath.json"); fail(); } catch (ConfigurationException e) { - assertThat(e.getMessage()).startsWith(Msg.code(1518) + "MatchField [given-name] resourceType [Patient] has failed FHIRPath evaluation. Error in ?? at 1, 1: The name blurst is not a valid function name"); + assertThat(e.getMessage()).startsWith(Msg.code(1518) + "MatchField [given-name] resourceType [Patient] has failed FHIRPath evaluation. Error @1, 1: The name blurst is not a valid function name"); } } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorPolicyAdvisor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorPolicyAdvisor.java index 7c6f7204e7a..691fb12af91 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorPolicyAdvisor.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorPolicyAdvisor.java @@ -31,6 +31,7 @@ import org.hl7.fhir.r5.utils.validation.constants.BindingKind; import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPolicy; import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy; import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.validation.instance.advisor.BasePolicyAdvisorForFullValidation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -123,6 +124,16 @@ public class ValidatorPolicyAdvisor implements IValidationPolicyAdvisor { return false; } + @Override + public IValidationPolicyAdvisor getPolicyAdvisor() { + return new BasePolicyAdvisorForFullValidation(getReferencePolicy()); + } + + @Override + public IValidationPolicyAdvisor setPolicyAdvisor(IValidationPolicyAdvisor policyAdvisor) { + return null; + } + @Override public ReferenceValidationPolicy getReferencePolicy() { return ReferenceValidationPolicy.IGNORE; diff --git a/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcherTest.java b/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcherTest.java index fb0d9c4ab5c..b8dd6956360 100644 --- a/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcherTest.java +++ b/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcherTest.java @@ -15,6 +15,7 @@ import org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContex import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r5.elementmodel.Element; import org.hl7.fhir.r5.utils.XVerExtensionManager; +import org.hl7.fhir.r5.utils.validation.ValidatorSession; import org.hl7.fhir.validation.instance.InstanceValidator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -56,7 +57,7 @@ public class ValidatorResourceFetcherTest extends BaseTest { InstanceValidator v = new InstanceValidator( wrappedWorkerContext, new FhirInstanceValidator.NullEvaluationContext(), - new XVerExtensionManager(null)); + new XVerExtensionManager(null), new ValidatorSession()); RequestDetails r = new SystemRequestDetails(); // test Element returnedResource = fetcher.fetch(v, r,"http://www.test-url-for-questionnaire.com/Questionnaire/test-id|1.0.0"); diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java index 436338c8443..11ab5d25c15 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java @@ -40,6 +40,7 @@ import org.hl7.fhir.utilities.validation.ValidationOptions; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -449,6 +450,29 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext return retVal; } + public List fetchResourcesByType(Class theClass) { + List res = new ArrayList<>(); + if (theClass == StructureDefinition.class) { + res.addAll((Collection) getStructures()); + } + return res; + } + + public T fetchResource(Class class_, String uri, Resource source) { + return fetchResource(class_, uri); + } + + @Override + public List fetchTypeDefinitions(String n) { + List types = new ArrayList<>(); + for (StructureDefinition sd : allStructures()) { + if (n.equals(sd.getTypeTail())) { + types.add(sd); + } + } + return types; + } + @Override public org.hl7.fhir.r4.model.Resource fetchResourceById(String theType, String theUri) { throw new UnsupportedOperationException(Msg.code(282)); diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/fluentpath/FhirPathR4.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/fluentpath/FhirPathR4.java index 2c04412d4b8..e7fd0f36fe5 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/fluentpath/FhirPathR4.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/fluentpath/FhirPathR4.java @@ -158,6 +158,11 @@ public class FhirPathR4 implements IFhirPath { public ValueSet resolveValueSet(FHIRPathEngine engine, Object appContext, String url) { return null; } + + @Override + public boolean paramIsType(String name, int index) { + return false; + } }); } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirDefaultPolicyAdvisor.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirDefaultPolicyAdvisor.java index 83e97cf9572..6026de3cd63 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirDefaultPolicyAdvisor.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/FhirDefaultPolicyAdvisor.java @@ -11,6 +11,7 @@ import org.hl7.fhir.r5.utils.validation.constants.BindingKind; import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPolicy; import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy; import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.validation.instance.advisor.BasePolicyAdvisorForFullValidation; import java.util.Arrays; import java.util.EnumSet; @@ -91,6 +92,16 @@ public class FhirDefaultPolicyAdvisor implements IValidationPolicyAdvisor { return false; } + @Override + public IValidationPolicyAdvisor getPolicyAdvisor() { + return new BasePolicyAdvisorForFullValidation(getReferencePolicy()); + } + + @Override + public IValidationPolicyAdvisor setPolicyAdvisor(IValidationPolicyAdvisor policyAdvisor) { + return null; + } + @Override public ReferenceValidationPolicy getReferencePolicy() { return ReferenceValidationPolicy.IGNORE; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java index ac383cc3ca7..37af069ff4f 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/ValidatorWrapper.java @@ -19,6 +19,7 @@ import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.utils.XVerExtensionManager; import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor; import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher; +import org.hl7.fhir.r5.utils.validation.ValidatorSession; import org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel; import org.hl7.fhir.r5.utils.validation.constants.IdStatus; import org.hl7.fhir.utilities.i18n.I18nConstants; @@ -119,7 +120,7 @@ class ValidatorWrapper { FHIRPathEngine.IEvaluationContext evaluationCtx = new FhirInstanceValidator.NullEvaluationContext(); XVerExtensionManager xverManager = new XVerExtensionManager(theWorkerContext); try { - v = new InstanceValidator(theWorkerContext, evaluationCtx, xverManager); + v = new InstanceValidator(theWorkerContext, evaluationCtx, xverManager, new ValidatorSession()); } catch (Exception e) { throw new ConfigurationException(Msg.code(648) + e.getMessage(), e); } diff --git a/pom.xml b/pom.xml index 9b19056b43d..9ef5c44ced1 100644 --- a/pom.xml +++ b/pom.xml @@ -967,7 +967,7 @@ - 6.4.0 + 6.4.4 2.41.1 -Dfile.encoding=UTF-8 -Xmx2048m