use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project kindling by HL7.
the class ResourceDependencyGenerator method addTypeToAnalysis.
private void addTypeToAnalysis(HierarchicalTableGenerator gen, Row row, Cell dc, boolean ref, StandardsStatus elementStatus, String type) throws Exception {
String tgtFMM = null;
StandardsStatus tgtSS = null;
if (definitions.getConstraints().containsKey(type))
type = definitions.getConstraints().get(type).getBaseType();
if (definitions.hasResource(type)) {
ResourceDefn r = definitions.getResourceByName(type);
tgtFMM = r.getFmmLevel();
tgtSS = r.getStatus();
} else if (definitions.getBaseResources().containsKey(type)) {
ResourceDefn r = definitions.getBaseResources().get(type);
tgtFMM = r.getFmmLevel();
tgtSS = r.getStatus();
} else if ("Any".equals(type)) {
tgtFMM = "1";
tgtSS = StandardsStatus.TRIAL_USE;
} else if (definitions.hasPrimitiveType(type)) {
tgtFMM = "5";
tgtSS = StandardsStatus.NORMATIVE;
} else if ("*".equals(type)) {
// todo: what...?
tgtFMM = "2";
tgtSS = StandardsStatus.TRIAL_USE;
} else {
TypeDefn t = definitions.getElementDefn(type);
if (t != null) {
tgtFMM = t.getFmmLevel();
tgtSS = t.getStandardsStatus();
}
}
if (elementStatus == null)
elementStatus = sstatus;
if (tgtFMM == null)
addError(gen, row, dc, "Error: Unable to resolve type '" + type + "' to check dependencies", null);
else {
boolean ok = elementStatus.canDependOn(tgtSS);
if (ok)
ok = fmm.compareTo(tgtFMM) <= 0;
if (ok)
// addInfo(gen, row, dc, "OK ("+type+" = FMM"+tgtFMM+"-"+tgtSS.toDisplay()+" vs. Element = FMM"+fmm+"-"+elementStatus.toDisplay()+")", null);
;
else if (ref)
addWarning(gen, row, dc, "Type Warning: (" + type + " = FMM" + tgtFMM + "-" + (tgtSS == null ? "null" : tgtSS.toDisplay()) + " vs. Element = FMM" + fmm + "-" + elementStatus.toDisplay() + ")", null);
else
addError(gen, row, dc, "Type Error: (" + type + " = FMM" + tgtFMM + "-" + tgtSS.toDisplay() + " vs. Element = FMM" + fmm + "-" + elementStatus.toDisplay() + ")", null);
}
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project kindling by HL7.
the class ResourceDependencyGenerator method genElement.
protected Row genElement(ElementDefn e, HierarchicalTableGenerator gen, boolean resource, String path, boolean isProfile, String prefix, RenderMode mode, boolean isRoot) throws Exception {
Row row = gen.new Row();
row.setAnchor(path);
// 1. Name
Cell gc = gen.new Cell(null, dictLinks() ? pageName + "#" + path.replace("[", "_").replace("]", "_") : null, e.getName(), path + " : " + e.getDefinition(), null);
row.getCells().add(gc);
if (e.getStandardsStatus() != null) {
gc.addPiece(gen.new Piece(null, " ", null));
gc.addStyledText("Publication Status = " + e.getStandardsStatus().toDisplay(), e.getStandardsStatus().getAbbrev(), "black", e.getStandardsStatus().getColor(), prefix + "versions.html#std-process", true);
}
Cell dc;
if (resource) {
// card.
row.getCells().add(gen.new Cell());
row.setIcon("icon_resource.png", HierarchicalTableGenerator.TEXT_ICON_RESOURCE);
if (Utilities.noString(e.typeCode())) {
row.getCells().add(gen.new Cell(null, null, "n/a", null, null));
// analysis
row.getCells().add(dc = gen.new Cell());
} else {
// type
row.getCells().add(gen.new Cell(null, prefix + definitions.getSrcFile(e.typeCode()) + ".html#" + e.typeCode(), e.typeCode(), null, null));
// analysis
row.getCells().add(dc = gen.new Cell(null, null, path.contains(".") ? e.describeCardinality() : "", null, null));
}
} else {
if (!e.getElements().isEmpty()) {
// card.
row.getCells().add(gen.new Cell(null, null, path.contains(".") ? e.describeCardinality() : "", null, null));
row.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT);
if (mode == RenderMode.RESOURCE)
row.getCells().add(gen.new Cell(null, prefix + definitions.getBackboneLink(), "BackboneElement", null, null));
else if (e.getName().equals("Element"))
row.getCells().add(gen.new Cell(null, null, "n/a", null, null));
else
row.getCells().add(gen.new Cell(null, prefix + definitions.getBackboneLink(), "Element", null, null));
// analysis
row.getCells().add(dc = gen.new Cell());
} else if (e.getTypes().size() == 1) {
// card.
row.getCells().add(gen.new Cell(null, null, path.contains(".") ? e.describeCardinality() : "", null, null));
String t = e.getTypes().get(0).getName();
Cell c;
if (t.startsWith("@")) {
row.setIcon("icon_reuse.png", HierarchicalTableGenerator.TEXT_ICON_REUSE);
row.getCells().add(c = gen.new Cell("see ", "#" + t.substring(1), t.substring(t.lastIndexOf(".") + 1), t.substring(1), null));
// analysis
row.getCells().add(dc = gen.new Cell());
} else if (t.equals("Reference") || t.equals("canonical")) {
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
row.getCells().add(c = gen.new Cell());
c.getPieces().add(gen.new Piece(prefix + "references.html", t, null));
c.getPieces().add(gen.new Piece(null, "(", null));
boolean first = true;
for (String rt : e.getTypes().get(0).getParams()) {
if (definitions.hasLogicalModel(rt)) {
for (String rtn : definitions.getLogicalModel(rt).getImplementations()) {
if (!first)
c.getPieces().add(gen.new Piece(null, " | ", null));
c.getPieces().add(gen.new Piece(prefix + findPage(rtn) + ".html", rtn, null));
first = false;
}
} else {
if (!first)
c.getPieces().add(gen.new Piece(null, " | ", null));
if (first && isProfile && e.getTypes().get(0).getProfile() != null)
c.getPieces().add(gen.new Piece(null, e.getTypes().get(0).getProfile(), null));
else
c.getPieces().add(gen.new Piece(prefix + findPage(rt) + ".html", rt, null));
first = false;
}
}
c.getPieces().add(gen.new Piece(null, ")", null));
// analysis
row.getCells().add(dc = gen.new Cell());
for (String rt : e.getTypes().get(0).getParams()) if (definitions.hasLogicalModel(rt)) {
for (String rtn : definitions.getLogicalModel(rt).getImplementations()) {
addTypeToAnalysis(gen, row, dc, true, e.getStandardsStatus(), rtn);
}
} else
addTypeToAnalysis(gen, row, dc, true, e.getStandardsStatus(), rt);
} else if (definitions.getPrimitives().containsKey(t)) {
row.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE);
row.getCells().add(c = gen.new Cell(null, prefix + "datatypes.html#" + t, t, null, null));
// analysis
row.getCells().add(dc = gen.new Cell());
addTypeToAnalysis(gen, row, dc, false, e.getStandardsStatus(), e.typeCode());
} else {
if (t.equals("Extension"))
row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION);
else
row.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
row.getCells().add(c = gen.new Cell(null, prefix + definitions.getSrcFile(t) + ".html#" + t.replace("*", "open"), t, null, null));
// analysis
row.getCells().add(dc = gen.new Cell());
addTypeToAnalysis(gen, row, dc, false, e.getStandardsStatus(), t);
}
} else {
row.getCells().add(gen.new Cell(null, null, e.describeCardinality(), null, null));
row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE);
row.getCells().add(gen.new Cell(null, null, "", null, null));
// analysis
row.getCells().add(dc = gen.new Cell());
}
}
if (e.hasBinding() && e.getBinding() != null && e.getBinding().getBinding() != BindingMethod.Unbound && (e.getBinding().getStrength() == BindingStrength.REQUIRED || e.getBinding().getStrength() == BindingStrength.EXTENSIBLE)) {
addBindingToAnalysis(gen, row, dc, e.getBinding().getStrength() == BindingStrength.REQUIRED, e.getStandardsStatus(), e.getBinding());
// if (cc.getPieces().size() == 1)
// cc.addPiece(gen.new Piece("br"));
// cc.getPieces().add(gen.new Piece(getBindingLink(prefix, e), e.getBinding().getValueSet() != null ? e.getBinding().getValueSet().getName() : e.getBinding().getName(),
// e.getBinding().getDefinition()));
// cc.getPieces().add(gen.new Piece(null, " (", null));
// BindingSpecification b = e.getBinding();
// if (b.hasMax() ) {
// cc.getPieces().add(gen.new Piece(prefix+"terminologies.html#"+b.getStrength().toCode(), b.getStrength().getDisplay(), b.getStrength().getDefinition()));
// cc.getPieces().add(gen.new Piece(null, " but limited to ", null));
// ValueSet vs = b.getMaxValueSet();
// cc.getPieces().add(gen.new Piece(vs.getUserString("path"), vs.getName(), null));
// } else
// cc.getPieces().add(gen.new Piece(prefix+"terminologies.html#"+b.getStrength().toCode(), b.getStrength().getDisplay(), b.getStrength().getDefinition()));
// cc.getPieces().add(gen.new Piece(null, ")", null));
}
if (e.getTypes().size() > 1) {
// create a child for each choice
for (TypeRef tr : e.getTypes()) {
Row choicerow = gen.new Row();
String t = tr.getName();
if (t.equals("Reference")) {
choicerow.getCells().add(gen.new Cell(null, null, e.getName().replace("[x]", "Reference"), null, null));
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);
c.getPieces().add(gen.new Piece(prefix + "references.html", "Reference", null));
c.getPieces().add(gen.new Piece(null, "(", null));
boolean first = true;
List<String> tt = new ArrayList<>();
for (String rt : tr.getParams()) {
if (definitions.hasLogicalModel(rt))
tt.addAll(definitions.getLogicalModel(rt).getImplementations());
else
tt.add(rt);
}
Collections.sort(tt);
for (String rt : tt) {
if (!first)
c.getPieces().add(gen.new Piece(null, " | ", null));
c.getPieces().add(gen.new Piece(prefix + findPage(rt) + ".html", rt, null));
first = false;
}
// analysis
choicerow.getCells().add(dc = gen.new Cell());
for (String rt : tt) addTypeToAnalysis(gen, choicerow, dc, true, e.getStandardsStatus(), rt);
} else if (definitions.getPrimitives().containsKey(t)) {
choicerow.getCells().add(gen.new Cell(null, null, e.getName().replace("[x]", Utilities.capitalize(t)), definitions.getPrimitives().get(t).getDefinition(), null));
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, prefix + "datatypes.html#" + t, t, null, null));
// analysis
choicerow.getCells().add(dc = gen.new Cell());
addTypeToAnalysis(gen, choicerow, dc, false, e.getStandardsStatus(), t);
} else if (definitions.getConstraints().containsKey(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(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));
// analysis
choicerow.getCells().add(dc = gen.new Cell());
addTypeToAnalysis(gen, choicerow, dc, false, e.getStandardsStatus(), t);
} else {
choicerow.getCells().add(gen.new Cell(null, null, e.getName().replace("[x]", Utilities.capitalize(t)), definitions.getTypes().containsKey(t) ? definitions.getTypes().get(t).getDefinition() : null, null));
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));
// analysis
choicerow.getCells().add(dc = gen.new Cell());
addTypeToAnalysis(gen, choicerow, dc, false, e.getStandardsStatus(), t);
}
row.getSubRows().add(choicerow);
}
} else
for (ElementDefn c : e.getElements()) row.getSubRows().add(genElement(c, gen, false, path + '.' + c.getName(), isProfile, prefix, mode, false));
return row;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project kindling by HL7.
the class TableGenerator method genElement.
protected Row genElement(ElementDefn e, HierarchicalTableGenerator gen, boolean resource, String path, boolean isProfile, String prefix, RenderMode mode, boolean isRoot, StandardsStatus rootStatus, boolean isAbstract, boolean isInterface) throws Exception {
Row row = gen.new Row();
row.setAnchor(path);
boolean isProfiledExtension = isProfile && (e.getName().equals("extension") || e.getName().equals("modifierExtension"));
row.getCells().add(gen.new Cell(null, dictLinks() ? pageName + "#" + path.replace("[", "_").replace("]", "_") : null, e.getName(), path + " : " + e.getDefinition(), null));
Cell gc = gen.new Cell();
row.getCells().add(gc);
if (e.hasMustSupport() && e.isMustSupport()) {
gc.addStyledText("This element must be supported", "S", "white", "red", prefix + "conformance-rules.html#mustSupport", false);
}
if (e.isModifier()) {
gc.addStyledText("This element is a modifier element", "?!", null, null, prefix + "conformance-rules.html#isModifier", false);
}
if (e.isSummary()) {
gc.addStyledText("This element is included in summaries", "\u03A3", null, null, prefix + "elementdefinition-definitions.html#ElementDefinition.isSummary", false);
}
if (!isRoot && (!e.getInvariants().isEmpty() || !e.getStatedInvariants().isEmpty())) {
gc.addStyledText("This element has or is affected by some invariants", "I", null, null, prefix + "conformance-rules.html#constraints", false);
}
if (isInterface) {
gc.addStyledText("This is an abstract type", "«A»", null, null, prefix + "uml.html#abstract", false);
} else if (isAbstract) {
gc.addStyledText("This is an interface resource", "«I»", null, null, prefix + "uml.html#interface", false);
}
if (rootStatus != null)
gc.addStyledText("Standards Status = " + rootStatus.toDisplay(), rootStatus.getAbbrev(), "black", rootStatus.getColor(), prefix + "versions.html#std-process", true);
else if (e.getStandardsStatus() != null)
gc.addStyledText("Standards Status = " + e.getStandardsStatus().toDisplay(), e.getStandardsStatus().getAbbrev(), "black", e.getStandardsStatus().getColor(), prefix + "versions.html#std-process", true);
if (resource) {
row.getCells().add(gen.new Cell());
row.setIcon("icon_resource.png", HierarchicalTableGenerator.TEXT_ICON_RESOURCE);
if (Utilities.noString(e.typeCode()))
row.getCells().add(gen.new Cell(null, null, "n/a", null, null));
else if ("Logical".equals(e.typeCode()))
row.getCells().add(gen.new Cell(null, prefix + "structuredefinition.html#logical", e.typeCode(), null, null));
else if ("Base".equals(e.typeCode()))
row.getCells().add(gen.new Cell(null, prefix + definitions.getSrcFile("Base") + ".html#" + e.typeCode(), e.typeCode(), null, null));
else
row.getCells().add(gen.new Cell(null, prefix + e.typeCode().toLowerCase() + ".html", e.typeCode(), null, null));
// todo: base elements
} else {
if (!e.getElements().isEmpty()) {
row.getCells().add(gen.new Cell(null, null, path.contains(".") ? e.describeCardinality() : "", null, null));
row.setIcon("icon_element.gif", HierarchicalTableGenerator.TEXT_ICON_ELEMENT);
if (mode == RenderMode.RESOURCE)
row.getCells().add(gen.new Cell(null, prefix + definitions.getBackboneLink(), "BackboneElement", null, null));
else if (e.getName().equals("Type"))
row.getCells().add(gen.new Cell(null, null, "", null, null));
else if (e.getName().equals("Element")) {
if (version.isR4B()) {
row.getCells().add(gen.new Cell(null, prefix + definitions.getElementLink(), "Element", null, null));
} else {
row.getCells().add(gen.new Cell(null, prefix + definitions.getBaseLink(), "Base", null, null));
}
} else if (e.typeCode().equals("BackboneElement"))
row.getCells().add(gen.new Cell(null, prefix + definitions.getBackboneLink(), "BackBoneElement", null, null));
else
row.getCells().add(gen.new Cell(null, prefix + definitions.getElementLink(), "Element", null, null));
} else if (e.getTypes().size() == 1) {
row.getCells().add(gen.new Cell(null, null, path.contains(".") ? e.describeCardinality() : "", null, null));
String t = e.getTypes().get(0).getName();
Cell c;
if (t.startsWith("@")) {
row.setIcon("icon_reuse.png", HierarchicalTableGenerator.TEXT_ICON_REUSE);
c = gen.new Cell("see ", "#" + t.substring(1), t.substring(t.lastIndexOf(".") + 1), t.substring(1), null);
} else if (isReference(t)) {
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
c = gen.new Cell();
if (ADD_REFERENCE_TO_TABLE) {
c.getPieces().add(gen.new Piece(prefix + definitions.getSrcFile(t) + ".html#" + t, t, null));
c.getPieces().add(gen.new Piece(null, "(", null));
}
boolean first = true;
for (String rt : e.getTypes().get(0).getParams()) {
if (!first)
c.getPieces().add(gen.new Piece(null, " | ", null));
if (first && isProfile && e.getTypes().get(0).getProfile() != null)
c.getPieces().add(gen.new Piece(null, e.getTypes().get(0).getProfile(), null));
else
c.getPieces().add(gen.new Piece(prefix + findPage(rt) + ".html", rt, null));
first = false;
}
if (ADD_REFERENCE_TO_TABLE)
c.getPieces().add(gen.new Piece(null, ")", null));
} else if (definitions.getPrimitives().containsKey(t)) {
row.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE);
c = gen.new Cell(null, prefix + "datatypes.html#" + t, t, null, null);
} else {
if (t.equals("Extension"))
row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION);
else
row.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
c = gen.new Cell(null, prefix + definitions.getSrcFile(t) + ".html#" + t.replace("*", "open"), t, null, null);
}
row.getCells().add(c);
} else {
row.getCells().add(gen.new Cell(null, null, isRoot ? "" : e.describeCardinality(), null, null));
row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE);
row.getCells().add(gen.new Cell(null, null, "", null, null));
}
}
Cell cc = gen.new Cell(null, e.getShortDefn() != null && Utilities.isURL(e.getShortDefn()) ? e.getShortDefn() : null, e.getShortDefn(), null, null);
row.getCells().add(cc);
// constraints
if (isProfiledExtension) {
cc.addPiece(gen.new Piece("br"));
cc.getPieces().add(gen.new Piece(null, e.getTypes().get(0).getProfile(), null));
}
if (e.hasBinding() && e.getBinding() != null && e.getBinding().getBinding() != BindingMethod.Unbound) {
if (cc.getPieces().size() == 1)
cc.addPiece(gen.new Piece("br"));
cc.getPieces().add(gen.new Piece(getBindingLink(prefix, e), e.getBinding().getValueSet() != null ? e.getBinding().getValueSet().present() : e.getBinding().getName(), e.getBinding().getDefinition()));
cc.getPieces().add(gen.new Piece(null, " (", null));
BindingSpecification b = e.getBinding();
if (b.hasMax()) {
cc.getPieces().add(gen.new Piece(prefix + "terminologies.html#" + b.getStrength().toCode(), b.getStrength().getDisplay(), b.getStrength().getDefinition()));
cc.getPieces().add(gen.new Piece(null, " but limited to ", null));
ValueSet vs = b.getMaxValueSet();
if (vs == null)
cc.getPieces().add(gen.new Piece(b.getMaxReference(), b.getMaxReference(), null));
else
cc.getPieces().add(gen.new Piece(vs.hasUserData("external.url") ? vs.getUserString("external.url") : vs.getUserString("path"), vs.getName(), null));
} else
cc.getPieces().add(gen.new Piece(prefix + "terminologies.html#" + b.getStrength().toCode(), b.getStrength().getDisplay(), b.getStrength().getDefinition()));
cc.getPieces().add(gen.new Piece(null, ")", null));
}
List<String> invs = new ArrayList<String>(e.getInvariants().keySet());
Collections.sort(invs, new ConstraintsSorter());
for (String name : invs) {
Invariant inv = e.getInvariants().get(name);
cc.addPiece(gen.new Piece("br"));
cc.getPieces().add(gen.new Piece(null, "+ " + presentLevel(inv) + ": " + inv.getEnglish(), inv.getId()).setStyle("font-style: italic"));
}
if (e.unbounded() && !isRoot) {
if (cc.getPieces().size() > 0)
cc.addPiece(gen.new Piece("br"));
if (Utilities.noString(e.getOrderMeaning())) {
// don't show this, this it's important: cc.getPieces().add(gen.new Piece(null, "This repeating element has no defined order", null));
} else {
cc.getPieces().add(gen.new Piece(null, "This repeating element order: " + e.getOrderMeaning(), null));
}
}
if (isRoot && !Utilities.noString(e.typeCode()) && !"Logical".equals(e.typeCode())) {
List<ElementDefn> ancestors = new ArrayList<ElementDefn>();
ElementDefn f = definitions.getElementDefn(e.typeCode());
while (f != null) {
ancestors.add(0, f);
f = Utilities.noString(f.typeCode()) || "Logical".equals(f.typeCode()) ? null : definitions.getElementDefn(f.typeCode());
}
cc.getPieces().add(gen.new Piece("br"));
cc.getPieces().add(gen.new Piece(null, "Elements defined in Ancestors: ", null));
boolean first = true;
for (ElementDefn fi : ancestors) {
for (ElementDefn fc : fi.getElements()) {
if (first)
first = false;
else
cc.getPieces().add(gen.new Piece(null, ", ", null));
cc.getPieces().add(gen.new Piece(definitions.getSrcFile(fi.getName()) + ".html#" + fi.getName(), fc.getName(), fc.getDefinition()));
}
}
}
if (mode == RenderMode.LOGICAL) {
String logical = e.getMappings().get("http://hl7.org/fhir/logical");
Cell c = gen.new Cell();
row.getCells().add(c);
if (logical != null)
presentLogicalMapping(gen, c, logical, prefix);
}
if (e.getTypes().size() > 1) {
// create a child for each choice
for (TypeRef tr : e.getTypes()) {
Row choicerow = gen.new Row();
String t = tr.getName();
if (isReference(t)) {
choicerow.getCells().add(gen.new Cell(null, null, e.getName().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.getName().equals("canonical"))
c.getPieces().add(gen.new Piece(prefix + "datatypes.html#canonical", "canonical", null));
else
c.getPieces().add(gen.new Piece(prefix + "references.html#Reference", "Reference", null));
c.getPieces().add(gen.new Piece(null, "(", null));
}
boolean first = true;
for (String rt : tr.getParams()) {
if (!first)
c.getPieces().add(gen.new Piece(null, " | ", null));
c.getPieces().add(gen.new Piece(prefix + findPage(rt) + ".html", rt, null));
first = false;
}
if (ADD_REFERENCE_TO_TABLE)
c.getPieces().add(gen.new Piece(null, ")", null));
} else if (definitions.getPrimitives().containsKey(t)) {
choicerow.getCells().add(gen.new Cell(null, null, e.getName().replace("[x]", Utilities.capitalize(t)), definitions.getPrimitives().get(t).getDefinition(), 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, prefix + "datatypes.html#" + t, t, null, null));
} else if (definitions.getConstraints().containsKey(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, e.getName().replace("[x]", Utilities.capitalize(t)), 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));
}
choicerow.getCells().add(gen.new Cell());
// choicerow.getCells().add(gen.new Cell());
row.getSubRows().add(choicerow);
}
} else
for (ElementDefn c : e.getElements()) {
row.getSubRows().add(genElement(c, gen, false, path + '.' + c.getName(), isProfile, prefix, mode, false, null, false, false));
}
return row;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateDescription.
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);
if (used) {
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));
}
}
if (definition.hasContentReference()) {
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));
}
if (definition.getPath().endsWith("url") && definition.hasFixed()) {
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 (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);
String ref = null;
String ref2 = null;
String fixedUrl = null;
if (ed != null) {
String p = ed.getUserString("path");
if (p != null) {
ref = p.startsWith("http:") || igmode ? p : Utilities.pathURL(corePath, p);
}
fixedUrl = getFixedUrl(ed);
if (fixedUrl != null) {
// if its null, we guess that it's not a profiled extension?
if (fixedUrl.equals(url))
fixedUrl = null;
else {
StructureDefinition ed2 = context.fetchResource(StructureDefinition.class, fixedUrl);
if (ed2 != null) {
String p2 = ed2.getUserString("path");
if (p2 != null) {
ref2 = p2.startsWith("http:") || igmode ? p2 : Utilities.pathURL(corePath, p2);
}
}
}
}
}
if (fixedUrl == null) {
c.getPieces().add(gen.new Piece(null, translate("sd.table", "URL") + ": ", null).addStyle("font-weight:bold"));
c.getPieces().add(gen.new Piece(ref, fullUrl, null));
} else {
// reference to a profile take on the extension show the base URL
c.getPieces().add(gen.new Piece(null, translate("sd.table", "URL") + ": ", null).addStyle("font-weight:bold"));
c.getPieces().add(gen.new Piece(ref2, fixedUrl, null));
c.getPieces().add(gen.new Piece(null, translate("sd.table", " profiled by ") + " ", null).addStyle("font-weight:bold"));
c.getPieces().add(gen.new Piece(ref, fullUrl, null));
}
}
if (definition.hasSlicing()) {
if (!c.getPieces().isEmpty())
c.addPiece(gen.new Piece("br"));
c.getPieces().add(gen.new Piece(null, translate("sd.table", "Slice") + ": ", null).addStyle("font-weight:bold"));
c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null));
}
if (definition != null) {
ElementDefinitionBindingComponent binding = null;
if (valueDefn != null && valueDefn.hasBinding() && !valueDefn.getBinding().isEmpty())
binding = valueDefn.getBinding();
else if (definition.hasBinding())
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, translate("sd.table", "Binding") + ": ", null).addStyle("font-weight:bold")));
c.getPieces().add(checkForNoChange(binding, gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath + br.url, br.display, null)));
if (binding.hasStrength()) {
c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, " (", null)));
c.getPieces().add(checkForNoChange(binding, gen.new Piece(corePath + "terminologies.html#" + binding.getStrength().toCode(), egt(binding.getStrengthElement()), binding.getStrength().getDefinition())));
c.getPieces().add(gen.new Piece(null, ")", null));
}
if (binding.hasExtension(ToolingExtensions.EXT_MAX_VALUESET)) {
br = pkp.resolveBinding(profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MAX_VALUESET), definition.getPath());
c.addPiece(gen.new Piece("br"));
c.getPieces().add(checkForNoChange(binding, gen.new Piece(corePath + "extension-elementdefinition-maxvalueset.html", translate("sd.table", "Max Binding") + ": ", "Max Value Set Extension").addStyle("font-weight:bold")));
c.getPieces().add(checkForNoChange(binding, gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath + br.url, br.display, null)));
}
if (binding.hasExtension(ToolingExtensions.EXT_MIN_VALUESET)) {
br = pkp.resolveBinding(profile, ToolingExtensions.readStringExtension(binding, ToolingExtensions.EXT_MIN_VALUESET), definition.getPath());
c.addPiece(gen.new Piece("br"));
c.getPieces().add(checkForNoChange(binding, gen.new Piece(corePath + "extension-elementdefinition-minvalueset.html", translate("sd.table", "Min Binding") + ": ", "Min Value Set Extension").addStyle("font-weight:bold")));
c.getPieces().add(checkForNoChange(binding, gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !pkp.prependLinks() ? br.url : corePath + br.url, br.display, null)));
}
}
for (ElementDefinitionConstraintComponent inv : definition.getConstraint()) {
if (!inv.hasSource() || allInvariants) {
if (!c.getPieces().isEmpty())
c.addPiece(gen.new Piece("br"));
c.getPieces().add(checkForNoChange(inv, gen.new Piece(null, inv.getKey() + ": ", null).addStyle("font-weight:bold")));
c.getPieces().add(checkForNoChange(inv, gen.new Piece(null, gt(inv.getHumanElement()), null)));
}
}
if ((definition.hasBase() && definition.getBase().getMax().equals("*")) || (definition.hasMax() && definition.getMax().equals("*"))) {
if (c.getPieces().size() > 0)
c.addPiece(gen.new Piece("br"));
if (definition.hasOrderMeaning()) {
c.getPieces().add(gen.new Piece(null, "This repeating element order: " + definition.getOrderMeaning(), null));
} else {
// don't show this, this it's important: c.getPieces().add(gen.new Piece(null, "This repeating element has no defined order", null));
}
}
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")));
if (!useTableForFixedValues || definition.getFixed().isPrimitive()) {
String s = buildJson(definition.getFixed());
String link = null;
if (Utilities.isAbsoluteUrl(s))
link = pkp.getLinkForUrl(corePath, s);
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(link, s, null).addStyle("color: darkgreen")));
} else {
c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "As shown", null).addStyle("color: darkgreen")));
genFixedValue(gen, row, definition.getFixed(), snapshot, false, corePath);
}
if (isCoded(definition.getFixed()) && !hasDescription(definition.getFixed())) {
Piece p = describeCoded(gen, definition.getFixed());
if (p != null)
c.getPieces().add(p);
}
} 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 (!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, "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()) {
if (!c.getPieces().isEmpty())
c.addPiece(gen.new Piece("br"));
c.getPieces().add(checkForNoChange(ex, gen.new Piece(null, translate("sd.table", "Example") + ("".equals("General") ? "" : " " + ex.getLabel() + "'") + ": ", null).addStyle("font-weight:bold")));
c.getPieces().add(checkForNoChange(ex, gen.new Piece(null, buildJson(ex.getValue()), null).addStyle("color: darkgreen")));
}
}
if (definition.hasMaxLength() && definition.getMaxLength() != 0) {
if (!c.getPieces().isEmpty())
c.addPiece(gen.new Piece("br"));
c.getPieces().add(checkForNoChange(definition.getMaxLengthElement(), gen.new Piece(null, "Max Length: ", null).addStyle("font-weight:bold")));
c.getPieces().add(checkForNoChange(definition.getMaxLengthElement(), gen.new Piece(null, Integer.toString(definition.getMaxLength()), null).addStyle("color: darkgreen")));
}
if (profile != null) {
for (StructureDefinitionMappingComponent md : profile.getMapping()) {
if (md.hasExtension(ToolingExtensions.EXT_TABLE_NAME)) {
ElementDefinitionMappingComponent map = null;
for (ElementDefinitionMappingComponent m : definition.getMapping()) if (m.getIdentity().equals(md.getIdentity()))
map = m;
if (map != null) {
for (int i = 0; i < definition.getMapping().size(); i++) {
c.addPiece(gen.new Piece("br"));
c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(md, ToolingExtensions.EXT_TABLE_NAME) + ": " + map.getMap(), null));
}
}
}
}
}
}
}
}
return c;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method genElement.
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 = s + ":" + element.getSliceName();
Row typesRow = null;
List<ElementDefinition> children = getChildren(all, element);
boolean isExtension = (s.equals("extension") || s.equals("modifierExtension"));
if (!onlyInformationIsMapping(all, element)) {
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 (tail(element.getPath()).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 (tail(element.getPath()).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);
typesRow = row;
}
} else if (hasDef && element.getType().get(0).getWorkingCode() != null && element.getType().get(0).getWorkingCode().startsWith("@"))
row.setIcon("icon_reuse.png", HierarchicalTableGenerator.TEXT_ICON_REUSE);
else if (hasDef && isPrimitive(element.getType().get(0).getWorkingCode()))
row.setIcon("icon_primitive.png", HierarchicalTableGenerator.TEXT_ICON_PRIMITIVE);
else if (hasDef && element.getType().get(0).hasTarget())
row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE);
else if (hasDef && isDataType(element.getType().get(0).getWorkingCode()))
row.setIcon("icon_datatype.gif", HierarchicalTableGenerator.TEXT_ICON_DATATYPE);
else
row.setIcon("icon_resource.png", HierarchicalTableGenerator.TEXT_ICON_RESOURCE);
String ref = defPath == null ? null : defPath + element.getId();
UnusedTracker used = new UnusedTracker();
used.used = true;
if (logicalModel && element.hasRepresentation(PropertyRepresentation.XMLATTR))
s = "@" + s;
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);
ExtensionContext extDefn = null;
if (ext) {
if (element != null && element.getType().size() == 1 && element.getType().get(0).hasProfile()) {
String eurl = element.getType().get(0).getProfile().get(0).getValue();
extDefn = locateExtension(StructureDefinition.class, eurl);
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, snapshot);
} else {
String name = urltail(eurl);
left.getPieces().get(0).setText(name);
// left.getPieces().get(0).setReference((String) extDefn.getExtensionStructure().getTag("filename"));
left.getPieces().get(0).setHint(translate("sd.table", "Extension URL") + " = " + extDefn.getUrl());
genCardinality(gen, element, row, hasDef, used, extDefn.getElement());
ElementDefinition valueDefn = extDefn.getExtensionValueDefinition();
if (valueDefn != null && !"0".equals(valueDefn.getMax()))
genTypes(gen, row, valueDefn, profileBaseFileName, profile, corePath, imagePath);
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, snapshot);
}
} else {
genCardinality(gen, element, row, hasDef, used, null);
if ("0".equals(element.getMax()))
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, snapshot);
}
} else {
genCardinality(gen, element, row, hasDef, used, null);
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, snapshot);
}
if (element.hasSlicing()) {
if (standardExtensionSlicing(element)) {
// doesn't matter whether we have a type, we're used if we're setting up slicing ... element.hasType() && element.getType().get(0).hasProfile();
used.used = true;
// ?
showMissing = false;
} else {
row.setIcon("icon_slice.png", HierarchicalTableGenerator.TEXT_ICON_SLICE);
slicingRow = row;
for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) {
p.addStyle("font-style: italic");
}
}
} else if (element.hasSliceName()) {
row.setIcon("icon_slice_item.png", HierarchicalTableGenerator.TEXT_ICON_SLICE_ITEM);
}
if (used.used || showMissing)
rows.add(row);
if (!used.used && !element.hasSlicing()) {
for (Cell cell : row.getCells()) for (Piece p : cell.getPieces()) {
p.setStyle("text-decoration:line-through");
p.setReference(null);
}
} 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)))
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, profileBaseFileName);
}
}
return slicingRow;
}
Aggregations