Class AuditEventUtility

java.lang.Object
com.broadleafcommerce.common.audit.event.AuditEventUtility

@Component public class AuditEventUtility extends Object
Generic utility for interacting with AuditEvent, specifically for custom firing of this type of event from anywhere in the Spring application.
  • Method Details

    • fire

      public static void fire(AuditEvent auditEvent)
    • prepareHeader

      public static AuditEventHeader prepareHeader(Consumer<AuditEventHeader.AuditEventHeaderBuilder> customizer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Pre-fill most of the boilerplate information for an AuditEventHeader instance using context information available to the current flow. Provide a caller-supplied customizer to fill in the remaining details.

      The following information is attempted to be harvested from context:

      1. Primary author - the data unique identifier value for the user record of the logged in customer
      2. Secondary author - username of any impersonating CSR
      3. Customer id - the data unique identifier value for the logged in customer
      4. Account id - the data unique identifier value for the account of the logged in customer
      5. Tenant id - the tenant identifier currently active for discrimination in the current flow
      6. Catalog id - the catalog identifier currently active for discrimination in the current flow
      7. Application id - the application identifier currently active for discrimination in the current flow

      Parameters:
      customizer - A customizer to fill in the remaining details not covered by the context information
      contextInfo - The context information available to the current flow for tenant related data
      Returns:
      A fully prepared AuditEventHeader instance
    • getInfo

      public static AuditInformation getInfo(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieve the current Spring Authentication instance associated with the current flow and derive username information from it. Furthermore, derive tenant related information from the optional ContextInfo instance.
      Returns:
      The authentication and tenant related information