Search in sources :

Example 11 with ResourceRenderer

use of org.hl7.fhir.r5.renderers.ResourceRenderer in project org.hl7.fhir.core by hapifhir.

the class ParametersRenderer method params.

private void params(XhtmlNode tbl, List<ParametersParameterComponent> list, int indent) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
    for (ParametersParameterComponent p : list) {
        XhtmlNode tr = tbl.tr();
        XhtmlNode td = tr.td();
        for (int i = 0; i < indent; i++) {
            td.tx(XhtmlNode.NBSP);
        }
        td.tx(p.getName());
        if (p.hasValue()) {
            render(tr.td(), p.getValue());
        } else if (p.hasResource()) {
            Resource r = p.getResource();
            td = tr.td();
            XhtmlNode para = td.para();
            para.tx(r.fhirType() + "/" + r.getId());
            para.an(r.fhirType() + "_" + r.getId()).tx(" ");
            ResourceRenderer rr = RendererFactory.factory(r, context);
            rr.render(td, r);
        } else if (p.hasPart()) {
            tr.td();
            params(tbl, p.getPart(), 1);
        }
    }
}
Also used : Resource(org.hl7.fhir.r4b.model.Resource) DomainResource(org.hl7.fhir.r4b.model.DomainResource) ParametersParameterComponent(org.hl7.fhir.r4b.model.Parameters.ParametersParameterComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)9 IOException (java.io.IOException)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 FHIRException (org.hl7.fhir.exceptions.FHIRException)5 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)4 ResourceWrapper (org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper)4 DomainResource (org.hl7.fhir.r4b.model.DomainResource)3 ResourceWrapper (org.hl7.fhir.r4b.renderers.utils.BaseWrappers.ResourceWrapper)3 DomainResource (org.hl7.fhir.r5.model.DomainResource)3 Base64 (org.apache.commons.codec.binary.Base64)2 NotImplementedException (org.apache.commons.lang3.NotImplementedException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1