Skip to content

Commit

Permalink
ITI-81 response is not necessarily a Bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
unixoid committed Oct 25, 2023
1 parent 6ef6d36 commit 49edc96
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public AuditMessage[] makeAuditMessage(AuditContext auditContext, FhirAuditEvent

@Override
public boolean enrichAuditDatasetFromResponse(FhirAuditEventQueryAuditDataset auditDataset, Object response, AuditContext auditContext) {
var bundle = (Bundle) response;
bundle.getEntry().stream()
.filter(bundleEntryComponent -> bundleEntryComponent.getResource() instanceof AuditEvent)
.map(Bundle.BundleEntryComponent::getFullUrl)
.forEach(uri -> auditDataset.getAuditEventUris().add(uri));
if (response instanceof Bundle) {
var bundle = (Bundle) response;
bundle.getEntry().stream()
.filter(bundleEntryComponent -> bundleEntryComponent.getResource() instanceof AuditEvent)
.map(Bundle.BundleEntryComponent::getFullUrl)
.forEach(uri -> auditDataset.getAuditEventUris().add(uri));
}
return super.enrichAuditDatasetFromResponse(auditDataset, response, auditContext);
}
}

0 comments on commit 49edc96

Please sign in to comment.