Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #2365 - Show resource ids in conditional delete operation outcome #2367

Merged
merged 1 commit into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package com.ibm.fhir.server.test;

import static com.ibm.fhir.model.type.String.string;
import static org.testng.Assert.assertTrue;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;

Expand Down Expand Up @@ -419,6 +420,9 @@ public void testConditionalDeleteOneResource() throws Exception {
assertResponse(response.getResponse(), Response.Status.OK.getStatusCode());
assertNotNull(response.getETag());
assertEquals("W/\"2\"", response.getETag());
// Check for resourceId in details message
OperationOutcome operationOutcome = response.getResource(OperationOutcome.class);
assertTrue(operationOutcome.getIssue().get(0).getDetails().getText().getValue().contains(obsId));
} else {
assertResponse(response.getResponse(), Response.Status.METHOD_NOT_ALLOWED.getStatusCode());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ private List<Entry> processEntriesByMethod(Bundle requestBundle, Map<Integer, En
txn.commit();
txn = null;
}

return Arrays.asList(responseEntries);

} finally {
Expand Down Expand Up @@ -2563,6 +2563,7 @@ Bundle createSearchBundle(List<Resource> resources, FHIRSearchContext searchCont
Entry.Builder entryBuilder = Entry.builder();
if (resource != null) {
if (resource.getId() != null) {
entryBuilder.id(resource.getId());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using the Entry.id for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess its because there is no resource in the response entries, and so we can't use the normal Entry.resource.id. Still, I think we might want a comment for this because using Entry.id for the id of the deleted resource is a bit unique.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side-note: you definitely didn't introduce this idea of using the entry id for this. that comes from
FHIRRestHelper.doDelete near line 722:

responseBundle.getEntry().stream().map(Bundle.Entry::getId).collect(Collectors.joining(","))

entryBuilder.fullUrl(Uri.of(getRequestBaseUri(type) + "/" + resource.getClass().getSimpleName() + "/" + resource.getId()));
} else {
String msg = "A resource with no id was found.";
Expand Down