From 137506f37f585c49cd92f9b79e1d2289fc9600e4 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 2 Mar 2020 09:04:16 +1100 Subject: [PATCH] set id when parsing StructureMap --- .../hl7/fhir/dstu2016may/utils/StructureMapUtilities.java | 8 +++++++- .../org/hl7/fhir/dstu3/utils/StructureMapUtilities.java | 1 + .../java/org/hl7/fhir/r4/utils/StructureMapUtilities.java | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/StructureMapUtilities.java b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/StructureMapUtilities.java index c2e91026a..3682d7ec0 100644 --- a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/StructureMapUtilities.java +++ b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/StructureMapUtilities.java @@ -326,6 +326,7 @@ public class StructureMapUtilities { lexer.token("map"); StructureMap result = new StructureMap(); result.setUrl(lexer.readConstant("url")); + result.setId(tail(result.getUrl())); lexer.token("="); result.setName(lexer.readConstant("name")); lexer.skipComments(); @@ -344,10 +345,15 @@ public class StructureMapUtilities { parseGroup(result, lexer); } + return result; } - private void parseConceptMap(StructureMap result, FHIRLexer lexer) throws FHIRLexerException { + private String tail(String url) { + return url.substring(url.lastIndexOf("/")+1); + } + + private void parseConceptMap(StructureMap result, FHIRLexer lexer) throws FHIRLexerException { lexer.token("conceptmap"); ConceptMap map = new ConceptMap(); String id = lexer.readConstant("map id"); diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java index 627c928c4..8144f5752 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java @@ -655,6 +655,7 @@ public class StructureMapUtilities { lexer.token("map"); StructureMap result = new StructureMap(); result.setUrl(lexer.readConstant("url")); + result.setId(tail(result.getUrl())); lexer.token("="); result.setName(lexer.readConstant("name")); lexer.skipComments(); diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java index 47157315d..31f03b163 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java @@ -712,6 +712,7 @@ public class StructureMapUtilities { lexer.token("map"); StructureMap result = new StructureMap(); result.setUrl(lexer.readConstant("url")); + result.setId(tail(result.getUrl())); lexer.token("="); result.setName(lexer.readConstant("name")); lexer.skipComments();