use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class SearchParameterRenderer method render.
public boolean render(XhtmlNode x, SearchParameter spd) throws IOException, FHIRException, EOperationOutcome {
x.h2().addText(spd.getName());
XhtmlNode p = x.para();
p.tx("Parameter ");
p.code().tx(spd.getCode());
p.tx(":");
p.code().tx(spd.getType().toCode());
addMarkdown(x, spd.getDescription());
XhtmlNode tbl = x.table("grid");
XhtmlNode tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Resource", spd.getBase().size()));
XhtmlNode td = tr.td();
for (CodeType t : spd.getBase()) {
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.toString());
if (sd != null && sd.hasUserData("path")) {
td.sep(", ").ah(sd.getUserString("path")).tx(t.getCode());
} else {
td.sep(", ").tx(t.getCode());
}
}
tr = tbl.tr();
tr.td().tx("Expression");
if (spd.hasExpression()) {
tr.td().code().tx(spd.getExpression());
} else {
tr.td().tx("(none)");
}
if (spd.hasXpathUsage()) {
tr = tbl.tr();
tr.td().tx("Usage");
tr.td().tx(spd.getXpathUsage().getDisplay());
}
if (spd.hasXpath()) {
tr = tbl.tr();
tr.td().tx("XPath");
tr.td().code().tx(spd.getXpath());
}
if (spd.hasTarget()) {
tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Target Resources", spd.getTarget().size()));
td = tr.td();
for (CodeType t : spd.getTarget()) {
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.toString());
if (sd != null && sd.hasUserData("path")) {
td.sep(", ").ah(sd.getUserString("path")).tx(t.getCode());
} else {
td.sep(", ").tx(t.getCode());
}
}
}
tr = tbl.tr();
tr.td().tx("Multiples");
if (spd.getMultipleAnd() && spd.getMultipleOr()) {
tr.td().tx("The parameter can repeat (and) and can have repeating values (or)");
} else if (spd.getMultipleOr()) {
tr.td().tx("The parameter can repeat (and) but each repeat can only have one value");
} else if (spd.getMultipleAnd()) {
tr.td().tx("The parameter cannot repeat (and) but the single parameter can have multiple values (or)");
} else {
tr.td().tx("The parameter cannot repeat or have multiple values");
}
if (spd.hasComparator()) {
tr = tbl.tr();
tr.td().tx("Comparators");
td = tr.td().tx("Allowed: ");
for (Enumeration<SearchComparator> t : spd.getComparator()) {
td.sep(", ").tx(t.asStringValue());
}
}
if (spd.hasModifier()) {
tr = tbl.tr();
tr.td().tx("Modifiers");
td = tr.td().tx("Allowed: ");
for (Enumeration<SearchModifierCode> t : spd.getModifier()) {
td.sep(", ").tx(t.asStringValue());
}
}
if (spd.hasChain()) {
tr = tbl.tr();
tr.td().tx("Chains");
td = tr.td().tx("Allowed: ");
for (StringType t : spd.getChain()) {
td.sep(", ").tx(t.asStringValue());
}
}
if (spd.hasComponent()) {
x.para().b().tx("Components");
tbl = x.table("grid");
for (SearchParameterComponentComponent t : spd.getComponent()) {
tr = tbl.tr();
SearchParameter tsp = context.getWorker().fetchResource(SearchParameter.class, t.getDefinition());
if (tsp != null && tsp.hasUserData("path")) {
tr.td().ah(tsp.getUserString("path")).tx(tsp.present());
} else {
tr.td().tx(t.getDefinition());
}
tr.td().code().tx(t.getExpression());
}
}
return false;
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class OperationDefinitionRenderer method genOpParam.
private void genOpParam(XhtmlNode tbl, String path, OperationDefinitionParameterComponent p) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode tr;
tr = tbl.tr();
tr.td().addText(p.getUse().toString());
tr.td().addText(path + p.getName());
tr.td().addText(Integer.toString(p.getMin()) + ".." + p.getMax());
XhtmlNode td = tr.td();
StructureDefinition sd = p.getType() != null ? context.getWorker().fetchTypeDefinition(p.getType().toCode()) : null;
if (sd == null)
td.tx(p.hasType() ? p.getType().toCode() : "");
else if (sd.getAbstract() && p.hasExtension(ToolingExtensions.EXT_ALLOWED_TYPE)) {
boolean first = true;
for (Extension ex : p.getExtensionsByUrl(ToolingExtensions.EXT_ALLOWED_TYPE)) {
if (first)
first = false;
else
td.tx(" | ");
String s = ex.getValue().primitiveValue();
StructureDefinition sdt = context.getWorker().fetchTypeDefinition(s);
if (sdt == null)
td.tx(p.hasType() ? p.getType().toCode() : "");
else
td.ah(sdt.getUserString("path")).tx(s);
}
} else
td.ah(sd.getUserString("path")).tx(p.hasType() ? p.getType().toCode() : "");
if (p.hasSearchType()) {
td.br();
td.tx("(");
td.ah(context.getSpecificationLink() == null ? "search.html#" + p.getSearchType().toCode() : Utilities.pathURL(context.getSpecificationLink(), "search.html#" + p.getSearchType().toCode())).tx(p.getSearchType().toCode());
td.tx(")");
}
td = tr.td();
if (p.hasBinding() && p.getBinding().hasValueSet()) {
AddVsRef(p.getBinding().getValueSet(), td);
td.tx(" (" + p.getBinding().getStrength().getDisplay() + ")");
}
addMarkdown(tr.td(), p.getDocumentation());
if (!p.hasType()) {
for (OperationDefinitionParameterComponent pp : p.getPart()) {
genOpParam(tbl, path + p.getName() + ".", pp);
}
}
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class ParametersRenderer method render.
@Override
public boolean render(XhtmlNode x, Resource r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
x.h2().tx("Parameters");
XhtmlNode tbl = x.table("grid");
params(tbl, ((Parameters) r).getParameter(), 0);
return false;
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class ParametersRenderer method paramsW.
private void paramsW(XhtmlNode tbl, List<BaseWrapper> list, int indent) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
for (BaseWrapper p : list) {
XhtmlNode tr = tbl.tr();
XhtmlNode td = tr.td();
for (int i = 0; i < indent; i++) {
td.tx(XhtmlNode.NBSP);
}
if (p.has("name")) {
td.tx(p.get("name").primitiveValue());
} else {
td.tx("???");
}
if (p.has("value")) {
renderBase(tr.td(), p.get("value"));
} else if (p.has("resource")) {
ResourceWrapper rw = p.getChildByName("resource").getAsResource();
td = tr.td();
XhtmlNode para = td.para();
para.tx(rw.fhirType() + "/" + rw.getId());
para.an(rw.fhirType() + "_" + rw.getId()).tx(" ");
XhtmlNode x = rw.getNarrative();
if (x != null) {
td.addChildren(x);
} else {
ResourceRenderer rr = RendererFactory.factory(rw, context, rcontext);
rr.render(td, rw);
}
} else if (p.has("part")) {
tr.td();
PropertyWrapper pw = getProperty(p, "part");
paramsW(tbl, pw.getValues(), 1);
}
}
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class DiagnosticReportRenderer method populateSubjectSummary.
private void populateSubjectSummary(XhtmlNode container, BaseWrapper subject) throws UnsupportedEncodingException, FHIRException, IOException, EOperationOutcome {
ResourceWrapper r = fetchResource(subject);
if (r == null)
container.tx("Unable to get Patient Details");
else if (r.getName().equals("Patient"))
generatePatientSummary(container, r);
else
container.tx("Not done yet");
}
Aggregations