From 15fda25771ff22fa34ed7f0a6fff3acc613db70c Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Wed, 27 Mar 2019 17:35:01 +0100 Subject: [PATCH] added fetchValueSet to IValidationSupport and made it public to enable overwriting it in subclasses --- .../DefaultProfileValidationSupport.java | 5 ++-- .../hapi/validation/IValidationSupport.java | 20 +++++++++---- .../ctx/DefaultProfileValidationSupport.java | 5 ++-- .../dstu3/hapi/ctx/IValidationSupport.java | 28 +++++++++++++------ .../ctx/DefaultProfileValidationSupport.java | 5 ++-- .../fhir/r4/hapi/ctx/IValidationSupport.java | 20 +++++++++---- 6 files changed, 58 insertions(+), 25 deletions(-) diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/DefaultProfileValidationSupport.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/DefaultProfileValidationSupport.java index cefd590c2cc..68723c53338 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/DefaultProfileValidationSupport.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/DefaultProfileValidationSupport.java @@ -139,8 +139,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport { return provideStructureDefinitionMap(theContext).get(theUrl); } - ValueSet fetchValueSet(FhirContext theContext, String theSystem) { - return (ValueSet) fetchCodeSystemOrValueSet(theContext, theSystem, false); + @Override + public ValueSet fetchValueSet(FhirContext theContext, String uri) { + return (ValueSet) fetchCodeSystemOrValueSet(theContext, uri, false); } public void flush() { diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/IValidationSupport.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/IValidationSupport.java index a5ab02d2ea3..3af08eb3b0b 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/IValidationSupport.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/IValidationSupport.java @@ -4,6 +4,7 @@ import java.util.List; import org.hl7.fhir.dstu2016may.model.CodeSystem; 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.dstu2016may.model.StructureDefinition; import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent; @@ -33,14 +34,23 @@ public interface IValidationSupport List fetchAllStructureDefinitions(FhirContext theContext); /** - * Fetch a code system by ID - * - * @param theSystem - * The code system + * Fetch a code system by Uri + * + * @param uri + * Canonical Uri of the code system * @return The valueset (must not be null, but can be an empty ValueSet) */ @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 diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/DefaultProfileValidationSupport.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/DefaultProfileValidationSupport.java index 446c10f117f..406ecd67218 100644 --- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/DefaultProfileValidationSupport.java +++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/DefaultProfileValidationSupport.java @@ -155,8 +155,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport { return retVal; } - ValueSet fetchValueSet(FhirContext theContext, String theSystem) { - return (ValueSet) fetchCodeSystemOrValueSet(theContext, theSystem, false); + @Override + public ValueSet fetchValueSet(FhirContext theContext, String uri) { + return (ValueSet) fetchCodeSystemOrValueSet(theContext, uri, false); } public void flush() { diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/IValidationSupport.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/IValidationSupport.java index 222a1bfdd70..0cb23892bfc 100644 --- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/IValidationSupport.java +++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/IValidationSupport.java @@ -5,6 +5,7 @@ import java.util.List; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; 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.ValueSetExpansionComponent; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -32,15 +33,24 @@ public interface IValidationSupport @Override List fetchAllStructureDefinitions(FhirContext theContext); - /** - * Fetch a code system by ID - * - * @param theSystem - * The code system - * @return The valueset (must not be null, but can be an empty ValueSet) - */ - @Override - CodeSystem fetchCodeSystem(FhirContext theContext, String theSystem); + /** + * Fetch a code system by Uri + * + * @param uri + * Canonical Uri of the code system + * @return The valueset (must not be null, but can be an empty ValueSet) + */ + @Override + 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 diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/DefaultProfileValidationSupport.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/DefaultProfileValidationSupport.java index b013796c26c..f50726b5613 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/DefaultProfileValidationSupport.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/DefaultProfileValidationSupport.java @@ -158,8 +158,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport { return provideStructureDefinitionMap(theContext).get(url); } - ValueSet fetchValueSet(FhirContext theContext, String theSystem) { - return (ValueSet) fetchCodeSystemOrValueSet(theContext, theSystem, false); + @Override + public ValueSet fetchValueSet(FhirContext theContext, String uri) { + return (ValueSet) fetchCodeSystemOrValueSet(theContext, uri, false); } public void flush() { diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/IValidationSupport.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/IValidationSupport.java index 08fcc8e83e2..d0c31bddec2 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/IValidationSupport.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/IValidationSupport.java @@ -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.ConceptDefinitionComponent; 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.terminologies.ValueSetExpander; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; @@ -32,14 +33,23 @@ public interface IValidationSupport List fetchAllStructureDefinitions(FhirContext theContext); /** - * Fetch a code system by ID + * Fetch a code system by Uri * - * @param theSystem - * The code system - * @return The valueset (must not be null, but can be an empty ValueSet) + * @param uri + * Canonical Uri of the code system + * @return The valueset (must not be null, but can be an empty ValueSet) */ @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