Class RestAuditLogger


  • public class RestAuditLogger
    extends Object
    This class provides convenience methods for FHIR Rest services that need to write FHIR audit log entries.
    • Constructor Summary

      Constructors 
      Constructor Description
      RestAuditLogger()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void logBundle​(javax.servlet.http.HttpServletRequest request, Bundle requestBundle, Bundle responseBundle, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'bundle' REST service invocation.
      static void logConfig​(String configData)
      Logs an Audit Log Entry for FHIR server configuration data.
      static void logCreate​(javax.servlet.http.HttpServletRequest request, Resource resource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'create' REST service invocation.
      static void logDelete​(javax.servlet.http.HttpServletRequest request, Resource resource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'delete' REST service invocation.
      static void logHistory​(javax.servlet.http.HttpServletRequest request, Bundle bundle, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'history' REST service invocation.
      static void logMetadata​(javax.servlet.http.HttpServletRequest request, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'metadata' REST service invocation.
      static void logOperation​(javax.servlet.http.HttpServletRequest request, String operationName, String resourceTypeName, String logicalId, String versionId, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for an 'operation' REST service invocation.
      static void logPatch​(javax.servlet.http.HttpServletRequest request, Resource oldResource, Resource updatedResource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for an 'patch' REST service invocation.
      static void logRead​(javax.servlet.http.HttpServletRequest request, Resource resource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'read' REST service invocation.
      static void logSearch​(javax.servlet.http.HttpServletRequest request, javax.ws.rs.core.MultivaluedMap<String,​String> queryParms, Bundle bundle, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'search' REST service invocation.
      static void logUpdate​(javax.servlet.http.HttpServletRequest request, Resource oldResource, Resource updatedResource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for an 'update' REST service invocation.
      static void logValidate​(javax.servlet.http.HttpServletRequest request, Resource resource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'validate' REST service invocation.
      static void logVersionRead​(javax.servlet.http.HttpServletRequest request, Resource resource, Date startTime, Date endTime, javax.ws.rs.core.Response.Status responseStatus)
      Builds an audit log entry for a 'version-read' REST service invocation.
    • Constructor Detail

      • RestAuditLogger

        public RestAuditLogger()
    • Method Detail

      • logCreate

        public static void logCreate​(javax.servlet.http.HttpServletRequest request,
                                     Resource resource,
                                     Date startTime,
                                     Date endTime,
                                     javax.ws.rs.core.Response.Status responseStatus)
                              throws Exception
        Builds an audit log entry for a 'create' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        resource - The Resource object being created.
        startTime - The start time of the create request execution.
        endTime - The end time of the create request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logUpdate

        public static void logUpdate​(javax.servlet.http.HttpServletRequest request,
                                     Resource oldResource,
                                     Resource updatedResource,
                                     Date startTime,
                                     Date endTime,
                                     javax.ws.rs.core.Response.Status responseStatus)
                              throws Exception
        Builds an audit log entry for an 'update' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        oldResource - The previous version of the Resource, before it was updated.
        updatedResource - The updated version of the Resource.
        startTime - The start time of the update request execution.
        endTime - The end time of the update request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logPatch

        public static void logPatch​(javax.servlet.http.HttpServletRequest request,
                                    Resource oldResource,
                                    Resource updatedResource,
                                    Date startTime,
                                    Date endTime,
                                    javax.ws.rs.core.Response.Status responseStatus)
                             throws Exception
        Builds an audit log entry for an 'patch' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        oldResource - The previous version of the Resource, before it was patched.
        updatedResource - The patched version of the Resource.
        startTime - The start time of the patch request execution.
        endTime - The end time of the patch request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logRead

        public static void logRead​(javax.servlet.http.HttpServletRequest request,
                                   Resource resource,
                                   Date startTime,
                                   Date endTime,
                                   javax.ws.rs.core.Response.Status responseStatus)
                            throws Exception
        Builds an audit log entry for a 'read' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        resource - The Resource object being read.
        startTime - The start time of the read request execution.
        endTime - The end time of the read request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logDelete

        public static void logDelete​(javax.servlet.http.HttpServletRequest request,
                                     Resource resource,
                                     Date startTime,
                                     Date endTime,
                                     javax.ws.rs.core.Response.Status responseStatus)
                              throws Exception
        Builds an audit log entry for a 'delete' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        resource - The Resource object being deleted.
        startTime - The start time of the read request execution.
        endTime - The end time of the read request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logVersionRead

        public static void logVersionRead​(javax.servlet.http.HttpServletRequest request,
                                          Resource resource,
                                          Date startTime,
                                          Date endTime,
                                          javax.ws.rs.core.Response.Status responseStatus)
                                   throws Exception
        Builds an audit log entry for a 'version-read' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        resource - The Resource object being read.
        startTime - The start time of the read request execution.
        endTime - The end time of the read request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logHistory

        public static void logHistory​(javax.servlet.http.HttpServletRequest request,
                                      Bundle bundle,
                                      Date startTime,
                                      Date endTime,
                                      javax.ws.rs.core.Response.Status responseStatus)
                               throws Exception
        Builds an audit log entry for a 'history' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        bundle - The Bundle that is returned to the REST service caller.
        startTime - The start time of the bundle request execution.
        endTime - The end time of the bundle request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logValidate

        public static void logValidate​(javax.servlet.http.HttpServletRequest request,
                                       Resource resource,
                                       Date startTime,
                                       Date endTime,
                                       javax.ws.rs.core.Response.Status responseStatus)
                                throws Exception
        Builds an audit log entry for a 'validate' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        resource - The Resource object being validated.
        startTime - The start time of the validate request execution.
        endTime - The end time of the validate request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logBundle

        public static void logBundle​(javax.servlet.http.HttpServletRequest request,
                                     Bundle requestBundle,
                                     Bundle responseBundle,
                                     Date startTime,
                                     Date endTime,
                                     javax.ws.rs.core.Response.Status responseStatus)
                              throws Exception
        Builds an audit log entry for a 'bundle' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        requestBundle - The Bundle that contains the requests.
        responseBundle - The Bundle that is returned to the REST service caller.
        startTime - The start time of the bundle request execution.
        endTime - The end time of the bundle request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logSearch

        public static void logSearch​(javax.servlet.http.HttpServletRequest request,
                                     javax.ws.rs.core.MultivaluedMap<String,​String> queryParms,
                                     Bundle bundle,
                                     Date startTime,
                                     Date endTime,
                                     javax.ws.rs.core.Response.Status responseStatus)
                              throws Exception
        Builds an audit log entry for a 'search' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        queryParms - The query parameters passed to the search REST service.
        bundle - The Bundle that is returned to the REST service caller.
        startTime - The start time of the bundle request execution.
        endTime - The end time of the bundle request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logMetadata

        public static void logMetadata​(javax.servlet.http.HttpServletRequest request,
                                       Date startTime,
                                       Date endTime,
                                       javax.ws.rs.core.Response.Status responseStatus)
                                throws Exception
        Builds an audit log entry for a 'metadata' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        startTime - The start time of the metadata request execution.
        endTime - The end time of the metadata request execution.
        responseStatus - The response status.
        Throws:
        Exception
      • logConfig

        public static void logConfig​(String configData)
                              throws Exception
        Logs an Audit Log Entry for FHIR server configuration data.
        Parameters:
        configData - The configuration data to be saved in the audit log.
        Throws:
        Exception
      • logOperation

        public static void logOperation​(javax.servlet.http.HttpServletRequest request,
                                        String operationName,
                                        String resourceTypeName,
                                        String logicalId,
                                        String versionId,
                                        Date startTime,
                                        Date endTime,
                                        javax.ws.rs.core.Response.Status responseStatus)
        Builds an audit log entry for an 'operation' REST service invocation.
        Parameters:
        request - The HttpServletRequest representation of the REST request.
        operationName - The name of the operation being executed.
        resourceTypeName - The name of the resource type that is the target of the operation.
        logicalId - The logical id of the target resource.
        versionId - The version id of the target resource.
        startTime - The start time of the metadata request execution.
        endTime - The end time of the metadata request execution.
        responseStatus - The response status.