From 6e4bbe60fee4c77583cfc0374849246829aa436c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:09:40 +1100 Subject: [PATCH 1/8] fix bug when converting positiveInt between versions --- .../convertors/VersionConvertor_10_40.java | 8 ++++---- .../convertors/VersionConvertor_10_50.java | 8 ++++---- .../convertors/VersionConvertor_14_30.java | 8 ++++---- .../convertors/VersionConvertor_14_40.java | 8 ++++---- .../convertors/VersionConvertor_14_50.java | 8 ++++---- .../convertors/VersionConvertor_30_50.java | 20 +++++++++---------- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java index 4db50132b..d4628df6e 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java @@ -2479,8 +2479,6 @@ public class VersionConvertor_10_40 { return convertId((org.hl7.fhir.dstu2.model.IdType) src); if (src instanceof org.hl7.fhir.dstu2.model.InstantType) return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu2.model.OidType) @@ -2493,6 +2491,8 @@ public class VersionConvertor_10_40 { return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2.model.UriType) return convertUri((org.hl7.fhir.dstu2.model.UriType) src); if (src instanceof org.hl7.fhir.dstu2.model.UuidType) @@ -2569,8 +2569,6 @@ public class VersionConvertor_10_40 { return convertId((org.hl7.fhir.r4.model.IdType) src); if (src instanceof org.hl7.fhir.r4.model.InstantType) return convertInstant((org.hl7.fhir.r4.model.InstantType) src); - if (src instanceof org.hl7.fhir.r4.model.IntegerType) - return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); if (src instanceof org.hl7.fhir.r4.model.MarkdownType) return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); if (src instanceof org.hl7.fhir.r4.model.OidType) @@ -2583,6 +2581,8 @@ public class VersionConvertor_10_40 { return convertTime((org.hl7.fhir.r4.model.TimeType) src); if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); if (src instanceof org.hl7.fhir.r4.model.UriType) return convertUri((org.hl7.fhir.r4.model.UriType) src); if (src instanceof org.hl7.fhir.r4.model.UuidType) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java index 3903d68bf..16f419902 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java @@ -2503,8 +2503,6 @@ public class VersionConvertor_10_50 { return convertId((org.hl7.fhir.dstu2.model.IdType) src); if (src instanceof org.hl7.fhir.dstu2.model.InstantType) return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu2.model.OidType) @@ -2517,6 +2515,8 @@ public class VersionConvertor_10_50 { return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2.model.UriType) return convertUri((org.hl7.fhir.dstu2.model.UriType) src); if (src instanceof org.hl7.fhir.dstu2.model.UuidType) @@ -2593,8 +2593,6 @@ public class VersionConvertor_10_50 { return convertId((org.hl7.fhir.r5.model.IdType) src); if (src instanceof org.hl7.fhir.r5.model.InstantType) return convertInstant((org.hl7.fhir.r5.model.InstantType) src); - if (src instanceof org.hl7.fhir.r5.model.IntegerType) - return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); if (src instanceof org.hl7.fhir.r5.model.MarkdownType) return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); if (src instanceof org.hl7.fhir.r5.model.OidType) @@ -2607,6 +2605,8 @@ public class VersionConvertor_10_50 { return convertTime((org.hl7.fhir.r5.model.TimeType) src); if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); if (src instanceof org.hl7.fhir.r5.model.UriType) return convertUri((org.hl7.fhir.r5.model.UriType) src); if (src instanceof org.hl7.fhir.r5.model.UuidType) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java index 02f5bf909..a6170f876 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java @@ -2454,8 +2454,6 @@ public class VersionConvertor_14_30 { return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) @@ -2468,6 +2466,8 @@ public class VersionConvertor_14_30 { return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) @@ -2544,8 +2544,6 @@ public class VersionConvertor_14_30 { return convertId((org.hl7.fhir.dstu3.model.IdType) src); if (src instanceof org.hl7.fhir.dstu3.model.InstantType) return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu3.model.OidType) @@ -2558,6 +2556,8 @@ public class VersionConvertor_14_30 { return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu3.model.UriType) return convertUri((org.hl7.fhir.dstu3.model.UriType) src); if (src instanceof org.hl7.fhir.dstu3.model.UuidType) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java index e90801926..96b92e16c 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java @@ -2607,8 +2607,6 @@ public class VersionConvertor_14_40 { return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) @@ -2621,6 +2619,8 @@ public class VersionConvertor_14_40 { return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) @@ -2695,8 +2695,6 @@ public class VersionConvertor_14_40 { return convertId((org.hl7.fhir.r4.model.IdType) src); if (src instanceof org.hl7.fhir.r4.model.InstantType) return convertInstant((org.hl7.fhir.r4.model.InstantType) src); - if (src instanceof org.hl7.fhir.r4.model.IntegerType) - return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); if (src instanceof org.hl7.fhir.r4.model.MarkdownType) return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); if (src instanceof org.hl7.fhir.r4.model.OidType) @@ -2709,6 +2707,8 @@ public class VersionConvertor_14_40 { return convertTime((org.hl7.fhir.r4.model.TimeType) src); if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); if (src instanceof org.hl7.fhir.r4.model.UriType) return convertUri((org.hl7.fhir.r4.model.UriType) src); if (src instanceof org.hl7.fhir.r4.model.UuidType) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java index 878f56233..d0ad44110 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java @@ -2614,8 +2614,6 @@ public class VersionConvertor_14_50 { return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) @@ -2628,6 +2626,8 @@ public class VersionConvertor_14_50 { return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) @@ -2702,8 +2702,6 @@ public class VersionConvertor_14_50 { return convertId((org.hl7.fhir.r5.model.IdType) src); if (src instanceof org.hl7.fhir.r5.model.InstantType) return convertInstant((org.hl7.fhir.r5.model.InstantType) src); - if (src instanceof org.hl7.fhir.r5.model.IntegerType) - return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); if (src instanceof org.hl7.fhir.r5.model.MarkdownType) return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); if (src instanceof org.hl7.fhir.r5.model.OidType) @@ -2716,6 +2714,8 @@ public class VersionConvertor_14_50 { return convertTime((org.hl7.fhir.r5.model.TimeType) src); if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); if (src instanceof org.hl7.fhir.r5.model.UriType) return convertUri((org.hl7.fhir.r5.model.UriType) src); if (src instanceof org.hl7.fhir.r5.model.UuidType) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java index fedf56bb1..7097f9fdd 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java @@ -3498,20 +3498,20 @@ public class VersionConvertor_30_50 { return convertId((org.hl7.fhir.dstu3.model.IdType) src); if (src instanceof org.hl7.fhir.dstu3.model.InstantType) return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); if (src instanceof org.hl7.fhir.dstu3.model.OidType) return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); if (src instanceof org.hl7.fhir.dstu3.model.StringType) return convertString((org.hl7.fhir.dstu3.model.StringType) src); if (src instanceof org.hl7.fhir.dstu3.model.TimeType) return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); if (src instanceof org.hl7.fhir.dstu3.model.UriType) return convertUri((org.hl7.fhir.dstu3.model.UriType) src); if (src instanceof org.hl7.fhir.dstu3.model.UuidType) @@ -3604,22 +3604,22 @@ public class VersionConvertor_30_50 { return convertId((org.hl7.fhir.r5.model.IdType) src); if (src instanceof org.hl7.fhir.r5.model.InstantType) return convertInstant((org.hl7.fhir.r5.model.InstantType) src); - if (src instanceof org.hl7.fhir.r5.model.IntegerType) - return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); if (src instanceof org.hl7.fhir.r5.model.Integer64Type) return convertInteger64((org.hl7.fhir.r5.model.Integer64Type) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); if (src instanceof org.hl7.fhir.r5.model.MarkdownType) return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); if (src instanceof org.hl7.fhir.r5.model.OidType) return convertOid((org.hl7.fhir.r5.model.OidType) src); - if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); if (src instanceof org.hl7.fhir.r5.model.StringType) return convertString((org.hl7.fhir.r5.model.StringType) src); if (src instanceof org.hl7.fhir.r5.model.TimeType) return convertTime((org.hl7.fhir.r5.model.TimeType) src); - if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); if (src instanceof org.hl7.fhir.r5.model.UriType) return convertUri((org.hl7.fhir.r5.model.UriType) src); if (src instanceof org.hl7.fhir.r5.model.UuidType) From 2c22d8fa233cb2290d4973820bdf8547895f648c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:10:23 +1100 Subject: [PATCH 2/8] fix bug raising error when processing bundles --- .../main/java/org/hl7/fhir/r5/elementmodel/Element.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java index 1b14a2dea..73406ba26 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Element.java @@ -75,15 +75,15 @@ public class Element extends Base { CONTAINED, BUNDLE_ENTRY, BUNDLE_OUTCOME, PARAMETER; public static SpecialElement fromProperty(Property property) { - if (property.getStructure().getIdElement().getIdPart().equals("Parameters")) + if (property.getStructure().getType().equals("Parameters")) return PARAMETER; - if (property.getStructure().getIdElement().getIdPart().equals("Bundle") && property.getName().equals("resource")) + if (property.getStructure().getType().equals("Bundle") && property.getName().equals("resource")) return BUNDLE_ENTRY; - if (property.getStructure().getIdElement().getIdPart().equals("Bundle") && property.getName().equals("outcome")) + if (property.getStructure().getType().equals("Bundle") && property.getName().equals("outcome")) return BUNDLE_OUTCOME; if (property.getName().equals("contained")) return CONTAINED; - throw new Error("Unknown resource containing a native resource: "+property.getDefinition().getId()); + throw new FHIRException("Unknown resource containing a native resource: "+property.getDefinition().getId()); } } From 49cf605b06c7b2dfb1124a6d1a580779f6aaa3f7 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:11:18 +1100 Subject: [PATCH 3/8] don't use prism for big binaries when rendering library --- .../java/org/hl7/fhir/r5/renderers/LibraryRenderer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java index 7173349a3..ecb0d1ccf 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/LibraryRenderer.java @@ -401,7 +401,7 @@ public class LibraryRenderer extends ResourceRenderer { p.code().tx(att.getContentType()+lang(att)); } String prismCode = determinePrismCode(att); - if (prismCode != null) { + if (prismCode != null && !tooBig(txt)) { x.pre().code().setAttribute("class", "language-"+prismCode).tx(txt); } else { x.pre().code().tx(txt); @@ -420,6 +420,10 @@ public class LibraryRenderer extends ResourceRenderer { } } + private boolean tooBig(String txt) { + return txt.length() > 16384; + } + private String imgExtension(String contentType) { if (contentType != null && contentType.startsWith("image/")) { if (contentType.startsWith("image/png")) { From 01430d8d988888b1e07763c2322709d72b6a8307 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:11:54 +1100 Subject: [PATCH 4/8] fix parameters renderer to create proper anchors --- .../org/hl7/fhir/r5/renderers/ParametersRenderer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java index d6fcf528e..571e7fa57 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ParametersRenderer.java @@ -118,8 +118,13 @@ public class ParametersRenderer extends ResourceRenderer { if (p.hasValue()) { render(tr.td(), p.getValue()); } else if (p.hasResource()) { - ResourceRenderer rr = RendererFactory.factory(p.getResource(), context); - rr.render(tr.td(), p.getResource()); + Resource r = p.getResource(); + td = tr.td(); + XhtmlNode para = td.para(); + para.tx(r.fhirType()+"/"+r.getId()); + para.an(r.fhirType()+"_"+r.getId()).tx(" "); + ResourceRenderer rr = RendererFactory.factory(r, context); + rr.render(td, r); } else if (p.hasPart()) { tr.td(); params(tbl, p.getPart(), 1); From ca48cf7f79021f75ea9b240d997696b661e8d908 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:12:57 +1100 Subject: [PATCH 5/8] * Don't render id/base/other properties of Resource itself in auto-narrative generator * fix bug where extension values not generated for simple extensions --- .../hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java index 985065479..23a23ec27 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManager.java @@ -351,6 +351,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple System.out.println(); System.out.print(" Installing: "); } + if (npm.name() == null || id == null || !id.equals(npm.name())) { if (!id.equals("hl7.fhir.r5.core")) {// temporary work around throw new IOException("Attempt to import a mis-identified package. Expected " + id + ", got " + npm.name()); From e6cda402745c333ada7bd372756380c9eb02985f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:13:17 +1100 Subject: [PATCH 6/8] * Don't render id/base/other properties of Resource itself in auto-narrative generator * fix bug where extension values not generated for simple extensions --- .../org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java index 155e8bbc0..12235debe 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java @@ -651,7 +651,9 @@ public class ProfileDrivenRenderer extends ResourceRenderer { child = p.getElementDefinition(); } if (child != null) { - generateElementByProfile(res, profile, allElements, x, path, showCodeDetails, indent, p, child); + if (!child.getBase().hasPath() || !child.getBase().getPath().startsWith("Resource.")) { + generateElementByProfile(res, profile, allElements, x, path, showCodeDetails, indent, p, child); + } } } } @@ -721,7 +723,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer { XhtmlNode para = x.para(); para.b().addText(p.getStructure().present()); para.tx(": "); - renderLeaf(res, v, child, x, para, false, showCodeDetails, displayHints, path, indent); + renderLeaf(res, vv, child, x, para, false, showCodeDetails, displayHints, path, indent); } else if (ev.hasValues()) { XhtmlNode bq = x.addTag("blockquote"); bq.para().b().addText(isExtension(p) ? p.getStructure().present() : p.getName()); From 6626b72b4fcafbd49893392ad3cf2d65d65c787d Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:13:50 +1100 Subject: [PATCH 7/8] * fix bug rendering content references in profiles --- .../fhir/r5/conformance/ProfileUtilities.java | 60 +++++++++++++++---- 1 file changed, 50 insertions(+), 10 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 7155da406..bc59a1e1f 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 @@ -3219,12 +3219,17 @@ public class ProfileUtilities extends TranslatingUtilities { Cell c = gen.new Cell(); r.getCells().add(c); if (e.hasContentReference()) { - ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), e.getContentReference()); + ElementInStructure ed = getElementByName(profile.getSnapshot().getElement(), e.getContentReference(), profile); if (ed == null) c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", e.getContentReference()), null)); else { - c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getPath()), null)); - c.getPieces().add(gen.new Piece("#"+ed.getPath(), tail(ed.getPath()), ed.getPath())); + if (ed.getSource() == profile) { + c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null)); + c.getPieces().add(gen.new Piece("#"+ed.getElement().getPath(), tail(ed.getElement().getPath()), ed.getElement().getPath())); + } else { + c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null)); + c.getPieces().add(gen.new Piece(ed.getSource().getUserString("path")+"#"+ed.getElement().getPath(), tail(ed.getElement().getPath())+" ("+ed.getSource().getType()+")", ed.getElement().getPath())); + } } return c; } @@ -3409,16 +3414,46 @@ public class ProfileUtilities extends TranslatingUtilities { } - private ElementDefinition getElementByName(List elements, String contentReference) { + private class ElementInStructure { + + private StructureDefinition source; + private ElementDefinition element; + + public ElementInStructure(StructureDefinition source, ElementDefinition ed) { + this.source = source; + this.element = ed; + } + + public StructureDefinition getSource() { + return source; + } + + public ElementDefinition getElement() { + return element; + } + + } + private ElementInStructure getElementByName(List elements, String contentReference, StructureDefinition source) { + if (contentReference.contains("#")) { + String url = contentReference.substring(0, contentReference.indexOf("#")); + contentReference = contentReference.substring(contentReference.indexOf("#")); + if (!url.equals(source.getUrl())) { + source = context.fetchResource(StructureDefinition.class, url); + if (source == null) { + throw new FHIRException("Unable to resolve StructureDefinition "+url+" resolving content reference "+contentReference); + } + elements = source.getSnapshot().getElement(); + } + } for (ElementDefinition ed : elements) { if (("#"+ed.getPath()).equals(contentReference)) { - return ed; + return new ElementInStructure(source, ed); } if (("#"+ed.getId()).equals(contentReference)) { - return ed; + return new ElementInStructure(source, ed); } } - throw new Error("getElementByName: can't find "+contentReference+"in "+elements.toString()); + throw new Error("getElementByName: can't find "+contentReference+" in "+elements.toString()+" from "+source.getUrl()); // return null; } @@ -4575,11 +4610,16 @@ public class ProfileUtilities extends TranslatingUtilities { if (used) { if (definition.hasContentReference()) { - ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); + ElementInStructure ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference(), profile); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+definition.getContentReference(), null)); - else - c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null)); + else { + if (ed.getSource() == profile) { + c.getPieces().add(gen.new Piece("#"+ed.getElement().getPath(), "See "+ed.getElement().getPath(), null)); + } else { + c.getPieces().add(gen.new Piece(ed.getSource().getUserData("path")+"#"+ed.getElement().getPath(), "See "+ed.getSource().getType()+"."+ed.getElement().getPath(), null)); + } + } } if (definition.getPath().endsWith("url") && definition.hasFixed()) { c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); From 581799d01c242364b915f1b34177af3aa482b218 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 5 Nov 2020 14:56:30 +1100 Subject: [PATCH 8/8] update test case dependency --- RELEASE_NOTES.md | 11 +++++++++++ pom.xml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e69de29bb..007ac857a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -0,0 +1,11 @@ +Validator changes: +* (none) + +other code changes: +* fix bug when converting positiveInt between versions +* fix bug raising error when processing bundles +* don't use prism for big binaries when rendering library +* fix parameters renderer to create proper anchors +* Don't render id/base/other properties of Resource itself in auto-narrative generator +* fix bug where extension values not generated for simple extensions +* fix bug rendering content references in profiles diff --git a/pom.xml b/pom.xml index 65e45ff81..1297ec418 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 5.1.0 - 1.1.47 + 1.1.48-SNAPSHOT 5.6.2 3.0.0-M4 0.8.5