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 TypeMethodDescriptionbooleancanHandle(@NonNull com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Determines if this handler can handle the givenWorkflowRequestCompletion.protected ChangeSummaryGroupService<ChangeSummaryGroup>protected ChangeSummaryService<ChangeSummary>voidhandle(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion, String groupId) Records errors reported by theWorkflowRequestCompletionthat occurred while a microservice attempted to perform a promotion of aChangeSummaryGroupor one of itsChangeSummariesand updates the group's and summary's statuses asChangeStatusType.ERROR_PROMOTEprotected voidrecordGroupErrors(String groupId, com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Records the exception encountered for a failed promotion onto theChangeSummaryGroupindicated by theWorkflowRequestCompletionand updates its status toChangeStatusType.ERROR_PROMOTE.protected voidrecordSummaryErrors(com.broadleafcommerce.data.tracking.core.transition.WorkflowRequestCompletion completion) Records the exception encountered for a failed promotion onto theChangeSummaryindicated by theWorkflowRequestCompletionand 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:WorkflowRequestErrorHandlerDetermines if this handler can handle the givenWorkflowRequestCompletion. This is typically done by checking theWorkflowRequestCompletion.getRequestType().- Specified by:
canHandlein interfaceWorkflowRequestErrorHandler- Parameters:
completion- aWorkflowRequestCompletionreceived over theWorkflowRequestCompletionConsumer channelor 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 theWorkflowRequestCompletionthat occurred while a microservice attempted to perform a promotion of aChangeSummaryGroupor one of itsChangeSummariesand updates the group's and summary's statuses asChangeStatusType.ERROR_PROMOTE- Specified by:
handlein interfaceWorkflowRequestErrorHandler- Parameters:
completion- TheWorkflowRequestCompletionindicating 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 theChangeSummaryindicated by theWorkflowRequestCompletionand updates its status toChangeStatusType.ERROR_PROMOTE- Parameters:
completion- TheWorkflowRequestCompletionindicating 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 theChangeSummaryGroupindicated by theWorkflowRequestCompletionand updates its status toChangeStatusType.ERROR_PROMOTE.- Parameters:
groupId-completion- TheWorkflowRequestCompletionindicating the group that encountered errors while being promoted- Throws:
QualifiedStateException- Thrown if the group encounters errors while being updated.
-
getSummaryService
-
getGroupService
-