This commit is contained in:
dotasek 2024-11-27 08:05:19 -05:00 committed by GitHub
commit 574c52fde6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 75 additions and 4 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}

View File

@ -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");
}
}

View File

@ -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;

View File

@ -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");

View File

@ -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 <T extends Resource> List<T> fetchResourcesByType(Class<T> theClass) {
List<T> res = new ArrayList<>();
if (theClass == StructureDefinition.class) {
res.addAll((Collection<? extends T>) getStructures());
}
return res;
}
public <T extends Resource> T fetchResource(Class<T> class_, String uri, Resource source) {
return fetchResource(class_, uri);
}
@Override
public List<StructureDefinition> fetchTypeDefinitions(String n) {
List<StructureDefinition> 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));

View File

@ -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;
}
});
}

View File

@ -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;

View File

@ -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);
}

View File

@ -967,7 +967,7 @@
</licenses>
<properties>
<fhir_core_version>6.4.0</fhir_core_version>
<fhir_core_version>6.4.4</fhir_core_version>
<spotless_version>2.41.1</spotless_version>
<surefire_jvm_args>-Dfile.encoding=UTF-8 -Xmx2048m</surefire_jvm_args>