Add missing methods 2

This commit is contained in:
dotasek 2024-02-02 11:22:15 -05:00 committed by dotasek.dev
parent ed0c388bbf
commit 330249b74e
6 changed files with 86 additions and 21 deletions

View File

@ -210,6 +210,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import jakarta.persistence.EntityManager;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@ -963,12 +964,39 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil
}
@Override
public CodedContentValidationPolicy policyForCodedContent(IResourceValidator iResourceValidator, Object o, String s, ElementDefinition elementDefinition, org.hl7.fhir.r5.model.StructureDefinition structureDefinition, BindingKind bindingKind, org.hl7.fhir.r5.model.ValueSet valueSet, List<String> list) {
return CodedContentValidationPolicy.CODE;
public EnumSet<ResourceValidationAction> policyForResource(IResourceValidator validator, Object appContext,
org.hl7.fhir.r5.model.StructureDefinition type, String path) {
return EnumSet.allOf(ResourceValidationAction.class);
}
@Override
public ContainedReferenceValidationPolicy policyForContained(IResourceValidator validator, Object appContext, String containerType, String containerId, Element.SpecialElement containingResourceType, String path, String url) {
public EnumSet<ElementValidationAction> policyForElement(IResourceValidator validator, Object appContext,
org.hl7.fhir.r5.model.StructureDefinition structure, ElementDefinition element, String path) {
return EnumSet.allOf(ElementValidationAction.class);
}
@Override
public EnumSet<CodedContentValidationAction> policyForCodedContent(IResourceValidator validator,
Object appContext,
String stackPath,
ElementDefinition definition,
org.hl7.fhir.r5.model.StructureDefinition structure,
BindingKind kind,
AdditionalBindingPurpose purpose,
org.hl7.fhir.r5.model.ValueSet valueSet,
List<String> systems) {
return EnumSet.allOf(CodedContentValidationAction.class);
}
@Override
public ContainedReferenceValidationPolicy policyForContained(IResourceValidator validator,
Object appContext,
org.hl7.fhir.r5.model.StructureDefinition structure,
ElementDefinition element,
String containerType,
String containerId,
Element.SpecialElement containingResourceType,
String path,
String url) {
return ContainedReferenceValidationPolicy.CHECK_VALID;
}
}

View File

@ -27,13 +27,13 @@ import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor;
import org.hl7.fhir.r5.utils.validation.constants.BindingKind;
import org.hl7.fhir.r5.utils.validation.constants.CodedContentValidationPolicy;
import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPolicy;
import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.EnumSet;
import java.util.List;
public class ValidatorPolicyAdvisor implements IValidationPolicyAdvisor {
@ -58,22 +58,41 @@ public class ValidatorPolicyAdvisor implements IValidationPolicyAdvisor {
}
@Override
public CodedContentValidationPolicy policyForCodedContent(
IResourceValidator iResourceValidator,
Object o,
String s,
ElementDefinition elementDefinition,
StructureDefinition structureDefinition,
BindingKind bindingKind,
public EnumSet<ResourceValidationAction> policyForResource(
IResourceValidator validator, Object appContext, StructureDefinition type, String path) {
return EnumSet.allOf(ResourceValidationAction.class);
}
@Override
public EnumSet<ElementValidationAction> policyForElement(
IResourceValidator validator,
Object appContext,
StructureDefinition structure,
ElementDefinition element,
String path) {
return EnumSet.allOf(ElementValidationAction.class);
}
@Override
public EnumSet<CodedContentValidationAction> policyForCodedContent(
IResourceValidator validator,
Object appContext,
String stackPath,
ElementDefinition definition,
StructureDefinition structure,
BindingKind kind,
AdditionalBindingPurpose purpose,
ValueSet valueSet,
List<String> list) {
return CodedContentValidationPolicy.CODE;
List<String> systems) {
return EnumSet.allOf(CodedContentValidationAction.class);
}
@Override
public ContainedReferenceValidationPolicy policyForContained(
IResourceValidator validator,
Object appContext,
StructureDefinition structure,
ElementDefinition element,
String containerType,
String containerId,
Element.SpecialElement containingResourceType,

View File

@ -7,10 +7,10 @@ import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor;
import org.hl7.fhir.r5.utils.validation.constants.BindingKind;
import org.hl7.fhir.r5.utils.validation.constants.CodedContentValidationPolicy;
import org.hl7.fhir.r5.utils.validation.constants.ContainedReferenceValidationPolicy;
import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy;
import java.util.EnumSet;
import java.util.List;
/**
@ -25,10 +25,28 @@ public class FhirDefaultPolicyAdvisor implements IValidationPolicyAdvisor {
return ReferenceValidationPolicy.IGNORE;
}
@Override
public EnumSet<ResourceValidationAction> policyForResource(
IResourceValidator validator, Object appContext, StructureDefinition type, String path) {
return EnumSet.allOf(ResourceValidationAction.class);
}
@Override
public EnumSet<ElementValidationAction> policyForElement(
IResourceValidator validator,
Object appContext,
StructureDefinition structure,
ElementDefinition element,
String path) {
return EnumSet.allOf(ElementValidationAction.class);
}
@Override
public ContainedReferenceValidationPolicy policyForContained(
IResourceValidator validator,
Object appContext,
StructureDefinition structure,
ElementDefinition element,
String containerType,
String containerId,
Element.SpecialElement containingResourceType,
@ -38,15 +56,16 @@ public class FhirDefaultPolicyAdvisor implements IValidationPolicyAdvisor {
}
@Override
public CodedContentValidationPolicy policyForCodedContent(
public EnumSet<CodedContentValidationAction> policyForCodedContent(
IResourceValidator validator,
Object appContext,
String stackPath,
ElementDefinition definition,
StructureDefinition structure,
BindingKind kind,
AdditionalBindingPurpose purpose,
ValueSet valueSet,
List<String> systems) {
return CodedContentValidationPolicy.CODE;
return EnumSet.allOf(CodedContentValidationAction.class);
}
}

View File

@ -223,7 +223,6 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
setExpansionProfile(expParameters);
}
public void setExpansionProfile(org.hl7.fhir.r5.model.Parameters expParameters) {
myExpansionProfile = expParameters;
}

View File

@ -1533,13 +1533,13 @@ public class FhirInstanceValidatorR4Test extends BaseValidationTestWithInlineMoc
IValidationPolicyAdvisor policyAdvisor = mock(IValidationPolicyAdvisor.class);
when(policyAdvisor.policyForReference(any(), any(), any(), any())).thenReturn(ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
when(policyAdvisor.policyForContained(any(), any(), any(), any(), any(), any(), any())).thenReturn(ContainedReferenceValidationPolicy.CHECK_TYPE);
when(policyAdvisor.policyForContained(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(ContainedReferenceValidationPolicy.CHECK_TYPE);
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
myInstanceVal.setValidatorPolicyAdvisor(policyAdvisor);
myFhirValidator.validateWithResult(encoded);
verify(resourceFetcher, times(12)).resolveURL(any(), any(), anyString(), anyString(), anyString(), anyBoolean());
verify(policyAdvisor, times(12)).policyForContained(any(), any(), any(), any(), any(), any(), any());
verify(policyAdvisor, times(12)).policyForContained(any(), any(), any(), any(), any(), any(), any(), any(), any());
}
@Test

View File

@ -1417,13 +1417,13 @@ public class FhirInstanceValidatorR4BTest extends BaseValidationTestWithInlineMo
IValidationPolicyAdvisor policyAdvisor = mock(IValidationPolicyAdvisor.class);
when(policyAdvisor.policyForReference(any(), any(), any(), any())).thenReturn(ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
when(policyAdvisor.policyForContained(any(), any(), any(), any(), any(), any(), any())).thenReturn(ContainedReferenceValidationPolicy.CHECK_TYPE);
when(policyAdvisor.policyForContained(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(ContainedReferenceValidationPolicy.CHECK_TYPE);
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
myInstanceVal.setValidatorPolicyAdvisor(policyAdvisor);
myFhirValidator.validateWithResult(encoded);
verify(resourceFetcher, times(12)).resolveURL(any(), any(), anyString(), anyString(), anyString(), anyBoolean());
verify(policyAdvisor, times(12)).policyForContained(any(), any(), any(), any(), any(), any(), any());
verify(policyAdvisor, times(12)).policyForContained(any(), any(), any(), any(), any(), any(), any(), any(), any());
}
@Test