use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method describeCoded.
private Piece describeCoded(HierarchicalTableGenerator gen, DataType fixed) {
if (fixed instanceof Coding) {
Coding c = (Coding) fixed;
ValidationResult vr = context.validateCode(terminologyServiceOptions, c.getSystem(), c.getVersion(), c.getCode(), c.getDisplay());
if (vr.getDisplay() != null)
return gen.new Piece(null, " (" + vr.getDisplay() + ")", null).addStyle("color: darkgreen");
} else if (fixed instanceof CodeableConcept) {
CodeableConcept cc = (CodeableConcept) fixed;
for (Coding c : cc.getCoding()) {
ValidationResult vr = context.validateCode(terminologyServiceOptions, c.getSystem(), c.getVersion(), c.getCode(), c.getDisplay());
if (vr.getDisplay() != null)
return gen.new Piece(null, " (" + vr.getDisplay() + ")", null).addStyle("color: darkgreen");
}
}
return null;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateSpanningTable.
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true);
gen.setTranslator(getTranslator());
TableModel model = initSpanningTable(gen, "", false, profile.getId());
Set<String> processed = new HashSet<String>();
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
genSpanEntry(gen, model.getRows(), span);
return gen.generate(model, "", 0, outputTracker);
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method genElementNameCell.
public Cell genElementNameCell(HierarchicalTableGenerator gen, ElementDefinition element, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, StructureDefinition profile, Row typesRow, Row row, boolean hasDef, boolean ext, UnusedTracker used, String ref, String sName, List<ElementDefinition> elements) throws IOException {
String hint = "";
hint = checkAdd(hint, (element.hasSliceName() ? translate("sd.table", "Slice") + " " + element.getSliceName() : ""));
if (hasDef && element.hasDefinition()) {
hint = checkAdd(hint, (hasDef && element.hasSliceName() ? ": " : ""));
hint = checkAdd(hint, !hasDef ? null : gt(element.getDefinitionElement()));
}
if (element.hasSlicing() && slicesExist(elements, element)) {
// some elements set up slicing but don't actually slice, so we don't augment the name
sName = "Slices for " + sName;
}
Cell left = gen.new Cell(null, ref, sName, hint, null);
row.getCells().add(left);
return left;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method addRestOperationRow.
private Row addRestOperationRow(HierarchicalTableGenerator gen, List<Row> rows, StructuralMatch<Element> t, CapabilityStatementComparison comparison) {
Row r = gen.new Row();
rows.add(r);
r.getCells().add(gen.new Cell(null, null, "operation", null, null));
CapabilityStatementRestResourceOperationComponent left = t.hasLeft() ? (CapabilityStatementRestResourceOperationComponent) t.getLeft() : null;
CapabilityStatementRestResourceOperationComponent right = t.hasRight() ? (CapabilityStatementRestResourceOperationComponent) t.getRight() : null;
r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, true));
r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, false));
r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
r.getCells().add(cellForMessages(gen, t.getMessages()));
return r;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method addRestRow.
private Row addRestRow(HierarchicalTableGenerator gen, List<Row> rows, StructuralMatch<Element> t, CapabilityStatementComparison comparison) {
Row r = gen.new Row();
rows.add(r);
r.getCells().add(gen.new Cell(null, null, "mode", null, null));
CapabilityStatementRestComponent left = t.hasLeft() ? (CapabilityStatementRestComponent) t.getLeft() : null;
CapabilityStatementRestComponent right = t.hasRight() ? (CapabilityStatementRestComponent) t.getRight() : null;
r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getMode().toCode() : "", null, null), left != null ? left.getMode().toCode() : null, right != null ? right.getMode().toCode() : null, true));
r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getMode().toCode() : "", null, null), left != null ? left.getMode().toCode() : null, right != null ? right.getMode().toCode() : null, false));
r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
r.getCells().add(cellForMessages(gen, t.getMessages()));
return r;
}
Aggregations