Search in sources :

Example 1 with ResourceInteractionComponent

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

the class CapabilityStatementComparer method compareRestResourceInteractions.

private void compareRestResourceInteractions(StructuralMatch<Element> combined, CapabilityStatementRestResourceComponent left, CapabilityStatementRestResourceComponent right, String path, CapabilityStatementComparison res, CapabilityStatementRestResourceComponent union, CapabilityStatementRestResourceComponent intersection) {
    List<ResourceInteractionComponent> matchR = new ArrayList<>();
    for (ResourceInteractionComponent l : left.getInteraction()) {
        ResourceInteractionComponent r = findInList(right.getInteraction(), l);
        if (r == null) {
            union.getInteraction().add(l);
            combined.getChildren().add(new StructuralMatch<Element>(l, vmI(IssueSeverity.INFORMATION, "Removed this item", path)));
        } else {
            matchR.add(r);
            ResourceInteractionComponent cdM = mergeRestResourceInteractions(l, r);
            ResourceInteractionComponent cdI = intersectRestResourceInteractions(l, r);
            union.getInteraction().add(cdM);
            intersection.getInteraction().add(cdI);
            StructuralMatch<Element> sm = new StructuralMatch<Element>(l, r);
            compareStrings(path, sm.getMessages(), l.getDocumentation(), r.getDocumentation(), "documentation", IssueSeverity.INFORMATION, res);
            compareExpectations(sm, l, r, path, res, union, intersection);
            combined.getChildren().add(sm);
        }
    }
    for (ResourceInteractionComponent r : right.getInteraction()) {
        if (!matchR.contains(r)) {
            union.getInteraction().add(r);
            combined.getChildren().add(new StructuralMatch<Element>(vmI(IssueSeverity.INFORMATION, "Added this concept", path), r));
        }
    }
}
Also used : ResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent) BackboneElement(org.hl7.fhir.r5.model.BackboneElement) Element(org.hl7.fhir.r5.model.Element) ArrayList(java.util.ArrayList)

Example 2 with ResourceInteractionComponent

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

the class CapabilityStatementComparer method addRestResourceInteractionRow.

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

Example 3 with ResourceInteractionComponent

use of org.hl7.fhir.r4b.model.CapabilityStatement.ResourceInteractionComponent in project pathling by aehrc.

the class ConformanceProvider method buildResources.

@Nonnull
private List<CapabilityStatementRestResourceComponent> buildResources() {
    final List<CapabilityStatementRestResourceComponent> resources = new ArrayList<>();
    final Set<ResourceType> supported = FhirServer.supportedResourceTypes();
    final Set<ResourceType> supportedResourceTypes = supported.isEmpty() ? EnumSet.noneOf(ResourceType.class) : EnumSet.copyOf(supported);
    for (final ResourceType resourceType : supportedResourceTypes) {
        final CapabilityStatementRestResourceComponent resource = new CapabilityStatementRestResourceComponent(new CodeType(resourceType.toCode()));
        resource.setProfile(FHIR_RESOURCE_BASE + resourceType.toCode());
        // Add the search operation to all resources.
        final ResourceInteractionComponent search = new ResourceInteractionComponent();
        search.setCode(TypeRestfulInteraction.SEARCHTYPE);
        resource.getInteraction().add(search);
        // Add the create and update operations to all resources.
        final ResourceInteractionComponent create = new ResourceInteractionComponent();
        final ResourceInteractionComponent update = new ResourceInteractionComponent();
        create.setCode(TypeRestfulInteraction.CREATE);
        update.setCode(TypeRestfulInteraction.UPDATE);
        resource.getInteraction().add(create);
        resource.getInteraction().add(update);
        // Add the `aggregate` operation to all resources.
        final CanonicalType aggregateOperationUri = new CanonicalType(getOperationUri("aggregate"));
        final CapabilityStatementRestResourceOperationComponent aggregateOperation = new CapabilityStatementRestResourceOperationComponent(new StringType("aggregate"), aggregateOperationUri);
        resource.addOperation(aggregateOperation);
        // Add the `fhirPath` search parameter to all resources.
        final CapabilityStatementRestResourceOperationComponent searchOperation = new CapabilityStatementRestResourceOperationComponent();
        searchOperation.setName("fhirPath");
        searchOperation.setDefinition(getOperationUri("search"));
        resource.addOperation(searchOperation);
        resources.add(resource);
    }
    // Add the read operation to the OperationDefinition resource.
    final String opDefCode = ResourceType.OPERATIONDEFINITION.toCode();
    final CapabilityStatementRestResourceComponent opDefResource = new CapabilityStatementRestResourceComponent(new CodeType(opDefCode));
    opDefResource.setProfile(FHIR_RESOURCE_BASE + opDefCode);
    final ResourceInteractionComponent readInteraction = new ResourceInteractionComponent();
    readInteraction.setCode(TypeRestfulInteraction.READ);
    opDefResource.addInteraction(readInteraction);
    resources.add(opDefResource);
    return resources;
}
Also used : ResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent) StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList) CodeType(org.hl7.fhir.r4.model.CodeType) ResourceType(org.hl7.fhir.r4.model.Enumerations.ResourceType) CapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent) Nonnull(javax.annotation.Nonnull)

Example 4 with ResourceInteractionComponent

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

the class Publisher method genConfInteraction.

private void genConfInteraction(CapabilityStatement conf, CapabilityStatementRestResourceComponent res, TypeRestfulInteraction op, String doco) {
    ResourceInteractionComponent t = new ResourceInteractionComponent();
    t.setCode(op);
    t.setDocumentation(doco);
    res.getInteraction().add(t);
}
Also used : ResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent)

Example 5 with ResourceInteractionComponent

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

the class CapabilityStatementComparer method addRestResourceInteractionRow.

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

Aggregations

ArrayList (java.util.ArrayList)3 ResourceInteractionComponent (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent)3 ResourceInteractionComponent (org.hl7.fhir.r4b.model.CapabilityStatement.ResourceInteractionComponent)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)2 Nonnull (javax.annotation.Nonnull)1 CanonicalType (org.hl7.fhir.r4.model.CanonicalType)1 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)1 CapabilityStatementRestResourceOperationComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)1 ResourceInteractionComponent (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent)1 CodeType (org.hl7.fhir.r4.model.CodeType)1 ResourceType (org.hl7.fhir.r4.model.Enumerations.ResourceType)1 StringType (org.hl7.fhir.r4.model.StringType)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