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);
Row row = gen.new Row(); row.setAnchor(element.getPath()); row.setColor(getRowColor(element, isConstraintMode)); if (element.hasSlicing()) row.setLineColor(1); else if (element.hasSliceName()) row.setLineColor(2); else row.setLineColor(0); boolean hasDef = element != null; boolean ext = false; if (s.equals("extension")) { if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue())) row.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); else row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); ext = true; } else if (s.equals("modifierExtension")) { if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue())) row.setIcon("icon_modifier_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); else row.setIcon("icon_modifier_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); } else if (!hasDef || element.getType().size() == 0) row.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT); else if (hasDef && element.getType().size() > 1) { if (allAreReference(element.getType())) row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE); else row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE);
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);
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(); if (!e.hasType()) {
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);
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);
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);
Row row = gen.new Row(); row.setAnchor(element.getPath()); row.setColor(getRowColor(element, isConstraintMode)); if (element.hasSlicing()) row.setLineColor(1); else if (element.hasSliceName()) row.setLineColor(2); else row.setLineColor(0); boolean hasDef = element != null; boolean ext = false; if (s.equals("extension")) { if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue())) row.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); else row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); ext = true; } else if (s.equals("modifierExtension")) { if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue())) row.setIcon("icon_modifier_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); else row.setIcon("icon_modifier_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); } else if (!hasDef || element.getType().size() == 0) row.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT); else if (hasDef && element.getType().size() > 1) { if (allAreReference(element.getType())) row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE); else row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE);
Row row = gen.new Row(); row.setAnchor(element.getPath()); row.setColor(getRowColor(element, isConstraintMode)); boolean hasDef = element != null; boolean ext = false; if (s.equals("extension")) { if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile())) row.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); else row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); ext = true; } else if (s.equals("modifierExtension")) { if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile())) row.setIcon("icon_modifier_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); else row.setIcon("icon_modifier_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); } else if (!hasDef || element.getType().size() == 0) row.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT); else if (hasDef && element.getType().size() > 1) { if (allTypesAre(element.getType(), "Reference")) row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE); else row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE); } else if (hasDef && element.getType().get(0).getCode() != null && element.getType().get(0).getCode().startsWith("@")) row.setIcon("icon_reuse.png", HierarchicalTableGenerator.TEXT_ICON_REUSE); else if (hasDef && isPrimitive(element.getType().get(0).getCode())) row.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE); else if (hasDef && isReference(element.getType().get(0).getCode())) row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
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(); if (!e.hasType()) {
Row r = gen.new Row(); model.getRows().add(r); String en; 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.setIcon(deep ? "icon_"+m+"extension_complex.png" : "icon_extension_simple.png", deep ? HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX : HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); List<ElementDefinition> children = getChildren(ed.getSnapshot().getElement(), ed.getSnapshot().getElement().get(0)); for (ElementDefinition child : children) if (!child.getPath().endsWith(".id")) genElement(defFile == null ? "" : defFile+"-definitions.html#extension.", gen, r.getSubRows(), child, ed.getSnapshot().getElement(), null, true, defFile, true, full, corePath, imagePath, true, false, false, false); } else if (deep) { List<ElementDefinition> children = new ArrayList<ElementDefinition>(); r.getCells().add(gen.new Cell("", "", "Extension", null, null)); r.setIcon("icon_"+m+"extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); ElementDefinition ued = getUrlFor(ed, c); if (ved != null && ued != null) { 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);
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(); if (!e.hasType()) {
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);
Row r = gen.new Row(); model.getRows().add(r); 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.setIcon(deep ? "icon_"+m+"extension_complex.png" : "icon_extension_simple.png", deep ? HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX : HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); List<ElementDefinition> children = getChildren(ed.getSnapshot().getElement(), ed.getSnapshot().getElement().get(0)); for (ElementDefinition child : children) if (!child.getPath().endsWith(".id")) genElement(defFile == null ? "" : defFile+"-definitions.html#extension.", gen, r.getSubRows(), child, ed.getSnapshot().getElement(), null, true, defFile, true, full, corePath, imagePath, true, false, false, false); } else if (deep) { List<ElementDefinition> children = new ArrayList<ElementDefinition>(); r.getCells().add(gen.new Cell("", "", "Extension", null, null)); r.setIcon("icon_"+m+"extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX); ElementDefinition ued = getUrlFor(ed, c); if (ved != null && ued != null) { 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);
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(); if (!e.hasType()) {
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);
Row row = gen.new Row(); row.setAnchor(element.getPath()); row.setColor(getRowColor(element, isConstraintMode)); if (element.hasSlicing()) row.setLineColor(1); else if (element.hasSliceName()) row.setLineColor(2); else row.setLineColor(0); boolean hasDef = element != null; String ref = defPath == null ? null : defPath + element.getId(); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null)); row.getCells().add(left); 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); for (ElementDefinition child : children) if (child.getMustSupport()) genGridElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, corePath, imagePath, false, isConstraintMode);
Row row = gen.new Row(); row.setAnchor(element.getPath()); row.setColor(getRowColor(element, isConstraintMode)); boolean hasDef = element != null; String ref = defPath == null ? null : defPath + element.getId(); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null)); row.getCells().add(left); 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); for (ElementDefinition child : children) if (child.getMustSupport()) genGridElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, corePath, imagePath, false, isConstraintMode);
row.getCells().add(cell); if (!min.isEmpty() || !max.isEmpty()) { cell.addPiece(checkForNoChange(min, gen.new Piece(null, !min.hasValue() ? "" : Integer.toString(min.getValue()), null)));
private void genCardinality(HierarchicalTableGenerator gen, ElementDefinition definition, Row row, boolean hasDef, UnusedTracker tracker, ElementDefinition fallback) { IntegerType min = !hasDef ? new IntegerType() : definition.hasMinElement() ? definition.getMinElement() : new IntegerType(); StringType max = !hasDef ? new StringType() : definition.hasMaxElement() ? definition.getMaxElement() : new StringType(); if (min.isEmpty() && definition.getUserData(DERIVATION_POINTER) != null) { ElementDefinition base = (ElementDefinition) definition.getUserData(DERIVATION_POINTER); min = base.getMinElement().copy(); min.setUserData(DERIVATION_EQUALS, true); } if (max.isEmpty() && definition.getUserData(DERIVATION_POINTER) != null) { ElementDefinition base = (ElementDefinition) definition.getUserData(DERIVATION_POINTER); max = base.getMaxElement().copy(); max.setUserData(DERIVATION_EQUALS, true); } if (min.isEmpty() && fallback != null) min = fallback.getMinElement(); if (max.isEmpty() && fallback != null) max = fallback.getMaxElement(); if (!max.isEmpty()) 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))); } }