use of org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method genOpParam.
private void genOpParam(XhtmlNode tbl, String path, OperationDefinitionParameterComponent p) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode tr;
tr = tbl.addTag("tr");
tr.addTag("td").addText(p.getUse().toString());
tr.addTag("td").addText(path + p.getName());
tr.addTag("td").addText(Integer.toString(p.getMin()) + ".." + p.getMax());
tr.addTag("td").addText(p.hasType() ? p.getType() : "");
XhtmlNode td = tr.addTag("td");
if (p.hasBinding() && p.getBinding().hasValueSet()) {
if (p.getBinding().getValueSet() instanceof Reference)
AddVsRef(p.getBinding().getValueSetReference().getReference(), td);
else
td.addTag("a").setAttribute("href", p.getBinding().getValueSetUriType().getValue()).addText("External Reference");
td.addText(" (" + p.getBinding().getStrength().getDisplay() + ")");
}
addMarkdown(tr.addTag("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 OperationDefinition method setProperty.
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("url")) {
// UriType
this.url = castToUri(value);
} else if (name.equals("version")) {
// StringType
this.version = castToString(value);
} else if (name.equals("name")) {
// StringType
this.name = castToString(value);
} else if (name.equals("status")) {
value = new PublicationStatusEnumFactory().fromType(castToCode(value));
// Enumeration<PublicationStatus>
this.status = (Enumeration) value;
} else if (name.equals("kind")) {
value = new OperationKindEnumFactory().fromType(castToCode(value));
// Enumeration<OperationKind>
this.kind = (Enumeration) value;
} else if (name.equals("experimental")) {
// BooleanType
this.experimental = castToBoolean(value);
} else if (name.equals("date")) {
// DateTimeType
this.date = castToDateTime(value);
} else if (name.equals("publisher")) {
// StringType
this.publisher = castToString(value);
} else if (name.equals("contact")) {
this.getContact().add(castToContactDetail(value));
} else if (name.equals("description")) {
// MarkdownType
this.description = castToMarkdown(value);
} else if (name.equals("useContext")) {
this.getUseContext().add(castToUsageContext(value));
} else if (name.equals("jurisdiction")) {
this.getJurisdiction().add(castToCodeableConcept(value));
} else if (name.equals("purpose")) {
// MarkdownType
this.purpose = castToMarkdown(value);
} else if (name.equals("idempotent")) {
// BooleanType
this.idempotent = castToBoolean(value);
} else if (name.equals("code")) {
// CodeType
this.code = castToCode(value);
} else if (name.equals("comment")) {
// StringType
this.comment = castToString(value);
} else if (name.equals("base")) {
// Reference
this.base = castToReference(value);
} else if (name.equals("resource")) {
this.getResource().add(castToCode(value));
} else if (name.equals("system")) {
// BooleanType
this.system = castToBoolean(value);
} else if (name.equals("type")) {
// BooleanType
this.type = castToBoolean(value);
} else if (name.equals("instance")) {
// BooleanType
this.instance = castToBoolean(value);
} else if (name.equals("parameter")) {
this.getParameter().add((OperationDefinitionParameterComponent) value);
} else if (name.equals("overload")) {
this.getOverload().add((OperationDefinitionOverloadComponent) value);
} else
return super.setProperty(name, value);
return value;
}
use of org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent in project org.hl7.fhir.core by hapifhir.
the class OperationDefinitionRenderer method render.
public boolean render(XhtmlNode x, OperationDefinition opd) throws IOException, FHIRException, EOperationOutcome {
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());
}
if (opd.hasInputProfile()) {
XhtmlNode p = x.para();
p.tx("Input parameters Profile: ");
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, opd.getInputProfile());
if (sd == null) {
p.pre().tx(opd.getInputProfile());
} else {
p.ah(sd.getUserString("path")).tx(sd.present());
}
}
if (opd.hasOutputProfile()) {
XhtmlNode p = x.para();
p.tx("Output parameters Profile: ");
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, opd.getOutputProfile());
if (sd == null) {
p.pre().tx(opd.getOutputProfile());
} else {
p.ah(sd.getUserString("path")).tx(sd.present());
}
}
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(tbl, "", p);
}
addMarkdown(x, opd.getComment());
return true;
}
use of org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method genOpParam.
private void genOpParam(ResourceContext rcontext, 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 = context.fetchTypeDefinition(p.getType());
if (sd == null)
td.tx(p.hasType() ? p.getType() : "");
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.fetchTypeDefinition(s);
if (sdt == null)
td.tx(p.hasType() ? p.getType() : "");
else
td.ah(sdt.getUserString("path")).tx(s);
}
} else
td.ah(sd.getUserString("path")).tx(p.hasType() ? p.getType() : "");
if (p.hasSearchType()) {
td.br();
td.tx("(");
td.ah(corePath == null ? "search.html#" + p.getSearchType().toCode() : Utilities.pathURL(corePath, "search.html#" + p.getSearchType().toCode())).tx(p.getSearchType().toCode());
td.tx(")");
}
td = tr.td();
if (p.hasBinding() && p.getBinding().hasValueSet()) {
AddVsRef(rcontext, p.getBinding().getValueSet(), td);
td.tx(" (" + p.getBinding().getStrength().getDisplay() + ")");
}
addMarkdown(tr.td(), p.getDocumentation());
if (!p.hasType()) {
for (OperationDefinitionParameterComponent pp : p.getPart()) {
genOpParam(rcontext, 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 void generate(OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
x.addTag("h2").addText(opd.getName());
x.addTag("p").addText(Utilities.capitalize(opd.getKind().toString()) + ": " + opd.getName());
addMarkdown(x, opd.getDescription());
if (opd.getSystem())
x.addTag("p").addText("URL: [base]/$" + opd.getCode());
for (CodeType c : opd.getType()) {
x.addTag("p").addText("URL: [base]/" + c.getValue() + "/$" + opd.getCode());
if (opd.getInstance())
x.addTag("p").addText("URL: [base]/" + c.getValue() + "/[id]/$" + opd.getCode());
}
x.addTag("p").addText("Parameters");
XhtmlNode tbl = x.addTag("table").setAttribute("class", "grid");
XhtmlNode tr = tbl.addTag("tr");
tr.addTag("td").addTag("b").addText("Use");
tr.addTag("td").addTag("b").addText("Name");
tr.addTag("td").addTag("b").addText("Cardinality");
tr.addTag("td").addTag("b").addText("Type");
tr.addTag("td").addTag("b").addText("Binding");
tr.addTag("td").addTag("b").addText("Documentation");
for (OperationDefinitionParameterComponent p : opd.getParameter()) {
genOpParam(tbl, "", p);
}
addMarkdown(x, opd.getComment());
inject(opd, x, NarrativeStatus.GENERATED);
}
Aggregations