Search in sources :

Example 41 with CapabilityStatementComparison

use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method addPrimitiveTypeRow.

@SuppressWarnings("rawtypes")
private Row addPrimitiveTypeRow(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, t.getName(), null, null));
    PrimitiveType left = t.hasLeft() ? (PrimitiveType) t.getLeft() : null;
    PrimitiveType right = t.hasRight() ? (PrimitiveType) t.getRight() : null;
    CanonicalResource crL = left == null ? null : (CanonicalResource) session.getContextLeft().fetchResource(Resource.class, left.primitiveValue());
    CanonicalResource crR = right == null ? null : (CanonicalResource) session.getContextRight().fetchResource(Resource.class, right.primitiveValue());
    String refL = crL != null && crL.hasUserData("path") ? crL.getUserString("path") : null;
    String dispL = crL != null && refL != null ? crL.present() : left == null ? "" : left.primitiveValue();
    String refR = crR != null && crR.hasUserData("path") ? crR.getUserString("path") : null;
    String dispR = crR != null && refR != null ? crR.present() : right == null ? "" : right.primitiveValue();
    r.getCells().add(style(gen.new Cell(null, refL, dispL, null, null), left != null ? left.primitiveValue() : null, right != null ? right.primitiveValue() : null, true));
    r.getCells().add(gen.new Cell(null, null, "", null, null));
    r.getCells().add(style(gen.new Cell(null, refR, dispR, null, null), left != null ? left.primitiveValue() : null, right != null ? right.primitiveValue() : null, false));
    r.getCells().add(gen.new Cell(null, null, "", null, null));
    r.getCells().add(cellForMessages(gen, t.getMessages()));
    return r;
}
Also used : PrimitiveType(org.hl7.fhir.r4b.model.PrimitiveType) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell) CanonicalResource(org.hl7.fhir.r4b.model.CanonicalResource)

Example 42 with CapabilityStatementComparison

use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method compareRestResources.

private void compareRestResources(CapabilityStatementRestComponent left, CapabilityStatementRestComponent right, StructuralMatch<Element> combined, CapabilityStatementRestComponent union, CapabilityStatementRestComponent intersection, CapabilityStatement csU, CapabilityStatement csI, CapabilityStatementComparison res, String path) {
    List<CapabilityStatementRestResourceComponent> matchR = new ArrayList<>();
    for (CapabilityStatementRestResourceComponent l : left.getResource()) {
        CapabilityStatementRestResourceComponent r = findInList(right.getResource(), l);
        if (r == null) {
            union.getResource().add(l);
            combined.getChildren().add(new StructuralMatch<Element>(l, vmI(IssueSeverity.INFORMATION, "Removed this item", path)));
        } else {
            matchR.add(r);
            CapabilityStatementRestResourceComponent cdM = mergeRestResource(l, r);
            CapabilityStatementRestResourceComponent cdI = intersectRestResource(l, r);
            union.getResource().add(cdM);
            intersection.getResource().add(cdI);
            StructuralMatch<Element> sm = new StructuralMatch<Element>(l, r);
            compareRestResource(sm, l, r, path, res, cdM, cdI);
            combined.getChildren().add(sm);
        }
    }
    for (CapabilityStatementRestResourceComponent r : right.getResource()) {
        if (!matchR.contains(r)) {
            union.getResource().add(r);
            combined.getChildren().add(new StructuralMatch<Element>(vmI(IssueSeverity.INFORMATION, "Added this concept", path), r));
        }
    }
}
Also used : BackboneElement(org.hl7.fhir.r4b.model.BackboneElement) Element(org.hl7.fhir.r4b.model.Element) ArrayList(java.util.ArrayList) CapabilityStatementRestResourceComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceComponent)

Example 43 with CapabilityStatementComparison

use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method compareSearchParams.

private void compareSearchParams(StructuralMatch<Element> combined, List<CapabilityStatementRestResourceSearchParamComponent> left, List<CapabilityStatementRestResourceSearchParamComponent> right, String path, CapabilityStatementComparison res, List<CapabilityStatementRestResourceSearchParamComponent> union, List<CapabilityStatementRestResourceSearchParamComponent> intersection) {
    List<CapabilityStatementRestResourceSearchParamComponent> matchR = new ArrayList<>();
    for (CapabilityStatementRestResourceSearchParamComponent l : left) {
        CapabilityStatementRestResourceSearchParamComponent r = findInList(right, l);
        if (r == null) {
            union.add(l);
            combined.getChildren().add(new StructuralMatch<Element>(l, vmI(IssueSeverity.INFORMATION, "Removed this Search Parameter", path)));
        } else {
            matchR.add(r);
            CapabilityStatementRestResourceSearchParamComponent cdM = mergeSearchParams(l, r);
            CapabilityStatementRestResourceSearchParamComponent cdI = intersectSearchParams(l, r);
            union.add(cdM);
            intersection.add(cdI);
            StructuralMatch<Element> sm = new StructuralMatch<Element>(l, r);
            compareStrings(path, sm.getMessages(), l.getDocumentation(), r.getDocumentation(), "documentation", IssueSeverity.INFORMATION, res);
            compareItemProperty(sm, "type", l.getTypeElement(), r.getTypeElement(), path, res, cdM.getTypeElement(), cdI.getTypeElement(), IssueSeverity.ERROR);
            compareItemProperty(sm, "definition", l.getDefinitionElement(), r.getDefinitionElement(), path, res, cdM.getDefinitionElement(), cdI.getDefinitionElement(), IssueSeverity.ERROR);
            compareExpectations(sm, l, r, path, res, cdM, cdI);
            combined.getChildren().add(sm);
        }
    }
    for (CapabilityStatementRestResourceSearchParamComponent r : right) {
        if (!matchR.contains(r)) {
            union.add(r);
            combined.getChildren().add(new StructuralMatch<Element>(vmI(IssueSeverity.INFORMATION, "Added this Search Parameter", path), r));
        }
    }
}
Also used : BackboneElement(org.hl7.fhir.r4b.model.BackboneElement) Element(org.hl7.fhir.r4b.model.Element) ArrayList(java.util.ArrayList) CapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)

Aggregations

Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)18 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)18 ArrayList (java.util.ArrayList)14 BackboneElement (org.hl7.fhir.r4b.model.BackboneElement)10 Element (org.hl7.fhir.r4b.model.Element)10 BackboneElement (org.hl7.fhir.r5.model.BackboneElement)10 Element (org.hl7.fhir.r5.model.Element)10 Date (java.util.Date)2 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)2 CapabilityStatementRestComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestComponent)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 CapabilityStatementRestResourceOperationComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)2 CapabilityStatementRestResourceSearchParamComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent)2 CapabilityStatementRestSecurityComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestSecurityComponent)2 ResourceInteractionComponent (org.hl7.fhir.r4b.model.CapabilityStatement.ResourceInteractionComponent)2 CodeableConcept (org.hl7.fhir.r4b.model.CodeableConcept)2 Extension (org.hl7.fhir.r4b.model.Extension)2 CapabilityStatement (org.hl7.fhir.r5.model.CapabilityStatement)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 ResourceInteractionComponent (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent)2