issue-3455 - adding resource info from location when return preferenc…#4130
issue-3455 - adding resource info from location when return preferenc…#4130PrasannaHegde1 wants to merge 5 commits intomainfrom
Conversation
…e is OperationOutcome Signed-off-by: PrasannaHegde1 <phegde@merative.com>
| * @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.
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.
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 <phegde@merative.com>
Signed-off-by: PrasannaHegde1 <phegde@merative.com>
Signed-off-by: PrasannaHegde1 <phegde@merative.com>
Signed-off-by: PrasannaHegde1 <phegde@merative.com>
| // 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.
I see the original test had these commented out too, but it makes me wonder why...
| id = entry.getResource().getId(); | ||
| Resource resourceToDelete = entry.getResource(); | ||
|
|
||
There was a problem hiding this comment.
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.
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.
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.
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 phegde@merative.com