Class DefaultChangeTransformer
java.lang.Object
com.broadleafcommerce.data.tracking.core.mapping.DefaultChangeTransformer
- All Implemented Interfaces:
ChangeTransformer
,org.springframework.core.Ordered
- Author:
- Jeff Fischer
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionDefaultChangeTransformer
(com.fasterxml.jackson.databind.ObjectMapper fieldChangeMapper) -
Method Summary
Modifier and TypeMethodDescriptionboolean
applyChanges
(ChangeDetail detail, Trackable target, boolean reverse, boolean addDetail, boolean validateDetailVersion, String explicitVersion) Apply aChangeDetail
to a target entity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.ChangeTransformer
getOrder
-
Constructor Details
-
DefaultChangeTransformer
public DefaultChangeTransformer(com.fasterxml.jackson.databind.ObjectMapper fieldChangeMapper)
-
-
Method Details
-
applyChanges
public boolean applyChanges(ChangeDetail detail, Trackable target, boolean reverse, boolean addDetail, boolean validateDetailVersion, String explicitVersion) Apply aChangeDetail
to a target entity. Note, this implementation takes special care to keep ChangeDetails sorted according toChangeDetail.getVersion()
. Also, if validateDetailVersion is true, it makes sure if a newer version ChangeDetail has already been applied for the same field, it will not apply the older ChangeDetail value to the entity field.- Specified by:
applyChanges
in interfaceChangeTransformer
- Parameters:
detail
- The change to applytarget
- The target entity receiving the field updatereverse
- Whether to reverse and apply the detail before value, or not reverse and apply the after valueaddDetail
- Whether or not the detail should be added to the details collection on the target. If you were simply running through existing details to reset values, you would not want to add the details again as you did so, for example.validateDetailVersion
- Whether or not to check the detail version against any already applied changes for the field. This is useful if you want to make sure that an older version cannot override an already applied newer version. Primarily used during deploy.explicitVersion
- An indicator of change state for a sandbox entity (seeChangeDetail.getVersion()
)- Returns:
- Whether or not this transformer handled application of this ChangeDetail. Return false if the transformer wants to ignore a given ChangeDetail, thereby allowing another transformer to handle it.
-