use of org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent in project kindling by HL7.
the class ResourceParser method parseSearchParameter.
private void parseSearchParameter(ResourceDefn r, SearchParameter src) {
if (!src.hasName()) {
src.setName(src.getCode());
}
src.setVersion(version);
SearchParameterDefn sp = new SearchParameterDefn(src.getCode(), src.getDescription(), type(src.getType()), src.getXpathUsage(), StandardsStatus.fromCode(BuildExtensions.readStringExtension(src, "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status")));
r.getSearchParams().put(sp.getCode(), sp);
sp.setExpression(src.getExpression());
sp.setXPath(src.getXpath());
sp.setResource(src);
String s = BuildExtensions.readStringExtension(src, BuildExtensions.EXT_PATH);
if (!Utilities.noString(s)) {
for (String p : s.split("\\,")) {
String v = p.trim();
if (!Utilities.noString(v)) {
sp.getPaths().add(v);
}
}
}
for (SearchParameterComponentComponent comp : src.getComponent()) {
sp.getComposites().add(new CompositeDefinition(comp.getDefinition(), comp.getExpression()));
}
}
use of org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent in project org.hl7.fhir.core by hapifhir.
the class SearchParameter 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("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("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("code")) {
// CodeType
this.code = castToCode(value);
} else if (name.equals("base")) {
this.getBase().add(castToCode(value));
} else if (name.equals("type")) {
value = new SearchParamTypeEnumFactory().fromType(castToCode(value));
// Enumeration<SearchParamType>
this.type = (Enumeration) value;
} else if (name.equals("derivedFrom")) {
// UriType
this.derivedFrom = castToUri(value);
} else if (name.equals("description")) {
// MarkdownType
this.description = castToMarkdown(value);
} else if (name.equals("expression")) {
// StringType
this.expression = castToString(value);
} else if (name.equals("xpath")) {
// StringType
this.xpath = castToString(value);
} else if (name.equals("xpathUsage")) {
value = new XPathUsageTypeEnumFactory().fromType(castToCode(value));
// Enumeration<XPathUsageType>
this.xpathUsage = (Enumeration) value;
} else if (name.equals("target")) {
this.getTarget().add(castToCode(value));
} else if (name.equals("comparator")) {
value = new SearchComparatorEnumFactory().fromType(castToCode(value));
this.getComparator().add((Enumeration) value);
} else if (name.equals("modifier")) {
value = new SearchModifierCodeEnumFactory().fromType(castToCode(value));
this.getModifier().add((Enumeration) value);
} else if (name.equals("chain")) {
this.getChain().add(castToString(value));
} else if (name.equals("component")) {
this.getComponent().add((SearchParameterComponentComponent) value);
} else
return super.setProperty(name, value);
return value;
}
use of org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent 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.model.SearchParameter.SearchParameterComponentComponent 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;
}
Aggregations