Class DefaultWorkflowMapper
java.lang.Object
com.broadleafcommerce.data.tracking.core.mapping.DefaultWorkflowMapper
- All Implemented Interfaces:
WorkflowMapper
- Author:
- Jeff Fischer
-
Constructor Summary
ConstructorDescriptionDefaultWorkflowMapper
(com.broadleafcommerce.common.extension.TypeFactory factory, TrackableBehaviorUtil behaviorUtil, List<ChangeTransformer> changeTransformers, org.modelmapper.ModelMapper cloneMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyChanges
(ChangeDetail detail, Trackable target, boolean reverse, boolean addDetail, boolean validateDetailVersion, String explicitVersion) Apply aChangeDetail
to a promotion target entityprotected void
deployChange
(Trackable original, Trackable target, String propagationId, String version) Handle the advancement of changes (non-delete) from a starting object to a target object.protected void
deployDelete
(Trackable original, Trackable target) Handle the advancement of a delete change from a starting object to a target object.deployMap
(Trackable original, Trackable target, WorkflowDeployRequest request, String propagationId) Transfer state (viaChangeDetail
between an original item and the target production state.protected void
promoteChange
(Trackable original, Trackable target, String promotionId) Handle the advancement of changes (non-delete) from a starting object to a target object based on matching promotion id.protected void
promoteDelete
(Trackable original, Trackable target, String promotionId) Handle the advancement of a delete change from a starting object to a target object based on matching promotion id.promoteMap
(Trackable original, Trackable target, WorkflowPromoteRequest request) Transfer state (viaChangeDetail
between an original item and a target item.propagateMap
(Trackable original, Trackable target, boolean delete, String propagationId) Transfer state (viaChangeDetail
between an original item and a target item belonging to a parentCatalog
and a child Catalog, respectively.rebaseMap
(Trackable original, Trackable target, WorkflowRebaseRequest request) Update an original item withChangeDetail
state from a target that is missing in the original.rejectMap
(Trackable original, Trackable target, WorkflowRejectRequest request) Transfer state (viaChangeDetail
between a promoted sandbox state item to a new user state item.revertMap
(Trackable original, WorkflowRevertRequest request) Update an originalTrackingLevel.USER
level record to represent a reverted state.void
setAuditUtility
(BasicAuditUtility auditUtility)
-
Constructor Details
-
DefaultWorkflowMapper
public DefaultWorkflowMapper(com.broadleafcommerce.common.extension.TypeFactory factory, TrackableBehaviorUtil behaviorUtil, List<ChangeTransformer> changeTransformers, org.modelmapper.ModelMapper cloneMapper)
-
-
Method Details
-
rebaseMap
Description copied from interface:WorkflowMapper
Update an original item withChangeDetail
state from a target that is missing in the original. Then, re-apply unpromoted changes from the original on top (possibly squashing the effect of one or more of the inherited changes from target). This is generally useful for bringing a user state up-to-date with changes in a target state. The missing changes were presumably introduced by another process (usually promotes from another user).- Specified by:
rebaseMap
in interfaceWorkflowMapper
- Parameters:
original
- The less advanced item that is missing changestarget
- The more advanced item that contains changes not already in the originalrequest
- The specific rebase request- Returns:
- The new state for the original with the changes applied. This state still needs to be persisted in order to overwrite the current original datastore state.
-
promoteMap
public ForwardMapResponse promoteMap(Trackable original, Trackable target, WorkflowPromoteRequest request) Description copied from interface:WorkflowMapper
Transfer state (viaChangeDetail
between an original item and a target item. If the target is null (as is the case withOperationType.CREATE
original items), a clone of the original is created whose target level status is set to the targetSandboxId, targetLevel and targetStage defined in the PromotionRequest param.- Specified by:
promoteMap
in interfaceWorkflowMapper
- Parameters:
original
- The item containing the changes to transfertarget
- The item receiving the changes. Can be null, in which case a clone of the original is maderequest
- Contains the target state information used to inform the target state- Returns:
- A response object containing information about the result of the promotion operation.
-
deployMap
public ForwardMapResponse deployMap(Trackable original, Trackable target, WorkflowDeployRequest request, String propagationId) Description copied from interface:WorkflowMapper
Transfer state (viaChangeDetail
between an original item and the target production state. If the target is null (as is the case withOperationType.CREATE
original items), a clone of the original is created whose target level status is set toTrackingLevel.PRODUCTION
.- Specified by:
deployMap
in interfaceWorkflowMapper
- Parameters:
original
- The item containing the changes to transfertarget
- The production item receiving the changes. Can be null, in which case a clone of the original is maderequest
- Contains the target state information used to inform the target statepropagationId
- Demarcates one or more specificChangeDetail
instances created during the deploy as viable for propagation.- Returns:
- A response object containing information about the result of the deployment operation.
-
rejectMap
public RejectMapResponse rejectMap(Trackable original, Trackable target, WorkflowRejectRequest request) Description copied from interface:WorkflowMapper
Transfer state (viaChangeDetail
between a promoted sandbox state item to a new user state item. This occurs when a promoted sandbox state item contains one or more change details related to a promotion that has been rejected, thus sending those specific changes backward. If the promoted state sandbox item contains changes from multiple promotions, then the changes for the rejected promotion are removed and the entity state is updated to reflect. Finally, those changes matching the rejected promotion are applied to a new user sandbox state entity for the change author's review.- Specified by:
rejectMap
in interfaceWorkflowMapper
- Parameters:
original
- The current sandbox state of an entity that contains changes from one or more promotionstarget
- The user-level item receiving the changes. Can be null, in which case a clone of the original is maderequest
- The specific promotion rejection request- Returns:
- A pair containing the promoted state and the user state. The promoted state may be null if it was entirely rejected.
-
revertMap
Description copied from interface:WorkflowMapper
Update an originalTrackingLevel.USER
level record to represent a reverted state. This usually involves setting archive values to represent the item is no longer active.- Specified by:
revertMap
in interfaceWorkflowMapper
- Parameters:
original
- The item that is being deactivatedrequest
- The specific revert request- Returns:
- The resulting state of the archived instance
-
propagateMap
public Trackable propagateMap(Trackable original, Trackable target, boolean delete, String propagationId) Description copied from interface:WorkflowMapper
Transfer state (viaChangeDetail
between an original item and a target item belonging to a parentCatalog
and a child Catalog, respectively. Propagation should pay attention toFieldOverride
inTracking.getFieldOverrides()
and ignore colliding ChangeDetails.- Specified by:
propagateMap
in interfaceWorkflowMapper
- Parameters:
original
- The item containing the changes to transfertarget
- The item receiving the changesdelete
- Whether or not the propagation change is aOperationType.DELETE
propagationId
- Demarcates one or more specificChangeDetail
instances created during the deploy as viable for propagation. Should be the same value passed toWorkflowMapper.deployMap(Trackable, Trackable, WorkflowDeployRequest, String)
.- Returns:
- The resulting target state of the repository domain
-
promoteChange
Handle the advancement of changes (non-delete) from a starting object to a target object based on matching promotion id. The advancement is to another sandbox state.- Parameters:
original
- The starting objecttarget
- The destination objectpromotionId
- The promotion id to match changes on
-
deployChange
protected void deployChange(Trackable original, Trackable target, String propagationId, String version) Handle the advancement of changes (non-delete) from a starting object to a target object. Only changes equal to the version are advanced. The advancement is to the production state.- Parameters:
original
- The starting objecttarget
- The destination objectpropagationId
- Id used to track changes during a catalog propagationversion
- the change version to advance
-
promoteDelete
Handle the advancement of a delete change from a starting object to a target object based on matching promotion id. The advancement is to another sandbox.- Parameters:
original
- The starting objecttarget
- The destination objectpromotionId
- The promotion id to match changes on
-
deployDelete
Handle the advancement of a delete change from a starting object to a target object. The advancement is to the production state.- Parameters:
original
- The starting objecttarget
- The destination object
-
applyChanges
protected void applyChanges(ChangeDetail detail, Trackable target, boolean reverse, boolean addDetail, boolean validateDetailVersion, String explicitVersion) Apply aChangeDetail
to a promotion target entity- 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()
)
-
setAuditUtility
-