From 8d2da0b701ecf3032978e6ee2fa604de719c7c5b Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 19 Dec 2019 10:50:54 +1100 Subject: [PATCH] fix broken links in IGs --- .../fhir/r5/conformance/ProfileUtilities.java | 14 ++++++++++---- .../org/hl7/fhir/r5/model/ElementDefinition.java | 2 +- .../org/hl7/fhir/utilities/VersionUtilities.java | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index a58e0d4d3..714295bfe 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -97,6 +97,7 @@ import org.hl7.fhir.r5.utils.formats.XLSXWriter; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.TerminologyServiceOptions; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.validation.ValidationOptions; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.Source; @@ -421,8 +422,9 @@ public class ProfileUtilities extends TranslatingUtilities { break; } } - if (!found) + if (!found) { derived.getMapping().add(baseMap); + } } } @@ -2042,7 +2044,6 @@ public class ProfileUtilities extends TranslatingUtilities { // Before applying changes, apply them to what's in the profile - // TODO: follow Chris's rules - Done by Lloyd StructureDefinition profile = null; if (base.hasSliceName()) profile = base.getType().size() == 1 && base.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, base.getTypeFirstRep().getProfile().get(0).getValue()) : null; @@ -2336,6 +2337,11 @@ public class ProfileUtilities extends TranslatingUtilities { for (ElementDefinitionMappingComponent t : derived.getMapping()) t.setUserData(DERIVATION_EQUALS, true); } + for (ElementDefinitionMappingComponent m : base.getMapping()) { + if (m.hasMap()) { + m.setMap(m.getMap().trim()); + } + } // todo: constraints are cumulative. there is no replacing for (ElementDefinitionConstraintComponent s : base.getConstraint()) { @@ -3626,7 +3632,7 @@ public class ProfileUtilities extends TranslatingUtilities { erow.getSubRows().add(row); Cell c = gen.new Cell(); row.getCells().add(c); - c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+(context.getVersion().compareTo("4.0") > 0 ? "types-definitions.html#"+ed.getBase().getPath() : "element-definitions.html#"+ed.getBase().getPath())), t.getName(), null)); + c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+(VersionUtilities.isThisOrLater("4.1", context.getVersion()) ? "types-definitions.html#"+ed.getBase().getPath() : "element-definitions.html#"+ed.getBase().getPath())), t.getName(), null)); c = gen.new Cell(); row.getCells().add(c); c.addPiece(gen.new Piece(null, null, null)); @@ -3671,7 +3677,7 @@ public class ProfileUtilities extends TranslatingUtilities { Cell c = gen.new Cell(); row.getCells().add(c); - c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : (context.getVersion().compareTo("4.0") > 0 ? corePath+"types-definitions.html#"+ed.getBase().getPath() : corePath+"element-definitions.html#"+ed.getBase().getPath())), t.getName(), null)); + c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : (VersionUtilities.isThisOrLater("4.1", context.getVersion()) ? corePath+"types-definitions.html#"+ed.getBase().getPath() : corePath+"element-definitions.html#"+ed.getBase().getPath())), t.getName(), null)); c = gen.new Cell(); row.getCells().add(c); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java index 898a62f99..76bb5d83b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ElementDefinition.java @@ -2273,7 +2273,7 @@ public class ElementDefinition extends BackboneType implements ICompositeType { // added from java-adornments.txt: public boolean hasTarget() { - return Utilities.existsInList(getCode(), "Reference", "canonical"); + return Utilities.existsInList(getCode(), "Reference", "canonical", "CodeableReference"); } /** diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java index d7d14d4e6..158fc9cb9 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java @@ -154,4 +154,20 @@ public class VersionUtilities { return Utilities.isInteger(p[0]) && Utilities.isInteger(p[1]) && Utilities.isInteger(p[2]); } + /** + * return true if the current vresion equals test, or later + * + * so if a feature is defined in 4.0, if (VersionUtilities.isThisOrLater("4.0", version))... + * + * @param test + * @param current + * @return + */ + public static boolean isThisOrLater(String test, String current) { + String t = getMajMin(test); + String c = getMajMin(current); + boolean ok = c.compareTo(t) >= 0; + return ok; + } + }