use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison 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;
}
use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison 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;
}
use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison in project org.hl7.fhir.core by hapifhir.
the class CapabilityStatementComparer method compareRestSecurityService.
private void compareRestSecurityService(CapabilityStatementRestSecurityComponent left, CapabilityStatementRestSecurityComponent right, StructuralMatch<Element> combined, CapabilityStatementRestSecurityComponent union, CapabilityStatementRestSecurityComponent intersection, CapabilityStatement csU, CapabilityStatement csI, CapabilityStatementComparison res, String path) {
List<CodeableConcept> matchR = new ArrayList<>();
for (CodeableConcept l : left.getService()) {
CodeableConcept r = findInList(right.getService(), l);
if (r == null) {
union.getService().add(l);
combined.getChildren().add(new StructuralMatch<Element>(l, vmI(IssueSeverity.INFORMATION, "Removed this item", path)));
} else {
matchR.add(r);
CodeableConcept cdM = CodeableConcept.merge(l, r);
CodeableConcept cdI = CodeableConcept.intersect(l, r);
union.getService().add(cdM);
intersection.getService().add(cdI);
StructuralMatch<Element> sm = new StructuralMatch<Element>(l, r);
compare(sm, l, r, path, res);
combined.getChildren().add(sm);
}
}
for (CodeableConcept r : right.getService()) {
if (!matchR.contains(r)) {
union.getService().add(r);
combined.getChildren().add(new StructuralMatch<Element>(vmI(IssueSeverity.INFORMATION, "Added this concept", path), r));
}
}
}
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;
}
use of org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison 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));
}
}
}
Aggregations