use of org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent 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.r4.model.OperationDefinition.OperationDefinitionParameterComponent 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.r4.model.OperationDefinition.OperationDefinitionParameterComponent in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
x.h2().addText(opd.getName());
x.para().addText(Utilities.capitalize(opd.getKind().toString()) + ": " + opd.getName());
x.para().tx("The official URL for this operation definition is: ");
x.pre().tx(opd.getUrl());
addMarkdown(x, opd.getDescription());
if (opd.getSystem())
x.para().tx("URL: [base]/$" + opd.getCode());
for (CodeType c : opd.getResource()) {
if (opd.getType())
x.para().tx("URL: [base]/" + c.getValue() + "/$" + opd.getCode());
if (opd.getInstance())
x.para().tx("URL: [base]/" + c.getValue() + "/[id]/$" + opd.getCode());
}
x.para().tx("Parameters");
XhtmlNode tbl = x.table("grid");
XhtmlNode tr = tbl.tr();
tr.td().b().tx("Use");
tr.td().b().tx("Name");
tr.td().b().tx("Cardinality");
tr.td().b().tx("Type");
tr.td().b().tx("Binding");
tr.td().b().tx("Documentation");
for (OperationDefinitionParameterComponent p : opd.getParameter()) {
genOpParam(rcontext, tbl, "", p);
}
addMarkdown(x, opd.getComment());
inject(opd, x, NarrativeStatus.GENERATED);
return true;
}
use of org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
x.h2().addText(opd.getName());
x.para().addText(Utilities.capitalize(opd.getKind().toString()) + ": " + opd.getName());
x.para().tx("The official URL for this operation definition is: ");
x.pre().tx(opd.getUrl());
addMarkdown(x, opd.getDescription());
if (opd.getSystem())
x.para().tx("URL: [base]/$" + opd.getCode());
for (CodeType c : opd.getResource()) {
if (opd.getType())
x.para().tx("URL: [base]/" + c.getValue() + "/$" + opd.getCode());
if (opd.getInstance())
x.para().tx("URL: [base]/" + c.getValue() + "/[id]/$" + opd.getCode());
}
x.para().tx("Parameters");
XhtmlNode tbl = x.table("grid");
XhtmlNode tr = tbl.tr();
tr.td().b().tx("Use");
tr.td().b().tx("Name");
tr.td().b().tx("Cardinality");
tr.td().b().tx("Type");
tr.td().b().tx("Binding");
tr.td().b().tx("Documentation");
for (OperationDefinitionParameterComponent p : opd.getParameter()) {
genOpParam(rcontext, tbl, "", p);
}
addMarkdown(x, opd.getComment());
inject(opd, x, NarrativeStatus.GENERATED);
return true;
}
use of org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent in project kindling by HL7.
the class SpreadSheetReloader method findParam.
private OperationDefinitionParameterComponent findParam(String path, OperationDefinitionParameterComponent pp, String context) {
for (int i = pp.getPart().size() - 1; i >= 0; i--) {
OperationDefinitionParameterComponent p = pp.getPart().get(i);
String npath = path + "." + p.getName();
if (npath.equals(context)) {
return p;
}
if (context.startsWith(npath)) {
return findParam(npath, p, context);
}
}
throw new Error("Unable to find parameter " + context);
}
Aggregations