use of org.hl7.fhir.r5.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));
}
}
}
use of org.hl7.fhir.r5.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;
}
use of org.hl7.fhir.r5.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;
}
use of org.hl7.fhir.r5.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);
}
use of org.hl7.fhir.r5.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;
}
Aggregations