From 335800c9321d1120bed009d626aa0ff681461586 Mon Sep 17 00:00:00 2001 From: Lloyd McKenzie Date: Sun, 13 Mar 2022 20:56:40 -0600 Subject: [PATCH] Replaced hard-coded extension reference with constant value --- .../src/org/hl7/fhir/core/generator/analysis/Analyser.java | 4 ++-- .../hl7/fhir/core/generator/codegen/JavaBaseGenerator.java | 4 ++-- .../org/hl7/fhir/validation/instance/InstanceValidator.java | 2 +- .../instance/type/StructureDefinitionValidator.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/analysis/Analyser.java b/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/analysis/Analyser.java index 732f9ed8a..37a64b79a 100644 --- a/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/analysis/Analyser.java +++ b/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/analysis/Analyser.java @@ -249,8 +249,8 @@ public class Analyser { } protected String getTypename(TypeRefComponent type) throws Exception { - if (type.hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")) { - return type.getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"); + if (type.hasExtension(ToolingExtensions.EXT_FHIR_TYPE)) { + return type.getExtensionString(ToolingExtensions.EXT_FHIR_TYPE); } else { return getTypeName(type.getCode()); } diff --git a/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/codegen/JavaBaseGenerator.java b/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/codegen/JavaBaseGenerator.java index e81bbb029..6ce0560dc 100644 --- a/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/codegen/JavaBaseGenerator.java +++ b/org.hl7.fhir.core.generator/src/org/hl7/fhir/core/generator/codegen/JavaBaseGenerator.java @@ -172,8 +172,8 @@ public class JavaBaseGenerator extends OutputStreamWriter { } protected String getTypename(TypeRefComponent type) throws Exception { - if (type.hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")) { - return type.getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"); + if (type.hasExtension(ToolingExtensions.EXT_FHIR_TYPE)) { + return type.getExtensionString(ToolingExtensions.EXT_FHIR_TYPE); } else { return getTypeName(type.getCode()); } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 54c748c7a..3e94b0f9d 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -1871,7 +1871,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat for (StructureDefinitionContextComponent ctxt : list) { res.add(ctxt.copy()); } - if ("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type".equals(extUrl)) { + if (ToolingExtensions.EXT_FHIR_TYPE.equals(extUrl)) { list.get(0).setExpression("ElementDefinition.type"); } // the history of this is a mess - see https://jira.hl7.org/browse/FHIR-13328 diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java index 0bbd1792a..a69ecaa9b 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/StructureDefinitionValidator.java @@ -133,8 +133,8 @@ public class StructureDefinitionValidator extends BaseValidator { typeMustSupport = true; } String tc = type.getChildValue("code"); - if (type.hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")) { - tc = type.getExtensionValue("http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type").primitiveValue(); + if (type.hasExtension(ToolingExtensions.EXT_FHIR_TYPE)) { + tc = type.getExtensionValue(ToolingExtensions.EXT_FHIR_TYPE).primitiveValue(); } if (Utilities.noString(tc) && type.hasChild("code")) { if (type.getNamedChild("code").hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type")) {