Search in sources :

Example 21 with DataElement

use of org.hl7.fhir.dstu2016may.model.DataElement in project org.hl7.fhir.core by hapifhir.

the class ResourceUtilities method renderDE.

private static void renderDE(DataElement de, List<String> cols, StringBuilder b, boolean profileLink, String linkBase) {
    b.append("<tr>");
    for (String col : cols) {
        String v;
        ElementDefinition dee = de.getElement().get(0);
        if (col.equals("DataElement.name")) {
            v = de.hasName() ? Utilities.escapeXml(de.getName()) : "";
        } else if (col.equals("DataElement.status")) {
            v = de.hasStatusElement() ? de.getStatusElement().asStringValue() : "";
        } else if (col.equals("DataElement.code")) {
            v = renderCoding(dee.getCode());
        } else if (col.equals("DataElement.type")) {
            v = dee.hasType() ? Utilities.escapeXml(dee.getType().get(0).getCode()) : "";
        } else if (col.equals("DataElement.units")) {
            v = renderDEUnits(ToolingExtensions.getAllowedUnits(dee));
        } else if (col.equals("DataElement.binding")) {
            v = renderBinding(dee.getBinding());
        } else if (col.equals("DataElement.minValue")) {
            v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/minValue") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/minValue").asStringValue()) : "";
        } else if (col.equals("DataElement.maxValue")) {
            v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/maxValue") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/maxValue").asStringValue()) : "";
        } else if (col.equals("DataElement.maxLength")) {
            v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/maxLength") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/maxLength").asStringValue()) : "";
        } else if (col.equals("DataElement.mask")) {
            v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/mask") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/mask").asStringValue()) : "";
        } else
            throw new Error("Unknown column name: " + col);
        b.append("<td>" + v + "</td>");
    }
    if (profileLink) {
        b.append("<td><a href=\"" + linkBase + "-" + de.getId() + ".html\">Profile</a>, <a href=\"http://www.opencem.org/#/20140917/Intermountain/" + de.getId() + "\">CEM</a>");
        if (ToolingExtensions.hasExtension(de, ToolingExtensions.EXT_CIMI_REFERENCE))
            b.append(", <a href=\"" + ToolingExtensions.readStringExtension(de, ToolingExtensions.EXT_CIMI_REFERENCE) + "\">CIMI</a>");
        b.append("</td>");
    }
    b.append("</tr>\r\n");
}
Also used : ElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition)

Example 22 with DataElement

use of org.hl7.fhir.dstu2016may.model.DataElement in project org.hl7.fhir.core by hapifhir.

the class ResourceUtilities method representDataElementCollection.

public static String representDataElementCollection(IWorkerContext context, Bundle bundle, boolean profileLink, String linkBase) {
    StringBuilder b = new StringBuilder();
    DataElement common = showDECHeader(b, bundle);
    b.append("<table class=\"grid\">\r\n");
    List<String> cols = chooseColumns(bundle, common, b, profileLink);
    for (BundleEntryComponent e : bundle.getEntry()) {
        DataElement de = (DataElement) e.getResource();
        renderDE(de, cols, b, profileLink, linkBase);
    }
    b.append("</table>\r\n");
    return b.toString();
}
Also used : DataElement(org.hl7.fhir.dstu2016may.model.DataElement) BundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Aggregations

BundleEntryComponent (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent)3 DataElement (org.hl7.fhir.dstu2.model.DataElement)3 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)3 BundleEntryComponent (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent)3 DataElement (org.hl7.fhir.dstu2016may.model.DataElement)3 BundleEntryComponent (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent)3 DataElement (org.hl7.fhir.dstu3.model.DataElement)3 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)3 Element (org.w3c.dom.Element)3 FileOutputStream (java.io.FileOutputStream)2 ElementDefinition (org.hl7.fhir.dstu2.model.ElementDefinition)2 ElementDefinition (org.hl7.fhir.dstu2016may.model.ElementDefinition)2 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)2 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 Test (org.junit.jupiter.api.Test)2 File (java.io.File)1 ContactPoint (org.hl7.fhir.dstu2.model.ContactPoint)1 DataElementContactComponent (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent)1 Identifier (org.hl7.fhir.dstu2.model.Identifier)1