Class RejectionWorkflowRequestErrorHandler

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

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

  • Method Details

    • canHandle

      public boolean canHandle(@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 rejection of a ChangeSummaryGroup or one of its ChangeSummaries and updates the group's and summary's statuses as ChangeStatusType.ERROR_REJECT
      Specified by:
      handle in interface WorkflowRequestErrorHandler
      Parameters:
      completion - The WorkflowRequestCompletion indicating the group and summary that encountered errors while being rejected
      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.
    • recordSummaryRejectionError

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

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

      protected ChangeSummaryService<ChangeSummary> getSummaryService()
    • getGroupService

      protected ChangeSummaryGroupService<ChangeSummaryGroup> getGroupService()