From 37128043537020d0ac885fa42a1baa63202c7e1c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 28 Apr 2022 09:47:06 +1000 Subject: [PATCH] fix problem with non-new data types on xver extensions --- .../fhir/r5/utils/XVerExtensionManager.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java index d78178566..05781182f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/XVerExtensionManager.java @@ -146,25 +146,27 @@ public class XVerExtensionManager { public void populateTypes(JsonObject path, ElementDefinition val, String verSource, String verTarget) { for (JsonElement i : path.getAsJsonArray("types")) { String s = i.getAsString(); - if (s.contains("(")) { - String t = s.substring(0, s.indexOf("(")); - TypeRefComponent tr = val.addType().setCode(translateDataType(verTarget, t)); - if (hasTargets(tr.getCode()) ) { - s = s.substring(t.length()+1); - for (String p : s.substring(0, s.length()-1).split("\\|")) { - if ("Any".equals(p)) { - tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource"); - } else if (p.contains(",")) { - for (String pp : p.split("\\,")) { - tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+pp); + if (!s.startsWith("!")) { + if (s.contains("(")) { + String t = s.substring(0, s.indexOf("(")); + TypeRefComponent tr = val.addType().setCode(translateDataType(verTarget, t)); + if (hasTargets(tr.getCode()) ) { + s = s.substring(t.length()+1); + for (String p : s.substring(0, s.length()-1).split("\\|")) { + if ("Any".equals(p)) { + tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource"); + } else if (p.contains(",")) { + for (String pp : p.split("\\,")) { + tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+pp); + } + } else { + tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p); } - } else { - tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p); } } + } else { + val.addType().setCode(translateDataType(verTarget, s)); } - } else { - val.addType().setCode(translateDataType(verTarget, s)); } } }