private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, ElementDefinition valueDefn) throws IOException, FHIRException { Cell c = gen.new Cell(); row.getCells().add(c); if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", definition.getContentReference()), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), translate("sd.table", "See %s", ed.getPath()), null)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url;
private Cell generateGridDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, ElementDefinition valueDefn) throws IOException, FHIRException { Cell c = gen.new Cell(); row.getCells().add(c); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (url != null) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); binding = definition.getBinding(); if (binding!=null && !binding.isEmpty()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(profile, binding, definition.getPath()); c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold")));
UnusedTracker used = new UnusedTracker(); used.used = true; Cell left = gen.new Cell(null, ref, s, (element.hasSliceName() ? translate("sd.table", "Slice")+" "+element.getSliceName() : "")+(hasDef && element.hasSliceName() ? ": " : "")+(!hasDef ? null : gt(element.getDefinitionElement())), null); row.getCells().add(left); Cell gc = gen.new Cell(); row.getCells().add(gc); if (element != null && element.getIsModifier()) checkForNoChange(element.getIsModifierElement(), gc.addStyledText(translate("sd.table", "This element is a modifier element"), "?!", null, null, null, false)); if (element != null && element.getMustSupport()) checkForNoChange(element.getMustSupportElement(), gc.addStyledText(translate("sd.table", "This element must be supported"), "S", "white", "red", null, false)); if (element != null && element.getIsSummary()) checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "\u03A3", null, null, null, false)); if (element != null && (!element.getConstraint().isEmpty() || !element.getCondition().isEmpty())) gc.addStyledText(translate("sd.table", "This element has or is affected by some invariants"), "I", null, null, null, false); if (extDefn == null) { genCardinality(gen, element, row, hasDef, used, null); row.getCells().add(gen.new Cell(null, null, "?? "+element.getType().get(0).getProfile(), null, null)); generateDescription(gen, row, element, null, used.used, profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants); } else { String name = urltail(eurl); left.getPieces().get(0).setText(name); left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); genCardinality(gen, element, row, hasDef, used, extDefn.getElement()); ElementDefinition valueDefn = extDefn.getExtensionValueDefinition(); row.getCells().add(gen.new Cell(null, null, "("+translate("sd.table", "Complex")+")", null, null)); generateDescription(gen, row, element, extDefn.getElement(), used.used, null, extDefn.getUrl(), profile, corePath, imagePath, root, logicalModel, allInvariants, valueDefn);
private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath, String imagePath) { Cell c = gen.new Cell(); r.getCells().add(c); List<TypeRefComponent> types = e.getType(); c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); first = false; else if (allReference) c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null))); else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.getCode()!= null && t.getCode().equals("Reference")) { if (!allReference) { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); if (sd != null) { String disp = sd.hasTitle() ? sd.getTitle() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(checkPrepend(corePath, sd.getUserString("path")), disp, null))); } else { String rn = t.getTargetProfile().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, rn), rn, null))); if (ref.contains("|")) ref = ref.substring(0, ref.indexOf("|")); c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null))); } else
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, ElementDefinition valueDefn) throws IOException, FHIRException { Cell c = gen.new Cell(); row.getCells().add(c); if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", definition.getContentReference()), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), translate("sd.table", "See %s", ed.getPath()), null)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url;
UnusedTracker used = new UnusedTracker(); used.used = true; Cell left = gen.new Cell(null, ref, s, (element.hasSliceName() ? translate("sd.table", "Slice")+" "+element.getSliceName() : "")+(hasDef && element.hasSliceName() ? ": " : "")+(!hasDef ? null : gt(element.getDefinitionElement())), null); row.getCells().add(left); Cell gc = gen.new Cell(); row.getCells().add(gc); if (element != null && element.getIsModifier()) checkForNoChange(element.getIsModifierElement(), gc.addStyledText(translate("sd.table", "This element is a modifier element"), "?!", null, null, null, false)); if (element != null && element.getMustSupport()) checkForNoChange(element.getMustSupportElement(), gc.addStyledText(translate("sd.table", "This element must be supported"), "S", "white", "red", null, false)); if (element != null && element.getIsSummary()) checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "Σ", null, null, null, false)); if (element != null && (!element.getConstraint().isEmpty() || !element.getCondition().isEmpty())) gc.addStyledText(translate("sd.table", "This element has or is affected by some invariants"), "I", null, null, null, false); if (extDefn == null) { genCardinality(gen, element, row, hasDef, used, null); row.getCells().add(gen.new Cell(null, null, "?? "+element.getType().get(0).getProfile(), null, null)); generateDescription(gen, row, element, null, used.used, profile.getUrl(), element.getType().get(0).getProfile(), profile, corePath, imagePath, root, logicalModel, allInvariants); } else { String name = urltail(element.getType().get(0).getProfile()); left.getPieces().get(0).setText(name); left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); genCardinality(gen, element, row, hasDef, used, extDefn.getElement()); ElementDefinition valueDefn = extDefn.getExtensionValueDefinition(); row.getCells().add(gen.new Cell(null, null, "("+translate("sd.table", "Complex")+")", null, null)); generateDescription(gen, row, element, extDefn.getElement(), used.used, null, extDefn.getUrl(), profile, corePath, imagePath, root, logicalModel, allInvariants, valueDefn);
UnusedTracker used = new UnusedTracker(); used.used = true; Cell left = gen.new Cell(null, ref, s, (element.hasSliceName() ? translate("sd.table", "Slice")+" "+element.getSliceName() : "")+(hasDef && element.hasSliceName() ? ": " : "")+(!hasDef ? null : gt(element.getDefinitionElement())), null); row.getCells().add(left); Cell gc = gen.new Cell(); row.getCells().add(gc); if (element != null && element.getIsModifier()) checkForNoChange(element.getIsModifierElement(), gc.addStyledText(translate("sd.table", "This element is a modifier element"), "?!", null, null, null, false)); if (element != null && element.getMustSupport()) checkForNoChange(element.getMustSupportElement(), gc.addStyledText(translate("sd.table", "This element must be supported"), "S", "white", "red", null, false)); if (element != null && element.getIsSummary()) checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "\u03A3", null, null, null, false)); if (element != null && (!element.getConstraint().isEmpty() || !element.getCondition().isEmpty())) gc.addStyledText(translate("sd.table", "This element has or is affected by some invariants"), "I", null, null, null, false); if (extDefn == null) { genCardinality(gen, element, row, hasDef, used, null); row.getCells().add(gen.new Cell(null, null, "?? "+element.getType().get(0).getProfile(), null, null)); generateDescription(gen, row, element, null, used.used, profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants); } else { String name = urltail(eurl); left.getPieces().get(0).setText(name); left.getPieces().get(0).setHint(translate("sd.table", "Extension URL")+" = "+extDefn.getUrl()); genCardinality(gen, element, row, hasDef, used, extDefn.getElement()); ElementDefinition valueDefn = extDefn.getExtensionValueDefinition(); row.getCells().add(gen.new Cell(null, null, "("+translate("sd.table", "Complex")+")", null, null)); generateDescription(gen, row, element, extDefn.getElement(), used.used, null, extDefn.getUrl(), profile, corePath, imagePath, root, logicalModel, allInvariants, valueDefn);
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, ElementDefinition valueDefn) throws IOException { Cell c = gen.new Cell(); row.getCells().add(c); if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, translate("sd.table", "XML Namespace")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", definition.getContentReference()), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), translate("sd.table", "See %s", ed.getPath()), null)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url;
private Cell generateGridDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, ElementDefinition valueDefn) throws IOException { Cell c = gen.new Cell(); row.getCells().add(c); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (url != null) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); binding = definition.getBinding(); if (binding!=null && !binding.isEmpty()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(profile, binding, definition.getPath()); c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold")));
private Cell generateGridDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, ElementDefinition valueDefn) throws IOException, FHIRException { Cell c = gen.new Cell(); row.getCells().add(c); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (url != null) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); binding = definition.getBinding(); if (binding!=null && !binding.isEmpty()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(profile, binding, definition.getPath()); c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold")));
r.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile+"-definitions.html#extension."+ed.getName(), en, null, null)); r.getCells().add(gen.new Cell()); r.getCells().add(gen.new Cell(null, null, describeCardinality(ed.getSnapshot().getElement().get(0), null, new UnusedTracker()), null, null)); r.getCells().add(gen.new Cell("", "", "Extension", null, null)); r.getCells().add(gen.new Cell("", "", "Extension", null, null)); r.setIcon("icon_"+m+"extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); Row r1 = gen.new Row(); r.getSubRows().add(r1); r1.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile+"-definitions.html#extension."+ed.getName(), ((UriType) ued.getFixed()).getValue(), null, null)); r1.getCells().add(gen.new Cell()); r1.getCells().add(gen.new Cell(null, null, describeCardinality(c, null, new UnusedTracker()), null, null)); genTypes(gen, r1, ved, defFile, ed, corePath, imagePath); Cell cell = gen.new Cell(); cell.addMarkdown(c.getDefinition()); r1.getCells().add(cell); r1.setIcon("icon_"+m+"extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); Cell c = gen.new Cell("", "", "URL = "+ed.getUrl(), null, null); Piece cc = gen.new Piece(null, ed.getName()+": ", null); c.addPiece(gen.new Piece("br")).addPiece(cc); c.addMarkdown(ed.getDescription()); c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(ed, ved.getBinding(), ved.getPath()); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, translate("sd.table", "Binding")+": ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath+br.url, br.display, null)));
private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath) { Cell c = gen.new Cell(); r.getCells().add(c); List<TypeRefComponent> types = e.getType(); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), e.getNameReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+e.getNameReference(), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null)); return c; } else { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); first = false; else if (allReference) c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null))); else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.getCode().equals("Reference") || (t.getCode().equals("Resource") && t.hasProfile())) { if (ADD_REFERENCE_TO_TABLE && !allReference) { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); if (sd != null) { String disp = sd.hasDisplay() ? sd.getDisplay() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+sd.getUserString("path"), disp, null)));
r.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile+"-definitions.html#extension."+ed.getName(), ed.getSnapshot().getElement().get(0).getIsModifier() ? "modifierExtension" : "extension", null, null)); r.getCells().add(gen.new Cell()); r.getCells().add(gen.new Cell(null, null, describeCardinality(ed.getSnapshot().getElement().get(0), null, new UnusedTracker()), null, null)); r.getCells().add(gen.new Cell("", "", "Extension", null, null)); r.getCells().add(gen.new Cell("", "", "Extension", null, null)); r.setIcon("icon_"+m+"extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); Row r1 = gen.new Row(); r.getSubRows().add(r1); r1.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile+"-definitions.html#extension."+ed.getName(), ((UriType) ued.getFixed()).getValue(), null, null)); r1.getCells().add(gen.new Cell()); r1.getCells().add(gen.new Cell(null, null, describeCardinality(c, null, new UnusedTracker()), null, null)); genTypes(gen, r1, ved, defFile, ed, corePath, imagePath); r1.getCells().add(gen.new Cell(null, null, c.getDefinition(), null, null)); r1.setIcon("icon_"+m+"extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); Cell c = gen.new Cell("", "", "URL = "+ed.getUrl(), null, null); c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, ed.getName()+": "+ed.getDescription(), null)); if (!full && !(deep || vdeep) && ved != null && ved.hasBinding()) { c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(ed, ved.getBinding(), ved.getPath()); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, translate("sd.table", "Binding")+": ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath+br.url, br.display, null))); if (ved.getBinding().hasStrength()) { c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(null, " (", null))); c.getPieces().add(checkForNoChange(ved.getBinding(), gen.new Piece(corePath+"terminologies.html#"+ved.getBinding().getStrength().toCode(), egt(ved.getBinding().getStrengthElement()), ved.getBinding().getStrength().getDefinition()))); c.getPieces().add(gen.new Piece(null, ")", null));
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, boolean root, boolean logicalModel) throws IOException { Cell c = gen.new Cell(); row.getCells().add(c); if (logicalModel && ToolingExtensions.hasExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) { if (root) { c.getPieces().add(gen.new Piece(null, "XML Namespace: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); } else if (!root && ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace") && !ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").equals(ToolingExtensions.readStringExtension(profile, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))) { c.getPieces().add(gen.new Piece(null, "XML Namespace: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"), null)); ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); 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)); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, definition.getShort(), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, fallback.getShort(), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url;
private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath, String imagePath) { Cell c = gen.new Cell(); r.getCells().add(c); List<TypeRefComponent> types = e.getType(); first = false; else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.hasTarget()) { c.getPieces().add(gen.new Piece(corePath+"references.html", t.getCode(), null)); c.getPieces().add(gen.new Piece(null, "(", null)); boolean tfirst = true; for (UriType u : t.getTargetProfile()) { tfirst = false; else c.addPiece(gen.new Piece(null, " | ", null)); if (u.getValue().startsWith("http://hl7.org/fhir/StructureDefinition/")) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, u.getValue()); if (sd != null) { String disp = sd.hasTitle() ? sd.getTitle() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(checkPrepend(corePath, sd.getUserString("path")), disp, null))); } else { String rn = u.getValue().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, rn), rn, null))); if (ref.contains("|")) ref = ref.substring(0, ref.indexOf("|")); c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null)));
private Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath) throws Exception { Cell c = gen.new Cell(); row.getCells().add(c); c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "\""+buildJson(definition.getFixed())+"\"", null).addStyle("color: darkgreen"))); } else { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, definition.getShort(), null))); } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, fallback.getShort(), null))); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); String fullUrl = url.startsWith("#") ? baseURL+url : url; StructureDefinition ed = context.fetchResource(StructureDefinition.class, url); String ref = ed == null ? null : (String) corePath+ed.getUserData("path"); c.getPieces().add(gen.new Piece(null, "URL: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(ref, fullUrl, null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null)); if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); BindingResolution br = pkp.resolveBinding(definition.getBinding()); c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(null, "Binding: ", null).addStyle("font-weight:bold"))); c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url)? br.url : corePath+br.url, br.display, null))); if (definition.getBinding().hasStrength()) { c.getPieces().add(checkForNoChange(definition.getBinding(), gen.new Piece(null, " (", null)));
private Cell genTypes(HierarchicalTableGenerator gen, Row r, ElementDefinition e, String profileBaseFileName, StructureDefinition profile, String corePath) { Cell c = gen.new Cell(); r.getCells().add(c); List<TypeRefComponent> types = e.getType(); c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); first = false; else if (allReference) c.addPiece(checkForNoChange(tl, gen.new Piece(null," | ", null))); else c.addPiece(checkForNoChange(tl, gen.new Piece(null,", ", null))); tl = t; if (t.getCode().equals("Reference") || (t.getCode().equals("Resource") && t.hasProfile())) { if (ADD_REFERENCE_TO_TABLE && !allReference) { c.getPieces().add(gen.new Piece(corePath+"references.html", "Reference", null)); c.getPieces().add(gen.new Piece(null, "(", null)); if (sd != null) { String disp = sd.hasDisplay() ? sd.getDisplay() : sd.getName(); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+sd.getUserString("path"), disp, null))); } else { String rn = t.getProfile().get(0).getValue().substring(40); c.addPiece(checkForNoChange(t, gen.new Piece(corePath+pkp.getLinkFor(rn), rn, null))); c.addPiece(checkForNoChange(t, gen.new Piece(null, t.getCode(), null))); } else if (t.getProfile().get(0).getValue().startsWith("#")) c.addPiece(checkForNoChange(t, gen.new Piece(corePath+profileBaseFileName+"."+t.getProfile().get(0).getValue().substring(1).toLowerCase()+".html", t.getProfile().get(0).getValue(), null))); else
UnusedTracker used = new UnusedTracker(); used.used = true; Cell left = gen.new Cell(); if (element.getType().size() == 1 && element.getType().get(0).isPrimitive()) left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement())).addStyle("font-weight:bold")); else left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement()))); if (element.hasSliceName()) { left.getPieces().add(gen.new Piece("br")); String indent = StringUtils.repeat('\u00A0', 1+2*(element.getPath().split("\\.").length)); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null)); genTypes(gen, row, element, profileBaseFileName, profile, corePath, imagePath); else row.getCells().add(gen.new Cell()); generateGridDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, null);
UnusedTracker used = new UnusedTracker(); used.used = true; Cell left = gen.new Cell(); if (element.getType().size() == 1 && element.getType().get(0).isPrimitive()) left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement())).addStyle("font-weight:bold")); else left.getPieces().add(gen.new Piece(ref, "\u00A0\u00A0" + s, !hasDef ? null : gt(element.getDefinitionElement()))); if (element.hasSliceName()) { left.getPieces().add(gen.new Piece("br")); String indent = StringUtils.repeat('\u00A0', 1+2*(element.getPath().split("\\.").length)); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null)); genTypes(gen, row, element, profileBaseFileName, profile, corePath, imagePath); else row.getCells().add(gen.new Cell()); generateGridDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, null);
tracker.used = !max.getValue().equals("0"); Cell cell = gen.new Cell(null, null, null, null, null); row.getCells().add(cell); if (!min.isEmpty() || !max.isEmpty()) { cell.addPiece(checkForNoChange(min, gen.new Piece(null, !min.hasValue() ? "" : Integer.toString(min.getValue()), null))); cell.addPiece(checkForNoChange(min, max, gen.new Piece(null, "..", null))); cell.addPiece(checkForNoChange(min, gen.new Piece(null, !max.hasValue() ? "" : max.getValue(), null)));