Search in sources :

Example 1 with SearchParameterComponentComponent

use of org.hl7.fhir.r4b.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()));
    }
}
Also used : SearchParameterDefn(org.hl7.fhir.definitions.model.SearchParameterDefn) CompositeDefinition(org.hl7.fhir.definitions.model.SearchParameterDefn.CompositeDefinition) SearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent)

Example 2 with SearchParameterComponentComponent

use of org.hl7.fhir.r4b.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;
}
Also used : PublicationStatusEnumFactory(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory) SearchParamTypeEnumFactory(org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory)

Example 3 with SearchParameterComponentComponent

use of org.hl7.fhir.r4b.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;
}
Also used : StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition) StringType(org.hl7.fhir.r4b.model.StringType) SearchModifierCode(org.hl7.fhir.r4b.model.SearchParameter.SearchModifierCode) CodeType(org.hl7.fhir.r4b.model.CodeType) SearchComparator(org.hl7.fhir.r4b.model.SearchParameter.SearchComparator) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) SearchParameterComponentComponent(org.hl7.fhir.r4b.model.SearchParameter.SearchParameterComponentComponent)

Example 4 with SearchParameterComponentComponent

use of org.hl7.fhir.r4b.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;
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) StringType(org.hl7.fhir.r5.model.StringType) SearchModifierCode(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode) CodeType(org.hl7.fhir.r5.model.CodeType) SearchComparator(org.hl7.fhir.r5.model.SearchParameter.SearchComparator) SearchParameter(org.hl7.fhir.r5.model.SearchParameter) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) SearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent)

Aggregations

SearchParameterComponentComponent (org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent)2 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)2 SearchParameterDefn (org.hl7.fhir.definitions.model.SearchParameterDefn)1 CompositeDefinition (org.hl7.fhir.definitions.model.SearchParameterDefn.CompositeDefinition)1 PublicationStatusEnumFactory (org.hl7.fhir.dstu3.model.Enumerations.PublicationStatusEnumFactory)1 SearchParamTypeEnumFactory (org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory)1 CodeType (org.hl7.fhir.r4b.model.CodeType)1 SearchParameter (org.hl7.fhir.r4b.model.SearchParameter)1 SearchComparator (org.hl7.fhir.r4b.model.SearchParameter.SearchComparator)1 SearchModifierCode (org.hl7.fhir.r4b.model.SearchParameter.SearchModifierCode)1 SearchParameterComponentComponent (org.hl7.fhir.r4b.model.SearchParameter.SearchParameterComponentComponent)1 StringType (org.hl7.fhir.r4b.model.StringType)1 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)1 CodeType (org.hl7.fhir.r5.model.CodeType)1 SearchParameter (org.hl7.fhir.r5.model.SearchParameter)1 SearchComparator (org.hl7.fhir.r5.model.SearchParameter.SearchComparator)1 SearchModifierCode (org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode)1 StringType (org.hl7.fhir.r5.model.StringType)1 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)1