-
Notifications
You must be signed in to change notification settings - Fork 157
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
base: main
Are you sure you want to change the base?
Conversation
…e is OperationOutcome Signed-off-by: PrasannaHegde1 <[email protected]>
* @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) { |
There was a problem hiding this comment.
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
Date startTime, Date endTime, Response.Status responseStatus) { | |
Date startTime, Date endTime, Response.Status responseStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed.
fhir-server/src/main/java/org/linuxforhealth/fhir/server/util/RestAuditLogger.java
Outdated
Show resolved
Hide resolved
Signed-off-by: PrasannaHegde1 <[email protected]>
Signed-off-by: PrasannaHegde1 <[email protected]>
Signed-off-by: PrasannaHegde1 <[email protected]>
Signed-off-by: PrasannaHegde1 <[email protected]>
// 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); |
There was a problem hiding this comment.
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(); | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor (whitespace removal)
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]); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor
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(); |
There was a problem hiding this comment.
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
…e is OperationOutcome
Signed-off-by: PrasannaHegde1 [email protected]