Search in sources :

Example 1 with CapabilityStatementRestResourceSearchParamComponent

use of org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project kindling by HL7.

the class Publisher method makeSearchParam.

private CapabilityStatementRestResourceSearchParamComponent makeSearchParam(String name, SearchParamType type, String id, String doco) throws Exception {
    CapabilityStatementRestResourceSearchParamComponent result = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
    result.setName(name);
    result.setDefinition("http://hl7.org/fhir/SearchParameter/" + id);
    result.setType(type);
    result.setDocumentation(doco);
    return result;
}
Also used : CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)

Example 2 with CapabilityStatementRestResourceSearchParamComponent

use of org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method addRestSearchParamRow.

private Row addRestSearchParamRow(HierarchicalTableGenerator gen, List<Row> rows, StructuralMatch<Element> t, CapabilityStatementComparison comparison) {
    Row r = gen.new Row();
    rows.add(r);
    r.getCells().add(gen.new Cell(null, null, "searchParam", null, null));
    CapabilityStatementRestResourceSearchParamComponent left = t.hasLeft() ? (CapabilityStatementRestResourceSearchParamComponent) t.getLeft() : null;
    CapabilityStatementRestResourceSearchParamComponent right = t.hasRight() ? (CapabilityStatementRestResourceSearchParamComponent) t.getRight() : null;
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, true));
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
    r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, false));
    r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
    r.getCells().add(cellForMessages(gen, t.getMessages()));
    return r;
}
Also used : Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Example 3 with CapabilityStatementRestResourceSearchParamComponent

use of org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.

the class OpenApiGenerator method generateSearchSystem.

private void generateSearchSystem(CapabilityStatementRestComponent csr) {
    OperationWriter op = makePathSystem().operation("get");
    op.summary("Search all resources of all types based on a set of criteria");
    op.operationId("searchAll");
    opOutcome(op.responses().defaultResponse());
    ResponseObjectWriter resp = op.responses().httpResponse("200");
    resp.description("the resource being returned");
    if (isJson())
        resp.content("application/fhir+json").schemaRef(specRef() + "/fhir.schema.json#/definitions/Bundle");
    if (isXml())
        resp.content("application/fhir+xml").schemaRef(specRef() + "/Bundle.xsd");
    // todo: how do we know that these apply?
    op.paramRef("#/components/parameters/format");
    op.paramRef("#/components/parameters/pretty");
    op.paramRef("#/components/parameters/summary");
    op.paramRef("#/components/parameters/elements");
    Set<String> set = new HashSet<>();
    set.add("_summary");
    set.add("_format");
    set.add("_pretty");
    set.add("_elements");
    for (CapabilityStatementRestResourceSearchParamComponent spc : csr.getSearchParam()) {
        if (!set.contains(spc.getName())) {
            set.add(spc.getName());
            ParameterWriter p = op.parameter(spc.getName());
            p.in(ParameterLocation.query).description(spc.getDocumentation());
            p.schema().type(getSchemaType(spc.getType()));
            if (spc.hasDefinition()) {
                SearchParameter sp = context.fetchResource(SearchParameter.class, spc.getDefinition());
                if (sp != null) {
                    p.description(sp.getDescription());
                }
            }
        }
    }
}
Also used : CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) HashSet(java.util.HashSet)

Example 4 with CapabilityStatementRestResourceSearchParamComponent

use of org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.

the class OpenApiGenerator method generateSearch.

private void generateSearch(CapabilityStatementRestResourceComponent r) {
    OperationWriter op = makePathResType(r).operation("get");
    op.summary("Search all resources of type " + r.getType() + " based on a set of criteria");
    op.operationId("search" + r.getType());
    opOutcome(op.responses().defaultResponse());
    ResponseObjectWriter resp = op.responses().httpResponse("200");
    resp.description("the resource being returned");
    if (isJson())
        resp.content("application/fhir+json").schemaRef(specRef() + "/fhir.schema.json#/definitions/Bundle");
    if (isXml())
        resp.content("application/fhir+xml").schemaRef(specRef() + "/Bundle.xsd");
    // todo: how do we know that these apply?
    op.paramRef("#/components/parameters/format");
    op.paramRef("#/components/parameters/pretty");
    op.paramRef("#/components/parameters/summary");
    op.paramRef("#/components/parameters/elements");
    Set<String> set = new HashSet<>();
    for (CapabilityStatementRestResourceSearchParamComponent spc : r.getSearchParam()) {
        if (!set.contains(spc.getName())) {
            set.add(spc.getName());
            ParameterWriter p = op.parameter(spc.getName());
            p.in(ParameterLocation.query).description(spc.getDocumentation());
            p.schema().type(getSchemaType(spc.getType()));
            if (spc.hasDefinition()) {
                SearchParameter sp = context.fetchResource(SearchParameter.class, spc.getDefinition());
                if (sp != null) {
                    p.description(sp.getDescription());
                }
            }
        }
    }
}
Also used : CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) HashSet(java.util.HashSet)

Example 5 with CapabilityStatementRestResourceSearchParamComponent

use of org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method addRestSearchParamRow.

private Row addRestSearchParamRow(HierarchicalTableGenerator gen, List<Row> rows, StructuralMatch<Element> t, CapabilityStatementComparison comparison) {
    Row r = gen.new Row();
    rows.add(r);
    r.getCells().add(gen.new Cell(null, null, "searchParam", null, null));
    CapabilityStatementRestResourceSearchParamComponent left = t.hasLeft() ? (CapabilityStatementRestResourceSearchParamComponent) t.getLeft() : null;
    CapabilityStatementRestResourceSearchParamComponent right = t.hasRight() ? (CapabilityStatementRestResourceSearchParamComponent) t.getRight() : null;
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, true));
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
    r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, false));
    r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
    r.getCells().add(cellForMessages(gen, t.getMessages()));
    return r;
}
Also used : Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Aggregations

CapabilityStatementRestResourceSearchParamComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)7 CapabilityStatementRestResourceSearchParamComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)5 HashSet (java.util.HashSet)4 ArrayList (java.util.ArrayList)2 SearchParameter (org.hl7.fhir.r4b.model.SearchParameter)2 SearchParameter (org.hl7.fhir.r5.model.SearchParameter)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)2 XPathQueryGenerator (org.hl7.fhir.definitions.generators.specification.XPathQueryGenerator)1 BackboneElement (org.hl7.fhir.r4b.model.BackboneElement)1 Element (org.hl7.fhir.r4b.model.Element)1 BackboneElement (org.hl7.fhir.r5.model.BackboneElement)1 Element (org.hl7.fhir.r5.model.Element)1