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);
}
Aggregations