Search in sources :

Example 46 with HierarchicalTableGenerator

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;
}
Also used : Coding(org.hl7.fhir.r5.model.Coding) Piece(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece) ValidationResult(org.hl7.fhir.r5.context.IWorkerContext.ValidationResult) CodeableConcept(org.hl7.fhir.r5.model.CodeableConcept)

Example 47 with HierarchicalTableGenerator

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);
}
Also used : HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel) HashSet(java.util.HashSet)

Example 48 with HierarchicalTableGenerator

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;
}
Also used : Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Example 49 with HierarchicalTableGenerator

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;
}
Also used : Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)

Example 50 with HierarchicalTableGenerator

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;
}
Also used : CapabilityStatementRestComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestComponent) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Aggregations

Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)99 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)83 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)67 TableModel (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)51 HierarchicalTableGenerator (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator)45 ArrayList (java.util.ArrayList)25 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)17 FHIRException (org.hl7.fhir.exceptions.FHIRException)14 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)13 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)13 ElementDefinition (org.hl7.fhir.r4.model.ElementDefinition)10 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)9 StructureDefinition (org.hl7.fhir.r4.model.StructureDefinition)9 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)9 ElementDefinition (org.hl7.fhir.r4b.model.ElementDefinition)8 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)7 HashSet (java.util.HashSet)6 List (java.util.List)6 ElementDefinition (org.hl7.fhir.dstu2016may.model.ElementDefinition)6 ElementDefinition (org.hl7.fhir.dstu2.model.ElementDefinition)5