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 Summary
ConstructorsConstructorDescriptionPromotionWorkflowRequestErrorHandler
(ChangeSummaryService<ChangeSummary> summaryService, ChangeSummaryGroupService<ChangeSummaryGroup> groupService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canHandle
(@NonNull com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Determines if this handler can handle the givenWorkflowRequestCompletion
.protected ChangeSummaryGroupService<ChangeSummaryGroup>
protected ChangeSummaryService<ChangeSummary>
void
handle
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion, String groupId) Records errors reported by theWorkflowRequestCompletion
that occurred while a microservice attempted to perform a promotion of aChangeSummaryGroup
or one of itsChangeSummaries
and updates the group's and summary's statuses asChangeStatusType.ERROR_PROMOTE
protected void
recordGroupErrors
(String groupId, com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Records the exception encountered for a failed promotion onto theChangeSummaryGroup
indicated by theWorkflowRequestCompletion
and updates its status toChangeStatusType.ERROR_PROMOTE
.protected void
recordSummaryErrors
(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Records the exception encountered for a failed promotion onto theChangeSummary
indicated by theWorkflowRequestCompletion
and updates its status toChangeStatusType.ERROR_PROMOTE
-
Constructor Details
-
PromotionWorkflowRequestErrorHandler
public PromotionWorkflowRequestErrorHandler(ChangeSummaryService<ChangeSummary> summaryService, ChangeSummaryGroupService<ChangeSummaryGroup> groupService)
-
-
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 givenWorkflowRequestCompletion
. This is typically done by checking theWorkflowRequestCompletion.getRequestType()
.- Specified by:
canHandle
in interfaceWorkflowRequestErrorHandler
- Parameters:
completion
- aWorkflowRequestCompletion
received over theWorkflowRequestCompletionConsumer channel
or manually fromTransitionErrorEndpoint
- 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 theWorkflowRequestCompletion
that occurred while a microservice attempted to perform a promotion of aChangeSummaryGroup
or one of itsChangeSummaries
and updates the group's and summary's statuses asChangeStatusType.ERROR_PROMOTE
- Specified by:
handle
in interfaceWorkflowRequestErrorHandler
- Parameters:
completion
- TheWorkflowRequestCompletion
indicating the group and summary that encountered errors while being promotedgroupId
- The ID of the group gleaned from the completion message- Throws:
IllegalStateException
- Thrown if the summary's ID is missing from theWorkflowRequestCompletion.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 theChangeSummary
indicated by theWorkflowRequestCompletion
and updates its status toChangeStatusType.ERROR_PROMOTE
- Parameters:
completion
- TheWorkflowRequestCompletion
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 theChangeSummaryGroup
indicated by theWorkflowRequestCompletion
and updates its status toChangeStatusType.ERROR_PROMOTE
.- Parameters:
groupId
-completion
- TheWorkflowRequestCompletion
indicating the group that encountered errors while being promoted- Throws:
QualifiedStateException
- Thrown if the group encounters errors while being updated.
-
getSummaryService
-
getGroupService
-