org.hl7.fhir.r5.renderers.CapabilityStatementRenderer Maven / Gradle / Ivy
package org.hl7.fhir.r5.renderers;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CapabilityStatement;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy;
import org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction;
import org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Element;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
import org.hl7.fhir.r5.model.Extension;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
import org.hl7.fhir.r5.renderers.utils.ResourceWrapper;
import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.MarkedToMoveToAdjunctPackage;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@MarkedToMoveToAdjunctPackage
public class CapabilityStatementRenderer extends ResourceRenderer {
public CapabilityStatementRenderer(RenderingContext context) {
super(context);
}
@Override
public void buildNarrative(RenderingStatus status, XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
if (r.isDirect()) {
renderResourceTechDetails(r, x);
render(status, x, (CapabilityStatement) r.getBase(), r);
} else {
// the intention is to change this in the future
x.para().tx("CapabilityStatementRenderer only renders native resources directly");
}
}
@Override
public String buildSummary(ResourceWrapper r) throws UnsupportedEncodingException, IOException {
return canonicalTitle(r);
}
private static final String EXPECTATION = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation";
private static final String COMBINED = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-search-parameter-combination";
private static final String SP_BASE = "http://hl7.org/fhir/searchparameter/";
private static final String FHIR_BASE = "http://hl7.org/fhir/";
private static final String VERS_DEF_PREFIX = "FHIR Release ";
private String currentFhirBase = "";
private String collapseClass = "panel-collapse in";
private boolean multExpectationsPresent = false;
//Private classes for driving the rendering
private class CombinedSearchParamSet {
private Map> params;
String expectation = "";
CombinedSearchParamSet(String expectation) {
params = new HashMap>();
params.put(true, new ArrayList());
params.put(false, new ArrayList());
if (!Utilities.noString(expectation)) this.expectation = expectation;
}
public Map> getParams() {
return params;
}
public String getExpectation() {
return expectation;
}
public void addParam(boolean required, SingleParam param) {
params.get(required).add(param);
}
}
private class SingleParam {
private String name = "";
private String definition = "";
private String type = "";
private String documentation = "";
private String expectation = "";
private String hostResource = "";
public SingleParam(String name) {
if (!Utilities.noString(name)) this.name=name;
}
public SingleParam(String name, String definition) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
}
public SingleParam(String name, String definition, String type) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
if (!Utilities.noString(type)) this.type=type;
}
public SingleParam(String name, String definition, String type, String documentation) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
if (!Utilities.noString(type)) this.type=type;
if (!Utilities.noString(documentation)) this.documentation=documentation;
}
public SingleParam(String name, String definition, String type, String documentation, String expectation, String hostResource) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
if (!Utilities.noString(type)) this.type=type;
if (!Utilities.noString(documentation)) this.documentation=documentation;
if (!Utilities.noString(expectation)) this.expectation=expectation;
if (!Utilities.noString(hostResource)) this.hostResource = hostResource;
}
public String getName() {
return name;
}
public String getDefinition() {
return definition;
}
public String getDocumentation() {
return documentation;
}
public String getType() {
return type;
}
public String getExpectation() {
return expectation;
}
public String getHostResource() {
return hostResource;
}
}
private class ResourceSearchParams {
private Map> combinedParams;
private Map individualParamsByName;
private Map> individualParamsByExp;
public ResourceSearchParams() {
combinedParams = new HashMap>();
combinedParams.put("SHALL", new ArrayList());
combinedParams.put("SHOULD", new ArrayList());
combinedParams.put("SHOULD-NOT", new ArrayList());
combinedParams.put("MAY", new ArrayList());
combinedParams.put("supported", new ArrayList());
individualParamsByName = new HashMap();
individualParamsByExp = new HashMap>();
individualParamsByExp.put("SHALL", new ArrayList());
individualParamsByExp.put("SHOULD", new ArrayList());
individualParamsByExp.put("MAY", new ArrayList());
individualParamsByExp.put("SHOULD-NOT", new ArrayList());
individualParamsByExp.put("supported", new ArrayList());
}
public Map> getCombined() {
return combinedParams;
}
public Map getInd() {
return individualParamsByName;
}
public Map getIndbyName() {
return individualParamsByName;
}
public Map> getIndbyExp() {
return individualParamsByExp;
}
public void addCombinedParamSet(String exp, CombinedSearchParamSet params) {
combinedParams.get(exp).add(params);
}
public void addIndividualbyName(String name, SingleParam param) {
individualParamsByName.put(name, param);
}
public void addIndividualbyExp(String exp, SingleParam param) {
individualParamsByExp.get(exp).add(param);
}
}
private class SingleOperation {
private String name = "";
private String definition = "";
private String documentation = "";
private String expectation = "";
public SingleOperation(String name) {
if (!Utilities.noString(name)) this.name=name;
}
public SingleOperation(String name, String definition) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
}
public SingleOperation(String name, String definition, String documentation) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
if (!Utilities.noString(documentation)) this.documentation=documentation;
}
public SingleOperation(String name, String definition, String documentation, String expectation) {
if (!Utilities.noString(name)) this.name=name;
if (!Utilities.noString(definition)) this.definition=definition;
if (!Utilities.noString(documentation)) this.documentation=documentation;
if (!Utilities.noString(expectation)) this.expectation=expectation;
}
public String getName() {
return name;
}
public String getDefinition() {
return definition;
}
public String getDocumentation() {
return documentation;
}
public String getExpectation() {
return expectation;
}
}
private class ResourceOperations {
private Map> operationsByExp;
public ResourceOperations() {
operationsByExp = new HashMap>();
operationsByExp.put("SHALL", new ArrayList());
operationsByExp.put("SHOULD", new ArrayList());
operationsByExp.put("MAY", new ArrayList());
operationsByExp.put("SHOULD-NOT", new ArrayList());
operationsByExp.put("supported", new ArrayList());
}
public Map> getOperations() {
return operationsByExp;
}
public void addOperation(String exp, SingleOperation op) {
operationsByExp.get(exp).add(op);
}
}
private class ResourceInteraction {
private String codeString;
private String documentation;
public ResourceInteraction(String code, String markdown) {
codeString = code;
if (!Utilities.noString(markdown)) {
documentation = markdown;
}
else {
documentation = null;
}
}
public String getDocumentation() {
return documentation;
}
public String getInteraction() {
return codeString;
}
}
public void render(RenderingStatus status, XhtmlNode x, CapabilityStatement conf, ResourceWrapper res) throws FHIRFormatError, DefinitionException, IOException {
status.setExtensions(true);
boolean igRenderingMode = (context.getRules() == GenerationRules.IG_PUBLISHER);
FHIRVersion currentVersion = conf.getFhirVersion();
String versionPathComponent = getVersionPathComponent(currentVersion.getDefinition());
if (!Utilities.noString(versionPathComponent)) {
currentFhirBase = FHIR_BASE + versionPathComponent + "/";
}
else {
currentFhirBase = FHIR_BASE;
}
String igVersion = conf.getVersion();
x.h(2,"title").addText(conf.getTitle());
XhtmlNode uList = x.ul();
uList.li().addText(context.formatPhrase(RenderingContext.CAPABILITY_IMP_VER, igVersion) + " ");
uList.li().addText(context.formatPhrase(RenderingContext.CAPABILITY_FHIR_VER, currentVersion.toCode()) + " ");
addSupportedFormats(uList, conf);
uList.li().addText(context.formatPhrase(RenderingContext.CAPABILITY_PUB_ON, displayDateTime(wrapWC(res, conf.getDateElement())) + " "));
uList.li().addText(context.formatPhrase(RenderingContext.CAPABILITY_PUB_BY, conf.getPublisherElement().asStringValue()) + " ");
XhtmlNode block = x.addTag("blockquote").attribute("class","impl-note");
block.addTag("p").addTag("strong").addText(context.formatPhrase(RenderingContext.CAPABILITY_NOTE_CAP));
block.addTag("p").addText(context.formatPhrase(RenderingContext.CAPABILTY_ALLOW_CAP));
addSupportedCSs(status, x, conf, res);
addSupportedIGs(x, conf);
int restNum = conf.getRest().size();
int nextLevel = 3;
if (restNum > 0) {
x.h(2,"rest").addText((context.formatPhrase(RenderingContext.CAPABILITY_REST_CAPS)));
int count=1;
for (CapabilityStatementRestComponent rest : conf.getRest()) {
if (restNum > 1) {
x.h(3,"rest"+Integer.toString(count)).addText(context.formatPhrase(RenderingContext.CAPABILITY_REST_CONFIG, Integer.toString(count)) + " ");
nextLevel = 4;
}
addRestConfigPanel(x, rest, nextLevel, count);
boolean hasVRead = false;
boolean hasPatch = false;
boolean hasDelete = false;
boolean hasHistory = false;
boolean hasUpdates = false;
for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
hasVRead = hasVRead || hasOp(r, TypeRestfulInteraction.VREAD);
hasPatch = hasPatch || hasOp(r, TypeRestfulInteraction.PATCH);
hasDelete = hasDelete || hasOp(r, TypeRestfulInteraction.DELETE);
hasHistory = hasHistory || hasOp(r, TypeRestfulInteraction.HISTORYTYPE);
hasUpdates = hasUpdates || hasOp(r, TypeRestfulInteraction.HISTORYINSTANCE);
}
if (rest.getResource().size() >0) {
x.h(nextLevel,"resourcesCap" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.CAPABILITY_RES_PRO));
x.h(nextLevel+1,"resourcesSummary" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.GENERAL_SUMM));
addSummaryIntro(x);
addSummaryTable(status, res, x, rest, hasVRead, hasPatch, hasDelete, hasHistory, hasUpdates, count);
x.addTag("hr");
//Third time for individual resources
int resCount = 1;
for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
addResourceConfigPanel(status, res, x, r, nextLevel+1, count, resCount, igRenderingMode);
resCount++;
}
}
if (rest.getOperation().size() > 0) {
//TODO Figure out what should come out of this
x.h(nextLevel,"operationsCap" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.CAPABILITY_OP));
x.h(nextLevel+1,"operationsSummary" + Integer.toString(count)).addText(context.formatPhrase(RenderingContext.OP_DEF_USE));
}
count++;
}
}
int messagingNum = conf.getMessaging().size();
nextLevel = 3;
if (messagingNum > 0) {
x.h(2,"messaging").addText((context.formatPhrase(RenderingContext.CAPABILITY_MESSAGING_CAPS)));
int count=1;
for (CapabilityStatementMessagingComponent msg : conf.getMessaging())
{
addMessagingPanel(status, res, x, msg, nextLevel, count, messagingNum);
count++;
}
}
int documentNum = conf.getDocument().size();
nextLevel = 3;
if (documentNum > 0) {
x.h(2,"document").addText((context.formatPhrase(RenderingContext.CAPABILITY_DOCUMENT_CAPS)));
addDocumentTable(status, res, x, conf, nextLevel);
}
if (multExpectationsPresent) {
addWarningPanel(x,"⹋⹋ - " + context.formatPhrase(RenderingContext.CAPABILITY_MULT_EXT));
}
}
private String getVersionPathComponent(String definition) {
if (Utilities.noString(definition)) return "";
if (!definition.startsWith(VERS_DEF_PREFIX)) return "";
String restOfDef[] = definition.substring(VERS_DEF_PREFIX.length()).split(" ");
if (restOfDef[1].startsWith("(")) return "R"+restOfDef[0];
return "";
}
public void describe(XhtmlNode x, CapabilityStatement cs) {
x.tx(display(cs));
}
public String display(CapabilityStatement cs) {
return cs.present();
}
private boolean hasOp(CapabilityStatementRestResourceComponent r, TypeRestfulInteraction on) {
for (ResourceInteractionComponent op : r.getInteraction()) {
if (op.getCode() == on)
return true;
}
return false;
}
private String showOp(CapabilityStatementRestResourceComponent r, TypeRestfulInteraction on) {
for (ResourceInteractionComponent op : r.getInteraction()) {
if (op.getCode() == on)
return "y";
}
return "";
}
private String showOp(CapabilityStatementRestComponent r, SystemRestfulInteraction on) {
for (SystemInteractionComponent op : r.getInteraction()) {
if (op.getCode() == on)
return "y";
}
return "";
}
private XhtmlNode addTableRow(XhtmlNode t, String name) {
XhtmlNode tr = t.tr();
tr.td().addText(name);
return tr.td();
}
private void addTableRow(XhtmlNode t, String name, String value) {
XhtmlNode tr = t.tr();
tr.td().addText(name);
tr.td().addText(value);
}
@Nullable
private String getExtValueCode(Extension ext) {
if (ext != null) {
return ext.getValueCodeType().getCode();
}
return null;
}
private void addSupportedCSs(RenderingStatus status, XhtmlNode x, CapabilityStatement cap, ResourceWrapper res) throws UnsupportedEncodingException, IOException {
if (cap.hasInstantiates()) {
XhtmlNode p = x.para();
p.tx(cap.getInstantiates().size() > 1 ? "This CapabilityStatement instantiates these CapabilityStatements " : "This CapabilityStatement instantiates the CapabilityStatement ");
boolean first = true;
for (CanonicalType ct : cap.getInstantiates()) {
if (first) {first = false;} else {p.tx(", ");};
renderCanonical(status, res, p, CapabilityStatement.class, ct);
}
}
if (cap.hasImports()) {
XhtmlNode p = x.para();
p.tx(cap.getImports().size() > 1 ? "This CapabilityStatement imports these CapabilityStatements " : "This CapabilityStatement imports the CapabilityStatement ");
boolean first = true;
for (CanonicalType ct : cap.getImports()) {
if (first) {first = false;} else {p.tx(", ");};
renderCanonical(status, res, p, CapabilityStatement.class, ct);
}
}
}
private void addSupportedIGs(XhtmlNode x, CapabilityStatement cap) {
String capExpectation=null;
if (cap.hasImplementationGuide()) {
ArrayList igShoulds = new ArrayList();
ArrayList igShalls = new ArrayList();
ArrayList igMays = new ArrayList();
int i=0;
for (CanonicalType c : cap.getImplementationGuide())
{
capExpectation=getExtValueCode(c.getExtensionByUrl(EXPECTATION));
if (!Utilities.noString(capExpectation)) {
if (capExpectation.equals("SHALL")) {
igShalls.add(c.asStringValue());
}
else if (capExpectation.equals("SHOULD")) {
igShoulds.add(c.asStringValue());
}
else if (capExpectation.equals("MAY")) {
igMays.add(c.asStringValue());
}
}
else {
igShalls.add(c.asStringValue()); //default to SHALL
}
}
XhtmlNode ul = null;
if (igShalls.size() > 0) {
x.h(3,"shallIGs").addText(context.formatPhrase(RenderingContext.CAPABILTY_SHALL_SUPP));
ul = x.ul();
for (String url : igShalls) {
addResourceLink(ul.li(), url, url);
//ul.li().ah(url).addText(url);
}
}
if (igShoulds.size() > 0) {
x.h(3,"shouldIGs").addText(context.formatPhrase(RenderingContext.CAPABILITY_SHOULD_SUPP));
ul = x.ul();
for (String url : igShoulds) {
addResourceLink(ul.li(), url, url);
//ul.li().ah(url).addText(url);
}
}
if (igMays.size() > 0) {
x.h(3,"mayIGs").addText(context.formatPhrase(RenderingContext.CAPABILITY_MAY_SUPP));
ul = x.ul();
for (String url : igMays) {
addResourceLink(ul.li(), url, url);
//ul.li().ah(url).addText(url);
}
}
}
}
private void addSupportedFormats(XhtmlNode uList, CapabilityStatement conf) {
XhtmlNode lItem = uList.li();
lItem.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP_FORM) + " ");
Boolean first = true;
String capExpectation = null;
for (CodeType c : conf.getFormat()) {
if (!first) {
lItem.addText(", ");
}
capExpectation = getExtValueCode(c.getExtensionByUrl(EXPECTATION));
if (!Utilities.noString(capExpectation)) {
lItem.addTag("strong").addText(capExpectation);
lItem.addText(" "+ (context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " "));
}
lItem.code().addText(c.getCode());
first = false;
}
lItem = uList.li();
lItem.addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP_PATCH_FORM) + " ");
first=true;
for (CodeType c : conf.getPatchFormat()) {
if (!first) {
lItem.addText(", ");
}
capExpectation = getExtValueCode(c.getExtensionByUrl(EXPECTATION));
if (!Utilities.noString(capExpectation)) {
lItem.addTag("strong").addText(capExpectation);
lItem.addText(" " + context.formatPhrase(RenderingContext.CAPABILITY_SUPP) + " ");
}
lItem.code().addText(c.getCode());
first = false;
}
}
private void addRestConfigPanel(XhtmlNode x, CapabilityStatementRestComponent rest, int nextLevel, int count) throws FHIRFormatError, DefinitionException, IOException {
XhtmlNode panel= null;
XhtmlNode body = null;
XhtmlNode row = null;
XhtmlNode cell = null;
XhtmlNode heading = null;
panel = x.div().attribute("class", "panel panel-default");
heading = panel.div().attribute("class", "panel-heading").h(nextLevel,"mode" + Integer.toString(count)).attribute("class", "panel-title");
heading.addText("Mode: ");
heading.code().addText(rest.getMode().toCode());
body = panel.div().attribute("class", "panel-body");
addMarkdown(body, rest.getDocumentation());
//Security info
if (rest.hasSecurity()) {
body.div().attribute("class","lead").addTag("em").addText("Security");
String mdText = rest.getSecurity().getDescription();
boolean cors = rest.getSecurity().getCors();
List services = rest.getSecurity().getService();
if (cors || services.size() >0) {
row = body.div().attribute("class","row");
row.div().attribute("class","col-lg-6").addText(getCorsText(cors));
cell = row.div().attribute("class","col-lg-6");
cell.addText("Security services supported: ");
addSeparatedListOfCodes(cell, getSecServices(services), ",");
}
if (!Utilities.noString(mdText)) {
addMarkdown(body.blockquote(),mdText);
}
}
body.div().attribute("class","lead").addTag("em").addText(context.formatPhrase(RenderingContext.CAPABILITY_SUMM_SYS_INT));
addSystemInteractions(body, rest.getInteraction());
}
private void addMessagingPanel(RenderingStatus status, ResourceWrapper res, XhtmlNode x, CapabilityStatementMessagingComponent msg, int nextLevel, int index, int total) throws FHIRFormatError, DefinitionException, IOException {
XhtmlNode panel= null;
XhtmlNode body = null;
XhtmlNode row = null;
XhtmlNode heading = null;
XhtmlNode table;
XhtmlNode tbody;
XhtmlNode tr;
panel = x.div().attribute("class", "panel panel-default");
heading = panel.div().attribute("class", "panel-heading").h(nextLevel,"messaging_" + Integer.toString(index)).attribute("class", "panel-title");
if(total == 1)
{
heading.addText(context.formatPhrase(RenderingContext.CAPABILITY_MESSAGING_CAP));
}
else
{
heading.addText(context.formatPhrase(RenderingContext.CAPABILITY_MESSAGING_CAP) + " " + String.valueOf(index));
}
body = panel.div().attribute("class", "panel-body");
if(msg.hasReliableCache())
{
addLead(body, "Reliable Cache Length");
body.br();
body.addText(String.valueOf(msg.getReliableCache()) + " Minute(s)");
body.br();
}
if(msg.hasEndpoint())
{
body.h(nextLevel+1,"msg_end_"+Integer.toString(index)).addText(context.formatPhrase(RenderingContext.CAPABILITY_ENDPOINTS));
table = body.table("table table-condensed table-hover", false);
tr = table.addTag("thead").tr();
tr.th().addText("Protocol");
tr.th().addText("Address");
tbody = table.addTag("tbody");
for (CapabilityStatementMessagingEndpointComponent end : msg.getEndpoint())
{
tr = tbody.tr();
renderDataType(status, tr.td(), wrapNC(end.getProtocol()));
renderUri(status, tr.td(), wrapNC(end.getAddressElement()));
}
body.br();
}
if(msg.hasSupportedMessage())
{
body.h(nextLevel+1,"msg_end_"+Integer.toString(index)).addText(context.formatPhrase(RenderingContext.CAPABILITY_SUPP_MSGS));
table = body.table("table table-condensed table-hover", false);
tr = table.addTag("thead").tr();
tr.th().addText("Mode");
tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_DEFINITION));
tbody = table.addTag("tbody");
for (CapabilityStatementMessagingSupportedMessageComponent sup : msg.getSupportedMessage())
{
tr = tbody.tr();
tr.td().addText(sup.getMode().toCode());
renderCanonical(status, res, tr.td(), StructureDefinition.class, sup.getDefinitionElement());
}
if(msg.hasDocumentation())
{
addLead(body, context.formatPhrase(RenderingContext.GENERAL_DOCUMENTATION));
addMarkdown(body.blockquote(), msg.getDocumentation());
}
body.br();
}
}
private void addDocumentTable(RenderingStatus status, ResourceWrapper res, XhtmlNode x, CapabilityStatement conf, int nextLevel) throws FHIRFormatError, DefinitionException, IOException {
XhtmlNode table;
XhtmlNode tbody;
XhtmlNode tr;
table = x.table("table table-condensed table-hover", false);
tr = table.addTag("thead").tr();
tr.th().addText("Mode");
tr.th().addText(context.formatPhrase(RenderingContext.CAPABILITY_PROF_RES_DOC));
tr.th().addText(context.formatPhrase(RenderingContext.GENERAL_DOCUMENTATION));
tbody = table.addTag("tbody");
for (CapabilityStatementDocumentComponent document : conf.getDocument()) {
tr = tbody.tr();
tr.td().addText(document.getMode().toCode());
renderCanonical(status, res, tr.td(), StructureDefinition.class, document.getProfileElement());
if(document.hasDocumentation())
{
addMarkdown(tr.td(), document.getDocumentation());
}
else
{
tr.td().nbsp();
}
}
}
private String getCorsText(boolean on) {
if (on) {
return context.formatPhrase(RenderingContext.CAPABILITY_CORS_YES);
}
return context.formatPhrase(RenderingContext.CAPABILITY_CORS_NO);
}
private List getSecServices(List services)
{
List serviceStrings = new ArrayList();
for (CodeableConcept c: services) {
if (c.hasCoding()){
serviceStrings.add(c.getCodingFirstRep().getCode());
}
else {
serviceStrings.add(c.getText());
}
}
return serviceStrings;
}
private void addSystemInteractions(XhtmlNode body, List interactions) {
if (interactions.size()==0) return;
XhtmlNode uList = body.ul();
String capExpectation = null;
String expName = null;
String documentation = null;
Map expression = null;
ArrayList © 2015 - 2025 Weber Informatics LLC | Privacy Policy