Class DefaultBasicAuditUtility
java.lang.Object
com.broadleafcommerce.data.tracking.core.DefaultBasicAuditUtility
- All Implemented Interfaces:
BasicAuditUtility
-
Constructor Summary
ConstructorDescriptionDefaultBasicAuditUtility
(RepositoryUtility repositoryUtility, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setCreateInformation
(String author, BasicAuditable auditable) Given an entity instance, set the create portion ofBasicAuditable
.void
setUpdateInformation
(String author, BasicAuditable auditable) Given an entity instance, set the update portion ofBasicAuditable
.void
setUpdateInformation
(String author, BasicAuditable auditable, BasicAuditable example) Given an entity instance, set the update portion ofBasicAuditable
.<D extends Trackable>
Dtouch
(ContextInfo contextInfo, String contextId, Class<D> repositoryEntityType, Trackable example) Set the update portion of aBasicAuditable
identified by the type and contextId, and then persist that change.
-
Constructor Details
-
DefaultBasicAuditUtility
public DefaultBasicAuditUtility(RepositoryUtility repositoryUtility, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
setUpdateInformation
Description copied from interface:BasicAuditUtility
Given an entity instance, set the update portion ofBasicAuditable
. Usually leveraged as part of another flow that is mutating and persisting an entity.- Specified by:
setUpdateInformation
in interfaceBasicAuditUtility
- Parameters:
author
- The creator of the update based on the authentication principalauditable
- The entity instance that exposes basic audit fields
-
setUpdateInformation
public void setUpdateInformation(@Nullable String author, BasicAuditable auditable, @Nullable BasicAuditable example) Description copied from interface:BasicAuditUtility
Given an entity instance, set the update portion ofBasicAuditable
. Usually leveraged as part of another flow that is mutating and persisting an entity.- Specified by:
setUpdateInformation
in interfaceBasicAuditUtility
- Parameters:
author
- The creator of the update based on the authentication principalauditable
- The entity instance that exposes basic audit fieldsexample
- aBasicAuditable
instance from which to derive the update date for the touch. The operation will only complete if the example update or creation date is newer than the update date already on the target.
-
setCreateInformation
Description copied from interface:BasicAuditUtility
Given an entity instance, set the create portion ofBasicAuditable
. Usually leveraged as part of another flow that is mutating and persisting an entity.- Specified by:
setCreateInformation
in interfaceBasicAuditUtility
- Parameters:
author
- The creator of the update based on the authentication principalauditable
- The entity instance that exposes basic audit fields
-
touch
public <D extends Trackable> D touch(@Nullable ContextInfo contextInfo, String contextId, Class<D> repositoryEntityType, @Nullable Trackable example) Description copied from interface:BasicAuditUtility
Set the update portion of aBasicAuditable
identified by the type and contextId, and then persist that change. This update also does not create sandbox state as a normal service operation might. The update here merely alters the persisted state of the entity found without further direct catalog propagation or sandbox support.InternalPersistenceEvent
.- Specified by:
touch
in interfaceBasicAuditUtility
- Type Parameters:
D
- The entity type- Parameters:
contextInfo
- Represents context information regarding the current API requestcontextId
- TheTrackable
id associated with the entity.repositoryEntityType
- The class type for the entityexample
- aTrackable
instance from which to derive the update date for the touch. The operation will only complete if the example update or creation date is newer than the update date already on the target.- Returns:
- The updated and persisted entity instance
-