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-3455 - adding resource info from location when return preferenc… #4130

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

PrasannaHegde1
Copy link
Collaborator

…e is OperationOutcome

Signed-off-by: PrasannaHegde1 [email protected]

@PrasannaHegde1 PrasannaHegde1 marked this pull request as draft December 15, 2022 11:37
@PrasannaHegde1 PrasannaHegde1 marked this pull request as ready for review December 15, 2022 12:22
* @return AuditLogEntry - an initialized audit log entry.
*/
protected static AuditLogEntry populateBundleAuditLogEntry(AuditLogEntry entry, Bundle.Entry responseEntry, HttpServletRequest request, Resource resource,
Date startTime, Date endTime, Response.Status responseStatus) {
Copy link
Member

Choose a reason for hiding this comment

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

minor formatting: for method signatures that span multiple lines we double-indent to offset from the first line of the implementation

Suggested change
Date startTime, Date endTime, Response.Status responseStatus) {
Date startTime, Date endTime, Response.Status responseStatus) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been fixed.

Comment on lines +1566 to +1569
// history
// bundle = addRequestToBundle(null, bundle, HTTPVerb.GET, "Patient/" + patientT1.getId() + "/_history", null, null);
// search
// bundle = addRequestToBundle(null, bundle, HTTPVerb.GET, "Patient?family=Ortiz&_count=100", null, null);
Copy link
Member

Choose a reason for hiding this comment

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

I see the original test had these commented out too, but it makes me wonder why...

for (Entry entry: responseBundle.getEntry()) {
id = entry.getResource().getId();
Resource resourceToDelete = entry.getResource();

Copy link
Member

@lmsurpre lmsurpre Jan 24, 2023

Choose a reason for hiding this comment

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

very minor (whitespace removal)

Suggested change

Comment on lines +831 to +846
if (HTTPReturnPreference.REPRESENTATION.equals(FHIRRequestContext.get().getReturnPreference())) {
return entry;
}
if (responseEntry.getResponse() == null || responseEntry.getResponse().getLocation() == null) {
return entry;
}
// Populate the resource id, resource type and version id from the
// Bundle response entry location when the return preference is "OperationOutcome".
String location = responseEntry.getResponse().getLocation().getValue();
String[] parts = location.split("/");
if (parts.length > 3) {
Collections.reverse(Arrays.asList(parts));
entry.getContext().setData(Data.builder().build());
entry.getContext().getData().setResourceType(parts[3]);
entry.getContext().getData().setVersionId(parts[0]);
entry.getContext().getData().setId(parts[2]);
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to always populate the AuditLogEntry in the same way (e.g. from the response location)?
do we not set that unless the return preference is OperationOutcome?

* @throws Exception
*/
protected static void logBundleDelete(AuditLogService auditLogSvc, Bundle.Entry responseEntry, HttpServletRequest request, Resource resource,
Date startTime, Date endTime, Response.Status responseStatus, String location, String description) throws Exception {
Copy link
Member

Choose a reason for hiding this comment

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

minor

Suggested change
Date startTime, Date endTime, Response.Status responseStatus, String location, String description) throws Exception {
Date startTime, Date endTime, Response.Status responseStatus, String location, String description) throws Exception {

for (Extension extension : responseEntry.getExtension()) {
AuditLogEntry entry = initLogEntry(AuditLogEventType.FHIR_BUNDLE);
populateAuditLogEntry(entry, request, resource, startTime, endTime, responseStatus);
String resourceInfo = extension.getValue().as(FHIR_STRING).getValue();
Copy link
Member

Choose a reason for hiding this comment

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

I think we should double-check the URL of the extension instead of just assuming all extensions will be the ones we're expecting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants