Search in sources :

Example 1 with SearchComparator

use of org.hl7.fhir.r4b.model.SearchParameter.SearchComparator 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 2 with SearchComparator

use of org.hl7.fhir.r4b.model.SearchParameter.SearchComparator 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

XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)2 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 SearchParameterComponentComponent (org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent)1 StringType (org.hl7.fhir.r5.model.StringType)1 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)1