public class DefaultWorkflowMapper extends Object implements WorkflowMapper
Constructor and Description |
---|
DefaultWorkflowMapper(com.broadleafcommerce.common.extension.TypeFactory factory,
TrackableBehaviorUtil behaviorUtil,
List<ChangeTransformer> changeTransformers,
org.modelmapper.ModelMapper cloneMapper) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyChanges(ChangeDetail detail,
Trackable target,
boolean reverse,
boolean addDetail,
boolean validateDetailVersion,
String explicitVersion)
Apply a
ChangeDetail to a promotion target entity |
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.
|
protected void |
deployDelete(Trackable original,
Trackable target)
Handle the advancement of a delete change from a starting object to a target object.
|
ForwardMapResponse |
deployMap(Trackable original,
Trackable target,
WorkflowDeployRequest request,
String propagationId)
Transfer state (via
ChangeDetail 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.
|
ForwardMapResponse |
promoteMap(Trackable original,
Trackable target,
WorkflowPromoteRequest request)
Transfer state (via
ChangeDetail between an original item and a target item. |
Trackable |
propagateMap(Trackable original,
Trackable target,
boolean delete,
String propagationId)
Transfer state (via
ChangeDetail between an original item and a target item belonging
to a parent Catalog and a child Catalog, respectively. |
Trackable |
rebaseMap(Trackable original,
Trackable target,
WorkflowRebaseRequest request)
Update an original item with
ChangeDetail state from a target that is missing in the
original. |
RejectMapResponse |
rejectMap(Trackable original,
Trackable target,
WorkflowRejectRequest request)
Transfer state (via
ChangeDetail between a promoted sandbox state item to a new user
state item. |
Trackable |
revertMap(Trackable original,
WorkflowRevertRequest request)
Update an original
TrackingLevel.USER level record to represent a reverted state. |
void |
setAuditUtility(BasicAuditUtility auditUtility) |
public DefaultWorkflowMapper(com.broadleafcommerce.common.extension.TypeFactory factory, TrackableBehaviorUtil behaviorUtil, List<ChangeTransformer> changeTransformers, org.modelmapper.ModelMapper cloneMapper)
public Trackable rebaseMap(Trackable original, Trackable target, WorkflowRebaseRequest request)
WorkflowMapper
ChangeDetail
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).rebaseMap
in interface WorkflowMapper
original
- The less advanced item that is missing changestarget
- The more advanced item that contains changes not already in the originalrequest
- The specific rebase requestpublic ForwardMapResponse promoteMap(Trackable original, Trackable target, WorkflowPromoteRequest request)
WorkflowMapper
ChangeDetail
between an original item and a target item. If the
target is null (as is the case with OperationType.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.promoteMap
in interface WorkflowMapper
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 statepublic ForwardMapResponse deployMap(Trackable original, Trackable target, WorkflowDeployRequest request, String propagationId)
WorkflowMapper
ChangeDetail
between an original item and the target production
state. If the target is null (as is the case with OperationType.CREATE
original
items), a clone of the original is created whose target level status is set to
TrackingLevel.PRODUCTION
.deployMap
in interface WorkflowMapper
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 specific ChangeDetail
instances created
during the deploy as viable for propagation.public RejectMapResponse rejectMap(Trackable original, Trackable target, WorkflowRejectRequest request)
WorkflowMapper
ChangeDetail
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.rejectMap
in interface WorkflowMapper
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 requestpublic Trackable revertMap(Trackable original, WorkflowRevertRequest request)
WorkflowMapper
TrackingLevel.USER
level record to represent a reverted state.
This usually involves setting archive values to represent the item is no longer active.revertMap
in interface WorkflowMapper
original
- The item that is being deactivatedrequest
- The specific revert requestpublic Trackable propagateMap(Trackable original, Trackable target, boolean delete, String propagationId)
WorkflowMapper
ChangeDetail
between an original item and a target item belonging
to a parent Catalog
and a child Catalog, respectively. Propagation should pay
attention to FieldOverride
in Tracking.getFieldOverrides()
and ignore
colliding ChangeDetails.propagateMap
in interface WorkflowMapper
original
- The item containing the changes to transfertarget
- The item receiving the changesdelete
- Whether or not the propagation change is a OperationType.DELETE
propagationId
- Demarcates one or more specific ChangeDetail
instances created
during the deploy as viable for propagation. Should be the same value passed to
WorkflowMapper.deployMap(Trackable, Trackable, WorkflowDeployRequest, String)
.protected void promoteChange(Trackable original, Trackable target, String promotionId)
original
- The starting objecttarget
- The destination objectpromotionId
- The promotion id to match changes onprotected void deployChange(Trackable original, Trackable target, String propagationId, String version)
original
- The starting objecttarget
- The destination objectpropagationId
- Id used to track changes during a catalog propagationversion
- the change version to advanceprotected void promoteDelete(Trackable original, Trackable target, String promotionId)
original
- The starting objecttarget
- The destination objectpromotionId
- The promotion id to match changes onprotected void deployDelete(Trackable original, Trackable target)
original
- The starting objecttarget
- The destination objectprotected void applyChanges(ChangeDetail detail, Trackable target, boolean reverse, boolean addDetail, boolean validateDetailVersion, String explicitVersion)
ChangeDetail
to a promotion target entitydetail
- 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 (see
ChangeDetail.getVersion()
)@Autowired public void setAuditUtility(@Nullable BasicAuditUtility auditUtility)
Copyright © 2021. All rights reserved.