added fetchValueSet to IValidationSupport and made it public to enable overwriting it in subclasses

This commit is contained in:
patrick-werner 2019-03-27 17:35:01 +01:00
parent e85bec2858
commit 15fda25771
6 changed files with 58 additions and 25 deletions

View File

@ -139,8 +139,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return provideStructureDefinitionMap(theContext).get(theUrl); return provideStructureDefinitionMap(theContext).get(theUrl);
} }
ValueSet fetchValueSet(FhirContext theContext, String theSystem) { @Override
return (ValueSet) fetchCodeSystemOrValueSet(theContext, theSystem, false); public ValueSet fetchValueSet(FhirContext theContext, String uri) {
return (ValueSet) fetchCodeSystemOrValueSet(theContext, uri, false);
} }
public void flush() { public void flush() {

View File

@ -4,6 +4,7 @@ import java.util.List;
import org.hl7.fhir.dstu2016may.model.CodeSystem; import org.hl7.fhir.dstu2016may.model.CodeSystem;
import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.dstu2016may.model.StructureDefinition; import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent;
@ -33,14 +34,23 @@ public interface IValidationSupport
List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext); List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext);
/** /**
* Fetch a code system by ID * Fetch a code system by Uri
* *
* @param theSystem * @param uri
* The code system * Canonical Uri of the code system
* @return The valueset (must not be null, but can be an empty ValueSet) * @return The valueset (must not be null, but can be an empty ValueSet)
*/ */
@Override @Override
CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem); CodeSystem fetchCodeSystem(FhirContext theContext, String uri);
/**
* Fetch a valueset by Uri
*
* @param uri
* Canonical Uri of the ValueSet
* @return The valueset (must not be null, but can be an empty ValueSet)
*/
ValueSet fetchValueSet(FhirContext theContext, String uri);
/** /**
* Loads a resource needed by the validation (a StructureDefinition, or a * Loads a resource needed by the validation (a StructureDefinition, or a

View File

@ -155,8 +155,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return retVal; return retVal;
} }
ValueSet fetchValueSet(FhirContext theContext, String theSystem) { @Override
return (ValueSet) fetchCodeSystemOrValueSet(theContext, theSystem, false); public ValueSet fetchValueSet(FhirContext theContext, String uri) {
return (ValueSet) fetchCodeSystemOrValueSet(theContext, uri, false);
} }
public void flush() { public void flush() {

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.StructureDefinition; import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent; import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
@ -32,15 +33,24 @@ public interface IValidationSupport
@Override @Override
List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext); List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext);
/** /**
* Fetch a code system by ID * Fetch a code system by Uri
* *
* @param theSystem * @param uri
* The code system * Canonical Uri of the code system
* @return The valueset (must not be null, but can be an empty ValueSet) * @return The valueset (must not be null, but can be an empty ValueSet)
*/ */
@Override @Override
CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem); CodeSystem fetchCodeSystem(FhirContext theContext, String uri);
/**
* Fetch a valueset by Uri
*
* @param uri
* Canonical Uri of the ValueSet
* @return The valueset (must not be null, but can be an empty ValueSet)
*/
ValueSet fetchValueSet(FhirContext theContext, String uri);
/** /**
* Loads a resource needed by the validation (a StructureDefinition, or a * Loads a resource needed by the validation (a StructureDefinition, or a

View File

@ -158,8 +158,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return provideStructureDefinitionMap(theContext).get(url); return provideStructureDefinitionMap(theContext).get(url);
} }
ValueSet fetchValueSet(FhirContext theContext, String theSystem) { @Override
return (ValueSet) fetchCodeSystemOrValueSet(theContext, theSystem, false); public ValueSet fetchValueSet(FhirContext theContext, String uri) {
return (ValueSet) fetchCodeSystemOrValueSet(theContext, uri, false);
} }
public void flush() { public void flush() {

View File

@ -6,6 +6,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r4.model.StructureDefinition; import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r4.terminologies.ValueSetExpander; import org.hl7.fhir.r4.terminologies.ValueSetExpander;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
@ -32,14 +33,23 @@ public interface IValidationSupport
List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext); List<StructureDefinition> fetchAllStructureDefinitions(FhirContext theContext);
/** /**
* Fetch a code system by ID * Fetch a code system by Uri
* *
* @param theSystem * @param uri
* The code system * Canonical Uri of the code system
* @return The valueset (must not be null, but can be an empty ValueSet) * @return The valueset (must not be null, but can be an empty ValueSet)
*/ */
@Override @Override
CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem); CodeSystem fetchCodeSystem(FhirContext theContext, String uri);
/**
* Fetch a valueset by Uri
*
* @param uri
* Canonical Uri of the ValueSet
* @return The valueset (must not be null, but can be an empty ValueSet)
*/
ValueSet fetchValueSet(FhirContext theContext, String uri);
/** /**
* Loads a resource needed by the validation (a StructureDefinition, or a * Loads a resource needed by the validation (a StructureDefinition, or a