Class AuditEventUtility
java.lang.Object
com.broadleafcommerce.common.audit.event.AuditEventUtility
Generic utility for interacting with
AuditEvent, specifically for custom firing of this
type of event from anywhere in the Spring application.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidfire(AuditEvent auditEvent) static AuditInformationgetInfo(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the current SpringAuthenticationinstance associated with the current flow and derive username information from it.static AuditEventHeaderprepareHeader(Consumer<AuditEventHeader.AuditEventHeaderBuilder> customizer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Pre-fill most of the boilerplate information for anAuditEventHeaderinstance using context information available to the current flow.
-
Method Details
-
fire
-
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 anAuditEventHeaderinstance 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:
- Primary author - the data unique identifier value for the user record of the logged in customer
- Secondary author - username of any impersonating CSR
- Customer id - the data unique identifier value for the logged in customer
- Account id - the data unique identifier value for the account of the logged in customer
- Tenant id - the tenant identifier currently active for discrimination in the current flow
- Catalog id - the catalog identifier currently active for discrimination in the current flow
- 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 informationcontextInfo- The context information available to the current flow for tenant related data- Returns:
- A fully prepared
AuditEventHeaderinstance
-
getInfo
public static AuditInformation getInfo(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the current SpringAuthenticationinstance associated with the current flow and derive username information from it. Furthermore, derive tenant related information from the optionalContextInfoinstance.- Returns:
- The authentication and tenant related information
-