diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java index cf816826c..8fbc6f7b4 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java @@ -392,7 +392,6 @@ public class StructureDefinitionComparer extends CanonicalResourceComparer imple boolean def = false; boolean ch = false; - System.out.println(left.getId()); // not allowed to be different: // ruleEqual(comp, res, left.current().getDefaultValue(), right.current().getDefaultValue(), "defaultValue", path); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/VersionComparisonAnnotation.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/VersionComparisonAnnotation.java index 5ed742f33..f8acb936d 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/VersionComparisonAnnotation.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/VersionComparisonAnnotation.java @@ -124,4 +124,17 @@ public class VersionComparisonAnnotation { return result.isEmpty() ? null : result.get(0); } + + + + public static CanonicalResourceComparison artifactComparison(Base base) { + if (base.hasUserData(USER_DATA_NAME)) { + VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(USER_DATA_NAME); + return self.comp; + } else { + return null; + } + } + + } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java index 222bad1cf..b555b6867 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java @@ -194,48 +194,37 @@ public class Renderer extends TranslatingUtilities { } } -// -// -//public static CanonicalResourceComparison artifactComparison(Base base) { -// if (base.hasUserData(USER_DATA_NAME)) { -// VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(USER_DATA_NAME); -// return self.comp; -// } else { -// return null; -// } -//} -// -//public static void renderSummary(Base base, XhtmlNode x, String version, String... metadataFields) { -// if (base.hasUserData(USER_DATA_NAME)) { -// VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(USER_DATA_NAME); -// switch (self.type) { -// case Added: -// XhtmlNode spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version); -// spanInner.img("icon-change-add.png", "icon"); -// spanInner.tx(" Added"); -// return; -// case Changed: -// if (self.comp.noChangeOtherThanMetadata(metadataFields)) { -// x.span("color: #eeeeee").tx("n/c"); -// return; -// } else { -// spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+version+(self.original != null ? " (was '"+(self.original.primitiveValue())+"')" : "")); -// spanInner.img("icon-change-edit.png", "icon"); -// spanInner.tx(" Changed"); -// } -// return; -// case Deleted: -// spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version); -// spanInner.img("icon-change-remove.png", "icon"); -// spanInner.tx(" Removed"); -// return; -// default: -// x.span("color: #eeeeee").tx("n/c"); -// return; -// } -// } else { -// x.span("color: #eeeeee").tx("--"); -// } -//} + public static void renderStatusSummary(Base base, XhtmlNode x, String version, String... metadataFields) { + if (base.hasUserData(VersionComparisonAnnotation.USER_DATA_NAME)) { + VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(VersionComparisonAnnotation.USER_DATA_NAME); + switch (self.getType()) { + case Added: + XhtmlNode spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version); + spanInner.img("icon-change-add.png", "icon"); + spanInner.tx(" Added"); + return; + case Changed: + if (self.getComp().noChangeOtherThanMetadata(metadataFields)) { + x.span("color: #eeeeee").tx("n/c"); + return; + } else { + spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+version+(self.getOriginal() != null ? " (was '"+(self.getOriginal())+"')" : "")); + spanInner.img("icon-change-edit.png", "icon"); + spanInner.tx(" Changed"); + } + return; + case Deleted: + spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version); + spanInner.img("icon-change-remove.png", "icon"); + spanInner.tx(" Removed"); + return; + default: + x.span("color: #eeeeee").tx("n/c"); + return; + } + } else { + x.span("color: #eeeeee").tx("--"); + } + } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java index 7e4c92c4d..6a401a68e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java @@ -3476,7 +3476,6 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } private void generateElementInner(XhtmlNode tbl, StructureDefinition sd, ElementDefinition d, int mode, ElementDefinition value, ElementDefinition compare, ElementDefinition compareValue, boolean strikethrough) throws FHIRException, IOException { - System.out.println(d.getPath()); boolean root = !d.getPath().contains("."); boolean slicedExtension = d.hasSliceName() && (d.getPath().endsWith(".extension") || d.getPath().endsWith(".modifierExtension")); // int slicedExtensionMode = (mode == GEN_MODE_KEY) && slicedExtension ? GEN_MODE_SNAP : mode; // see ProfileUtilities.checkExtensionDoco / Task 3970