presentation improvements for profiles table view
This commit is contained in:
parent
0cea5c2bcc
commit
bf39445d87
|
@ -224,7 +224,9 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public static final String IS_DERIVED = "derived.fact";
|
||||
public static final String UD_ERROR_STATUS = "error-status";
|
||||
private static final String GENERATED_IN_SNAPSHOT = "profileutilities.snapshot.processed";
|
||||
|
||||
private final boolean ADD_REFERENCE_TO_TABLE = true;
|
||||
|
||||
private boolean useTableForFixedValues = true;
|
||||
private boolean debug;
|
||||
|
||||
// note that ProfileUtilities are used re-entrantly internally, so nothing with process state can be here
|
||||
|
@ -2134,7 +2136,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
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);
|
||||
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, null);
|
||||
} else if (deep) {
|
||||
List<ElementDefinition> children = new ArrayList<ElementDefinition>();
|
||||
for (ElementDefinition ted : ed.getSnapshot().getElement()) {
|
||||
|
@ -2473,7 +2475,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
profiles.add(profile);
|
||||
if (list.isEmpty())
|
||||
throw new FHIRException((diff ? "Differential" : "Snapshot") + " is empty generating hierarchical table for "+profile.getUrl());
|
||||
genElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants);
|
||||
genElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants, null);
|
||||
try {
|
||||
return gen.generate(model, imagePath, 0, outputTracker);
|
||||
} catch (org.hl7.fhir.exceptions.FHIRException e) {
|
||||
|
@ -2506,9 +2508,14 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
|
||||
private void genElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean isConstraintMode, boolean allInvariants) throws IOException, FHIRException {
|
||||
private Row genElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean isConstraintMode, boolean allInvariants, Row slicingRow) throws IOException, FHIRException {
|
||||
Row originalRow = slicingRow;
|
||||
StructureDefinition profile = profiles == null ? null : profiles.get(profiles.size()-1);
|
||||
String s = tail(element.getPath());
|
||||
if (element.hasSliceName())
|
||||
s = element.getSliceName();
|
||||
Row typesRow = null;
|
||||
|
||||
List<ElementDefinition> children = getChildren(all, element);
|
||||
boolean isExtension = (s.equals("extension") || s.equals("modifierExtension"));
|
||||
// if (!snapshot && isExtension && extensions != null && extensions != isExtension)
|
||||
|
@ -2542,8 +2549,10 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
else if (hasDef && element.getType().size() > 1) {
|
||||
if (allAreReference(element.getType()))
|
||||
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
|
||||
else
|
||||
else {
|
||||
row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE);
|
||||
typesRow = row;
|
||||
}
|
||||
} 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()))
|
||||
|
@ -2580,7 +2589,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
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);
|
||||
generateDescription(gen, row, element, null, used.used, profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot);
|
||||
} else {
|
||||
String name = urltail(eurl);
|
||||
left.getPieces().get(0).setText(name);
|
||||
|
@ -2593,7 +2602,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
else // if it's complex, we just call it nothing
|
||||
// genTypes(gen, row, extDefn.getSnapshot().getElement().get(0), profileBaseFileName, profile);
|
||||
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);
|
||||
generateDescription(gen, row, element, extDefn.getElement(), used.used, null, extDefn.getUrl(), profile, corePath, imagePath, root, logicalModel, allInvariants, valueDefn, snapshot);
|
||||
}
|
||||
} else {
|
||||
genCardinality(gen, element, row, hasDef, used, null);
|
||||
|
@ -2601,15 +2610,17 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
row.getCells().add(gen.new Cell());
|
||||
else
|
||||
genTypes(gen, row, element, profileBaseFileName, profile, corePath, imagePath);
|
||||
generateDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, logicalModel, allInvariants);
|
||||
generateDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot);
|
||||
}
|
||||
} else {
|
||||
genCardinality(gen, element, row, hasDef, used, null);
|
||||
if (hasDef && !"0".equals(element.getMax()))
|
||||
if (element.hasSlicing())
|
||||
row.getCells().add(gen.new Cell(null, corePath+"profiling.html#slicing", "(Slice Definition)", null, null));
|
||||
else if (hasDef && !"0".equals(element.getMax()) && typesRow == null)
|
||||
genTypes(gen, row, element, profileBaseFileName, profile, corePath, imagePath);
|
||||
else
|
||||
row.getCells().add(gen.new Cell());
|
||||
generateDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, logicalModel, allInvariants);
|
||||
generateDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot);
|
||||
}
|
||||
if (element.hasSlicing()) {
|
||||
if (standardExtensionSlicing(element)) {
|
||||
|
@ -2617,6 +2628,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
showMissing = false; //?
|
||||
} else {
|
||||
row.setIcon("icon_slice.png", HierarchicalTableGenerator.TEXT_ICON_SLICE);
|
||||
slicingRow = row;
|
||||
row.getCells().get(2).getPieces().clear();
|
||||
for (Cell cell : row.getCells())
|
||||
for (Piece p : cell.getPieces()) {
|
||||
|
@ -2632,18 +2644,120 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
p.setStyle("text-decoration:line-through");
|
||||
p.setReference(null);
|
||||
}
|
||||
} else{
|
||||
for (ElementDefinition child : children)
|
||||
} else {
|
||||
if (slicingRow != originalRow && !children.isEmpty()) {
|
||||
// we've entered a slice; we're going to create a holder row for the slice children
|
||||
Row hrow = gen.new Row();
|
||||
hrow.setAnchor(element.getPath());
|
||||
hrow.setColor(getRowColor(element, isConstraintMode));
|
||||
hrow.setLineColor(1);
|
||||
hrow.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT);
|
||||
hrow.getCells().add(gen.new Cell(null, null, "(All Slices)", "", null));
|
||||
hrow.getCells().add(gen.new Cell());
|
||||
hrow.getCells().add(gen.new Cell());
|
||||
hrow.getCells().add(gen.new Cell());
|
||||
hrow.getCells().add(gen.new Cell(null, null, "Content/Rules for all slices", "", null));
|
||||
row.getSubRows().add(hrow);
|
||||
row = hrow;
|
||||
}
|
||||
if (typesRow != null && !children.isEmpty()) {
|
||||
// we've entered a typing slice; we're going to create a holder row for the all types children
|
||||
Row hrow = gen.new Row();
|
||||
hrow.setAnchor(element.getPath());
|
||||
hrow.setColor(getRowColor(element, isConstraintMode));
|
||||
hrow.setLineColor(1);
|
||||
hrow.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT);
|
||||
hrow.getCells().add(gen.new Cell(null, null, "(All Types)", "", null));
|
||||
hrow.getCells().add(gen.new Cell());
|
||||
hrow.getCells().add(gen.new Cell());
|
||||
hrow.getCells().add(gen.new Cell());
|
||||
hrow.getCells().add(gen.new Cell(null, null, "Content/Rules for all Types", "", null));
|
||||
row.getSubRows().add(hrow);
|
||||
row = hrow;
|
||||
}
|
||||
|
||||
Row currRow = row;
|
||||
for (ElementDefinition child : children) {
|
||||
if (!child.hasSliceName())
|
||||
currRow = row;
|
||||
if (logicalModel || !child.getPath().endsWith(".id") || (child.getPath().endsWith(".id") && (profile != null) && (profile.getDerivation() == TypeDerivationRule.CONSTRAINT)))
|
||||
genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, snapshot, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
|
||||
currRow = genElement(defPath, gen, currRow.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, isExtension, snapshot, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants, currRow);
|
||||
}
|
||||
// if (!snapshot && (extensions == null || !extensions))
|
||||
// for (ElementDefinition child : children)
|
||||
// if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension"))
|
||||
// genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, true, false, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
|
||||
}
|
||||
if (typesRow != null) {
|
||||
makeChoiceRows(typesRow.getSubRows(), element, gen, corePath);
|
||||
}
|
||||
}
|
||||
return slicingRow;
|
||||
}
|
||||
|
||||
private void makeChoiceRows(List<Row> subRows, ElementDefinition element, HierarchicalTableGenerator gen, String corePath) {
|
||||
// create a child for each choice
|
||||
for (TypeRefComponent tr : element.getType()) {
|
||||
Row choicerow = gen.new Row();
|
||||
String t = tr.getCode();
|
||||
if (isReference(t)) {
|
||||
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), null, null));
|
||||
choicerow.getCells().add(gen.new Cell());
|
||||
choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
choicerow.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
|
||||
Cell c = gen.new Cell();
|
||||
choicerow.getCells().add(c);
|
||||
if (ADD_REFERENCE_TO_TABLE) {
|
||||
if (tr.getCode().equals("canonical"))
|
||||
c.getPieces().add(gen.new Piece(corePath+"datatypes.html#canonical", "canonical", null));
|
||||
else
|
||||
c.getPieces().add(gen.new Piece(corePath+"references.html#Reference", "Reference", null));
|
||||
c.getPieces().add(gen.new Piece(null, "(", null));
|
||||
}
|
||||
boolean first = true;
|
||||
for (CanonicalType rt : tr.getTargetProfile()) {
|
||||
if (!first)
|
||||
c.getPieces().add(gen.new Piece(null, " | ", null));
|
||||
c.getPieces().add(gen.new Piece(null, pkp.getLinkFor(corePath, rt.asStringValue()), null));
|
||||
first = false;
|
||||
}
|
||||
if (ADD_REFERENCE_TO_TABLE)
|
||||
c.getPieces().add(gen.new Piece(null, ")", null));
|
||||
|
||||
} else {
|
||||
StructureDefinition sd = context.fetchTypeDefinition(t);
|
||||
if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
|
||||
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null));
|
||||
choicerow.getCells().add(gen.new Cell());
|
||||
choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
choicerow.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE);
|
||||
choicerow.getCells().add(gen.new Cell(null, corePath+"datatypes.html#"+t, t, null, null));
|
||||
// } else if (definitions.getConstraints().contthnsKey(t)) {
|
||||
// ProfiledType pt = definitions.getConstraints().get(t);
|
||||
// choicerow.getCells().add(gen.new Cell(null, null, e.getName().replace("[x]", Utilities.capitalize(pt.getBaseType())), definitions.getTypes().containsKey(t) ? definitions.getTypes().get(t).getDefinition() : null, null));
|
||||
// choicerow.getCells().add(gen.new Cell());
|
||||
// choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
// choicerow.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
|
||||
// choicerow.getCells().add(gen.new Cell(null, definitions.getSrcFile(t)+".html#"+t.replace("*", "open"), t, null, null));
|
||||
} else {
|
||||
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null));
|
||||
choicerow.getCells().add(gen.new Cell());
|
||||
choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
|
||||
choicerow.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
|
||||
choicerow.getCells().add(gen.new Cell(null, pkp.getLinkFor(corePath, t), t, null, null));
|
||||
}
|
||||
}
|
||||
choicerow.getCells().add(gen.new Cell());
|
||||
subRows.add(choicerow);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isReference(String t) {
|
||||
return t.equals("Reference") || t.equals("canonical");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void genGridElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions, String corePath, String imagePath, boolean root, boolean isConstraintMode) throws IOException, FHIRException {
|
||||
StructureDefinition profile = profiles == null ? null : profiles.get(profiles.size()-1);
|
||||
String s = tail(element.getPath());
|
||||
|
@ -2785,11 +2899,11 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
&& element.getSlicing().getRules() != SlicingRules.CLOSED && element.getSlicing().getDiscriminator().size() == 1 && element.getSlicing().getDiscriminator().get(0).getPath().equals("url") && element.getSlicing().getDiscriminator().get(0).getType().equals(DiscriminatorType.VALUE);
|
||||
}
|
||||
|
||||
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) throws IOException, FHIRException {
|
||||
return generateDescription(gen, row, definition, fallback, used, baseURL, url, profile, corePath, imagePath, root, logicalModel, allInvariants, null);
|
||||
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, boolean snapshot) throws IOException, FHIRException {
|
||||
return generateDescription(gen, row, definition, fallback, used, baseURL, url, profile, corePath, imagePath, root, logicalModel, allInvariants, null, snapshot);
|
||||
}
|
||||
|
||||
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 {
|
||||
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, boolean snapshot) throws IOException, FHIRException {
|
||||
Cell c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
|
||||
|
@ -2920,7 +3034,12 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (definition.hasFixed()) {
|
||||
if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br"));
|
||||
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, translate("sd.table", "Fixed Value")+": ", null).addStyle("font-weight:bold")));
|
||||
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, buildJson(definition.getFixed()), null).addStyle("color: darkgreen")));
|
||||
if (!useTableForFixedValues || definition.getFixed().isPrimitive())
|
||||
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, buildJson(definition.getFixed()), null).addStyle("color: darkgreen")));
|
||||
else {
|
||||
c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, "As shown", null).addStyle("color: darkgreen")));
|
||||
genFixedValue(gen, row, definition.getPattern(), snapshot, false, corePath);
|
||||
}
|
||||
if (isCoded(definition.getFixed()) && !hasDescription(definition.getFixed())) {
|
||||
Piece p = describeCoded(gen, definition.getFixed());
|
||||
if (p != null)
|
||||
|
@ -2929,12 +3048,11 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
} else if (definition.hasPattern()) {
|
||||
if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br"));
|
||||
c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, translate("sd.table", "Required Pattern")+": ", null).addStyle("font-weight:bold")));
|
||||
if (!TABLE_FORMAT_FOR_FIXED_VALUES || definition.getPattern().isPrimitive())
|
||||
if (!useTableForFixedValues || definition.getPattern().isPrimitive())
|
||||
c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, buildJson(definition.getPattern()), null).addStyle("color: darkgreen")));
|
||||
else {
|
||||
c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, "TODO", null).addStyle("color: darkgreen")));
|
||||
genFixedValue(gen, row, definition.getPattern());
|
||||
|
||||
c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, "At least the following", null).addStyle("color: darkgreen")));
|
||||
genFixedValue(gen, row, definition.getPattern(), snapshot, true, corePath);
|
||||
}
|
||||
} else if (definition.hasExample()) {
|
||||
for (ElementDefinitionExampleComponent ex : definition.getExample()) {
|
||||
|
@ -2970,41 +3088,102 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
return c;
|
||||
}
|
||||
|
||||
private void genFixedValue(HierarchicalTableGenerator gen, Row erow, Type value) {
|
||||
private void genFixedValue(HierarchicalTableGenerator gen, Row erow, Type value, boolean snapshot, boolean pattern, String corePath) {
|
||||
String ref = pkp.getLinkFor(corePath, value.fhirType());
|
||||
ref = ref.substring(0, ref.indexOf(".html"))+"-definitions.html#";
|
||||
StructureDefinition sd = context.fetchTypeDefinition(value.fhirType());
|
||||
|
||||
for (org.hl7.fhir.r5.model.Property t : value.children()) {
|
||||
if (t.hasValues()) {
|
||||
for (Base b : t.getValues()) {
|
||||
if (t.getValues().size() > 0 || snapshot) {
|
||||
ElementDefinition ed = findElementDefinition(sd, t.getName());
|
||||
if (t.getValues().size() == 0 || (t.getValues().size() == 1 && t.getValues().get(0).isEmpty())) {
|
||||
Row row = gen.new Row();
|
||||
erow.getSubRows().add(row);
|
||||
|
||||
Cell c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece(t.getName()));
|
||||
|
||||
c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+"element-definitions.html#"+ed.getBase().getPath()), t.getName(), null));
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece("P"));
|
||||
|
||||
c.addPiece(gen.new Piece(null, null, null));
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece("1..1"));
|
||||
|
||||
if (!pattern) {
|
||||
c.addPiece(gen.new Piece(null, "0..0", null));
|
||||
row.setIcon("icon_fixed.gif", "Fixed Value" /*HierarchicalTableGenerator.TEXT_ICON_FIXED*/);
|
||||
} else if (isPrimitive(t.getTypeCode())) {
|
||||
row.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE);
|
||||
c.addPiece(gen.new Piece(null, "0.."+(t.getMaxCardinality() == 2147483647 ? "*": Integer.toString(t.getMaxCardinality())), null));
|
||||
} else if (isReference(t.getTypeCode())) {
|
||||
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
|
||||
c.addPiece(gen.new Piece(null, "0.."+(t.getMaxCardinality() == 2147483647 ? "*": Integer.toString(t.getMaxCardinality())), null));
|
||||
} else {
|
||||
row.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
|
||||
c.addPiece(gen.new Piece(null, "0.."+(t.getMaxCardinality() == 2147483647 ? "*": Integer.toString(t.getMaxCardinality())), null));
|
||||
}
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece(b.fhirType()));
|
||||
c.addPiece(gen.new Piece(pkp.getLinkFor(corePath, t.getTypeCode()), t.getTypeCode(), null));
|
||||
c = gen.new Cell();
|
||||
c.addPiece(gen.new Piece(null, ed.getShort(), null));
|
||||
row.getCells().add(c);
|
||||
} else {
|
||||
for (Base b : t.getValues()) {
|
||||
Row row = gen.new Row();
|
||||
erow.getSubRows().add(row);
|
||||
row.setIcon("icon_fixed.gif", "Fixed Value" /*HierarchicalTableGenerator.TEXT_ICON_FIXED*/);
|
||||
|
||||
Cell c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+"element-definitions.html#"+ed.getBase().getPath()), t.getName(), null));
|
||||
|
||||
if (b.isPrimitive()) {
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece(b.primitiveValue()));
|
||||
} else {
|
||||
c.addPiece(gen.new Piece(null, null, null));
|
||||
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
if (pattern)
|
||||
c.addPiece(gen.new Piece(null, "1.."+(t.getMaxCardinality() == 2147483647 ? "*" : Integer.toString(t.getMaxCardinality())), null));
|
||||
else
|
||||
c.addPiece(gen.new Piece(null, "1..1", null));
|
||||
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece(pkp.getLinkFor(corePath, b.fhirType()), b.fhirType(), null));
|
||||
|
||||
if (b.isPrimitive()) {
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece(null, ed.getShort(), null));
|
||||
c.addPiece(gen.new Piece("br"));
|
||||
c.getPieces().add(gen.new Piece(null, "Fixed Value: ", null).addStyle("font-weight: bold"));
|
||||
String s = b.primitiveValue();
|
||||
if (Utilities.noString(s))
|
||||
System.out.print("t");
|
||||
c.getPieces().add(gen.new Piece(null, s, null).addStyle("color: darkgreen"));
|
||||
} else {
|
||||
c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
c.addPiece(gen.new Piece(null, ed.getShort(), null));
|
||||
c.addPiece(gen.new Piece("br"));
|
||||
c.getPieces().add(gen.new Piece(null, "Fixed Value: ", null).addStyle("font-weight: bold"));
|
||||
c.getPieces().add(gen.new Piece(null, "(complex)", null).addStyle("color: darkgreen"));
|
||||
genFixedValue(gen, row, (Type) b, snapshot, pattern, corePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private ElementDefinition findElementDefinition(StructureDefinition sd, String name) {
|
||||
String path = sd.getType()+"."+name;
|
||||
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||
if (ed.getPath().equals(path))
|
||||
return ed;
|
||||
}
|
||||
throw new FHIRException("Unable to find element "+path);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
public static final String TEXT_ICON_EXTENSION = "Extension";
|
||||
public static final String TEXT_ICON_CHOICE = "Choice of Types";
|
||||
public static final String TEXT_ICON_SLICE = "Slice Definition";
|
||||
public static final String TEXT_ICON_FIXED = "Fixed Value";
|
||||
public static final String TEXT_ICON_EXTENSION_SIMPLE = "Simple Extension";
|
||||
public static final String TEXT_ICON_PROFILE = "Profile";
|
||||
public static final String TEXT_ICON_EXTENSION_COMPLEX = "Complex Extension";
|
||||
|
|
Loading…
Reference in New Issue