Class DatabaseAuditScope

java.lang.Object
fr.becpg.repo.audit.service.DatabaseAuditScope
All Implemented Interfaces:
AutoCloseable

public class DatabaseAuditScope extends Object implements AutoCloseable

DatabaseAuditScope class.

Version:
$Id: $Id
Author:
matthieu
  • Field Details

    • databaseAuditService

      private DatabaseAuditService databaseAuditService
    • auditPlugin

      private DatabaseAuditPlugin auditPlugin
    • auditValues

      private Map<String,Serializable> auditValues
    • shouldRecordAudit

      private boolean shouldRecordAudit
    • startRecorded

      private boolean startRecorded
    • completedElsewhere

      private boolean completedElsewhere
  • Constructor Details

  • Method Details

    • disableAuditRecord

      public void disableAuditRecord()

      disableAuditRecord.

    • recordStart

      public void recordStart()
      Record the entry of an operation that may never complete, before running it. The entry is flagged as not completed and is replaced by the completed one when the scope is closed. Only the plugins declaring DatabaseAuditPlugin.isRecordOnStart() take part in this two phase recording.
    • deferCompletion

      public void deferCompletion()
      Hand the completion of the entry over to the thread that actually runs the operation. Closing the scope then only records the entry of the started operation: the duration of an asynchronous export measured by the thread that requested it would be the duration of the request, not the one of the export.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • putAttribute

      public void putAttribute(String string, Object attribute)

      putAttribute.

      Parameters:
      string - a String object
      attribute - a Object object
    • start

      public void start()

      start.

      The identifier a completed entry replaces its started one on is drawn at random: derived from the start date alone, two operations starting in the same millisecond would share it and completing one would delete the entry of the other.
    • completeAuditValues

      private void completeAuditValues()