Class PromotionWorkflowRequestErrorHandler

java.lang.Object
com.broadleafcommerce.sandbox.messaging.completion.error.PromotionWorkflowRequestErrorHandler
All Implemented Interfaces:
WorkflowRequestErrorHandler

public class PromotionWorkflowRequestErrorHandler extends Object implements WorkflowRequestErrorHandler
Author:
Chad Harchar (charchar)
  • Constructor Details

  • Method Details

    • canHandle

      public boolean canHandle(@NonNull @NonNull @NonNull com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion)
      Description copied from interface: WorkflowRequestErrorHandler
      Determines if this handler can handle the given WorkflowRequestCompletion. This is typically done by checking the WorkflowRequestCompletion.getRequestType().
      Specified by:
      canHandle in interface WorkflowRequestErrorHandler
      Parameters:
      completion - a WorkflowRequestCompletion received over the WorkflowRequestCompletionConsumer channel or manually from TransitionErrorEndpoint
      Returns:
      whether this handler can handle errors for the given WorkflowRequestCompletion
    • handle

      public void handle(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion, String groupId)
      Records errors reported by the WorkflowRequestCompletion that occurred while a microservice attempted to perform a promotion of a ChangeSummaryGroup or one of its ChangeSummaries and updates the group's and summary's statuses as ChangeStatusType.ERROR_PROMOTE
      Specified by:
      handle in interface WorkflowRequestErrorHandler
      Parameters:
      completion - The WorkflowRequestCompletion indicating the group and summary that encountered errors while being promoted
      groupId - The ID of the group gleaned from the completion message
      Throws:
      IllegalStateException - Thrown if the summary's ID is missing from the WorkflowRequestCompletion.getTransferTypeIdMap().
      QualifiedStateException - Thrown if either the group or summary encounters errors while being updated.
    • recordSummaryErrors

      protected void recordSummaryErrors(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion)
      Records the exception encountered for a failed promotion onto the ChangeSummary indicated by the WorkflowRequestCompletion and updates its status to ChangeStatusType.ERROR_PROMOTE
      Parameters:
      completion - The WorkflowRequestCompletion indicating the summary that encountered errors while being promoted
      Throws:
      QualifiedStateException - Thrown if the summary encounters errors while being updated.
    • recordGroupErrors

      protected void recordGroupErrors(String groupId, com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion)
      Records the exception encountered for a failed promotion onto the ChangeSummaryGroup indicated by the WorkflowRequestCompletion and updates its status to ChangeStatusType.ERROR_PROMOTE.
      Parameters:
      groupId -
      completion - The WorkflowRequestCompletion indicating the group that encountered errors while being promoted
      Throws:
      QualifiedStateException - Thrown if the group encounters errors while being updated.
    • getSummaryService

      protected ChangeSummaryService<ChangeSummary> getSummaryService()
    • getGroupService

      protected ChangeSummaryGroupService<ChangeSummaryGroup> getGroupService()