Class WorkflowTransitionHelper

    • Constructor Detail

      • WorkflowTransitionHelper

        public WorkflowTransitionHelper​(TrackableRepository<Trackable> repository,
                                        WorkflowMapper mapper,
                                        CommonCatalogService<Catalog> catalogService,
                                        com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?,​?> resourceLockRepository,
                                        com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager,
                                        WorkflowRequestCompletionNotifier completionNotifier,
                                        com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService,
                                        com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper helper)
      • WorkflowTransitionHelper

        public WorkflowTransitionHelper​(TrackableRepository<Trackable> repository,
                                        WorkflowMapper mapper,
                                        com.broadleafcommerce.common.messaging.repository.ResourceLockRepository<?,​?> resourceLockRepository,
                                        com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager,
                                        WorkflowRequestCompletionNotifier completionNotifier,
                                        com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService,
                                        com.broadleafcommerce.common.messaging.notification.MessageSerializationHelper helper)
    • Method Detail

      • withTypeFactory

        public WorkflowTransitionHelper withTypeFactory​(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
      • updatePersistenceState

        protected void updatePersistenceState​(Trackable trackable)
        Setup the initial NotificationState on a Trackable entity in regard to the sending status of the PersistenceProducer.TYPE message for a persistence event.
        Parameters:
        trackable - Trackable the entity which experienced a persistence event
      • notifyOfPersistence

        protected void notifyOfPersistence​(Trackable domain)
        Inform the system via a message of type PersistenceProducer.TYPE that an entity has been persisted.
        Parameters:
        domain - the entity that was persisted
      • rebase

        @SuppressNotification("SINGLE_INDEX_REQUEST")
        public void rebase​(WorkflowRebaseRequest request)
        Description copied from interface: WorkflowTransitionService
        Perform the rebase, bringing an original item up-to-date with missing changes from the target that were created by another user. If the original has conflicting changes, those changes win.
        Specified by:
        rebase in interface WorkflowTransitionService
        Parameters:
        request - Perform the rebase, bringing an original item up-to-date with missing changes
      • notifyOfCompletion

        protected void notifyOfCompletion​(Trackable domain)
        Inform the system via a message of type WorkflowRequestCompletionProducer.TYPE that transition processing is complete.
        Parameters:
        domain - The entity that was transitioned
      • updateCompletionState

        protected void updateCompletionState​(Trackable originalTrackable,
                                             Tracking advancedTracking,
                                             TransitionRequest transitionRequest,
                                             boolean success,
                                             @Nullable
                                             Exception e)

        Setup the initial NotificationState on a Trackable entity in regard to the sending status of the WorkflowRequestCompletionProducer.TYPE message for transition completion.

        NotificationStates are ack'ed on the originalTracking.

        Parameters:
        originalTrackable - The original item that was promoted in. This receives NotificationStates
        advancedTracking - the most updated Tracking available. In the case of a promotion, this represents the promoted state. In the case of rebases, this is the same as originalTracking. Can be null if not available (like in a revert)
        transitionRequest - The initial request driving the transition
        success - Whether or not the transition was successful (or failed with an error)
        e - The exception that caused a failed transition, if applicable
      • handleTransitionFailure

        protected void handleTransitionFailure​(TransitionRequest request,
                                               Trackable original,
                                               Exception e)
        Handle failure of a transition request and notify the messaging system of the failure
        Parameters:
        request - The transition request
        original - The entity targeted for transition
        e - The exception that occurred during the transition
      • applyReject

        protected void applyReject​(WorkflowRejectRequest request,
                                   Trackable target,
                                   Trackable original)
        Apply one or more changes related to a promotion from an "original" entity to a target user sandbox entity (if any). In the case of no target, then clone and update the original to establish target state.
        Parameters:
        request - The request for a Trackable entity rejection
        target - any available pre-existing target state
        original - The entity containing changes to reject
      • applyPromotion

        protected void applyPromotion​(WorkflowPromoteRequest request,
                                      Trackable target,
                                      Trackable original)
        Apply changes from an "original" entity to a target sandbox entity (if any). In the case of no target (i.e. create flow), then clone and update the original to establish target state.

        Will emit PersistenceProducer.TYPE and WorkflowRequestCompletionProducer.TYPE messages after performing changes.

        Parameters:
        request - The request for a Trackable entity promotion
        target - any available pre-existing target state
        original - The entity containing changes to promote
      • applyDeployment

        protected void applyDeployment​(WorkflowDeployRequest request,
                                       Trackable target,
                                       Trackable original)
        Apply changes from an "original" entity to a target production entity (if any). In the case of no target (i.e. create flow), then clone and update the original to establish target state.

        Will emit PersistenceProducer.TYPE and WorkflowRequestCompletionProducer.TYPE messages after performing changes.

        Parameters:
        request - The request for a Trackable entity deployment
        target - any available pre-existing target state
        original - The entity to deploy
      • evaluateForTemporaryOverride

        protected TempOverrideMapResponse evaluateForTemporaryOverride​(WorkflowDeployRequest request,
                                                                       Trackable target,
                                                                       Trackable original)
        In the case where a change was propagated after deployment via VendorSandboxPropagationHandler, temporary override state for an application can be created. During subsequent deployment of that propagated application state, it is necessary to cleanup any temporary state that was introduced by VendorSandboxPropagationHandler. This method checks the request (specifically, WorkflowDeployRequest.isRemoveTemporaryOverride(), and also evaluates entity state to make a final determination via TempOverrideMapResponse.
        Parameters:
        request - The deployment request
        target - The state receiving deployment, if applicable
        original - The state being transitioned from earlier promoted status
        Returns:
        The evaluation results
      • propagate

        protected void propagate​(Trackable deployed,
                                 String parentCatalog,
                                 OperationType changeType,
                                 String propagationId)
        Given a deployed catalog discriminated change, recurse through versions of the entity in child catalogs and transfer the deployed changes using the process defined implementations of PropagationHandler. PropagationHandler instances are registered with Spring and ordered. The first instance capable of handling is used and others are ignored. This process is controlled by the PropagationManager.
        Parameters:
        deployed - The deployed item containing changes to propagate
        parentCatalog - The catalog whose children will be checked for propagation items
        changeType - The type of operation to be propagated (CREATE,UPDATE,DELETE)
        propagationId - An id that identifies changes as part of this propagation. See ChangeDetail.getPropagationId().
      • handleRecordFailure

        protected boolean handleRecordFailure​(TransitionRequest request,
                                              Exception e)
        Handle failure to find the target record for the transition
        Parameters:
        request - The transition request
        e - The exception that occurred during the fetch
        Returns:
        Whether or not the message was successfully sent to the broker