Search in sources :

Example 1 with ITypeParser

use of org.hl7.fhir.r5.renderers.utils.RenderingContext.ITypeParser in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method generate.

public String generate(ResourceContext rcontext, org.hl7.fhir.r4.elementmodel.Element er, boolean showCodeDetails, ITypeParser parser) throws IOException, FHIRException {
    if (rcontext == null)
        rcontext = new ResourceContext(null, er);
    this.parser = parser;
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.para().b().tx("Generated Narrative" + (showCodeDetails ? " with Details" : ""));
    try {
        ResourceWrapperMetaElement resw = new ResourceWrapperMetaElement(er);
        BaseWrapperMetaElement base = new BaseWrapperMetaElement(er, null, er.getProperty().getStructure(), er.getProperty().getDefinition());
        base.children();
        generateByProfile(resw, er.getProperty().getStructure(), base, er.getProperty().getStructure().getSnapshot().getElement(), er.getProperty().getDefinition(), base.children, x, er.fhirType(), showCodeDetails, 0, rcontext);
    } catch (Exception e) {
        e.printStackTrace();
        x.para().b().setAttribute("style", "color: maroon").tx("Exception generating Narrative: " + e.getMessage());
    }
    inject(er, x, NarrativeStatus.GENERATED);
    return new XhtmlComposer(XhtmlComposer.XML, pretty).compose(x);
}
Also used : XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) ParseException(java.text.ParseException) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ParseException (java.text.ParseException)1 NotImplementedException (org.apache.commons.lang3.NotImplementedException)1 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)1 FHIRException (org.hl7.fhir.exceptions.FHIRException)1 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)1 XhtmlComposer (org.hl7.fhir.utilities.xhtml.XhtmlComposer)1 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)1