Search in sources :

Example 6 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method compareRestSecurity.

private void compareRestSecurity(CapabilityStatementRestComponent l, CapabilityStatementRestComponent r, StructuralMatch<Element> smp, CapabilityStatementRestSecurityComponent merge, CapabilityStatementRestSecurityComponent intersect, CapabilityStatement csU, CapabilityStatement csI, CapabilityStatementComparison res, String path) {
    CapabilityStatementRestSecurityComponent ls = l.hasSecurity() ? l.getSecurity() : null;
    CapabilityStatementRestSecurityComponent rs = r.hasSecurity() ? r.getSecurity() : null;
    StructuralMatch<Element> sm = new StructuralMatch<Element>(ls, rs);
    smp.getChildren().add(sm);
    compareBooleans(path, sm.getMessages(), l.getSecurity().getCorsElement(), r.getSecurity().getCorsElement(), "security.cors", IssueSeverity.WARNING, res);
    compareStrings(path, sm.getMessages(), l.getSecurity().getDescription(), r.getSecurity().getDescription(), "security.description", IssueSeverity.INFORMATION, res);
    compareRestSecurityService(ls, rs, sm, merge, intersect, csU, csI, res, path + ".security");
}
Also used : CapabilityStatementRestSecurityComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestSecurityComponent) BackboneElement(org.hl7.fhir.r4b.model.BackboneElement) Element(org.hl7.fhir.r4b.model.Element)

Example 7 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method addRestRow.

private Row addRestRow(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, "mode", null, null));
    CapabilityStatementRestComponent left = t.hasLeft() ? (CapabilityStatementRestComponent) t.getLeft() : null;
    CapabilityStatementRestComponent right = t.hasRight() ? (CapabilityStatementRestComponent) t.getRight() : null;
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getMode().toCode() : "", null, null), left != null ? left.getMode().toCode() : null, right != null ? right.getMode().toCode() : 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.getMode().toCode() : "", null, null), left != null ? left.getMode().toCode() : null, right != null ? right.getMode().toCode() : 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 : CapabilityStatementRestComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestComponent) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Example 8 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent 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 9 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method addRestRow.

private Row addRestRow(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, "mode", null, null));
    CapabilityStatementRestComponent left = t.hasLeft() ? (CapabilityStatementRestComponent) t.getLeft() : null;
    CapabilityStatementRestComponent right = t.hasRight() ? (CapabilityStatementRestComponent) t.getRight() : null;
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getMode().toCode() : "", null, null), left != null ? left.getMode().toCode() : null, right != null ? right.getMode().toCode() : 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.getMode().toCode() : "", null, null), left != null ? left.getMode().toCode() : null, right != null ? right.getMode().toCode() : 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 : CapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Example 10 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent 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.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent) SearchParameter(org.hl7.fhir.r5.model.SearchParameter) HashSet(java.util.HashSet)

Aggregations

CapabilityStatementRestComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent)7 ArrayList (java.util.ArrayList)5 CapabilityStatementRestResourceComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent)5 CapabilityStatementRestComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent)4 CapabilityStatementRestComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestComponent)4 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)4 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)3 BackboneElement (org.hl7.fhir.r4b.model.BackboneElement)3 Element (org.hl7.fhir.r4b.model.Element)3 BackboneElement (org.hl7.fhir.r5.model.BackboneElement)3 Element (org.hl7.fhir.r5.model.Element)3 HashSet (java.util.HashSet)2 CapabilityStatementRestComponent (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 CapabilityStatementRestSecurityComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)2 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)1 VersionUtil (ca.uhn.fhir.util.VersionUtil)1