Class AbstractFulfillmentStatusChangeHandler
java.lang.Object
com.broadleafcommerce.orderoperation.service.handler.AbstractFulfillmentStatusChangeHandler
- All Implemented Interfaces:
FulfillmentStatusChangeHandler
- Direct Known Subclasses:
CancelStatusChangeHandler
,CaptureAwaitingResultPaymentStatusChangeHandler
,CapturingPaymentStatusChangeHandler
,FulfilledStatusChangeHandler
,FulfillFailedStatusChangeHandler
,FulfillingStatusChangeHandler
,PaymentCapturedStatusChangeHandler
,PaymentCaptureFailedStatusChangeHandler
public abstract class AbstractFulfillmentStatusChangeHandler
extends Object
implements FulfillmentStatusChangeHandler
-
Constructor Summary
ConstructorDescriptionAbstractFulfillmentStatusChangeHandler
(FulfillmentSplittingService<com.broadleafcommerce.order.client.domain.OrderFulfillment> splittingService, FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillmentProvider, OrderProvider<com.broadleafcommerce.order.client.domain.Order> orderProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAdditionalOrderFulfillmentFields
(com.broadleafcommerce.order.client.domain.OrderFulfillment newOrderFulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling before replacing the single fulfillment order.protected void
addAdditionalOrderFulfillmentFields
(com.broadleafcommerce.order.client.domain.OrderFulfillment newOrderFulfillment, com.broadleafcommerce.order.client.domain.OrderFulfillment leftoverOrderFulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling before replacing the fulfillment order.boolean
canHandle
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) Determine if this handler can process the givenFulfillmentStatusChangeRequest
.protected com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender
protected FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment>
protected com.broadleafcommerce.order.client.domain.OrderFulfillment
getFulfillmentWithChangedStatus
(FulfillmentStatusChangeRequest request, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Retrieve the fulfillment which changed status.protected OrderProvider<com.broadleafcommerce.order.client.domain.Order>
protected OrderOperationProviderProperties
protected FulfillmentSplittingService<com.broadleafcommerce.order.client.domain.OrderFulfillment>
protected com.broadleafcommerce.common.extension.TypeFactory
protected abstract String
protected com.broadleafcommerce.order.client.domain.OrderFulfillment
postProcessStatusChange
(FulfillmentStatusChangeRequest request, String originalStatus, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling after the fulfillment has changed status.com.broadleafcommerce.order.client.domain.OrderFulfillment
process
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform the status change requested by theFulfillmentStatusChangeRequest
.protected com.broadleafcommerce.order.client.domain.OrderFulfillment
processSingleFulfillment
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Process the status change for an entire single fulfillment without splitting.protected List<com.broadleafcommerce.order.client.domain.OrderFulfillment>
processSplitFulfillments
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment leftoverFulfillment, com.broadleafcommerce.order.client.domain.OrderFulfillment newFulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Process the status change for fulfillments which were split.protected boolean
requestingCompleteFulfillment
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) Check if therequest
is requesting all of the items in the fulfillment.protected void
sendFulfillmentStatusChangeEvent
(org.springframework.messaging.MessageChannel channel, FulfillmentStatusChangeRequest request, String originalStatus, com.broadleafcommerce.order.client.domain.OrderFulfillment changed, com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds aFulfillmentStatusChangeEvent
for the status change which occurred.void
setDetachedDurableMessageSender
(com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender detachedDurableMessageSender) void
setProperties
(OrderOperationProviderProperties properties)
-
Constructor Details
-
AbstractFulfillmentStatusChangeHandler
public AbstractFulfillmentStatusChangeHandler(FulfillmentSplittingService<com.broadleafcommerce.order.client.domain.OrderFulfillment> splittingService, FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillmentProvider, OrderProvider<com.broadleafcommerce.order.client.domain.Order> orderProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
canHandle
public boolean canHandle(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) Description copied from interface:FulfillmentStatusChangeHandler
Determine if this handler can process the givenFulfillmentStatusChangeRequest
.- Specified by:
canHandle
in interfaceFulfillmentStatusChangeHandler
- Parameters:
request
- the status change requestfulfillment
- the fulfillment to have its status changed- Returns:
- whether this handler can process the status change request
-
getValidTargetStatus
-
getValidOriginatingStatuses
-
process
public com.broadleafcommerce.order.client.domain.OrderFulfillment process(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentStatusChangeHandler
Perform the status change requested by theFulfillmentStatusChangeRequest
.- Specified by:
process
in interfaceFulfillmentStatusChangeHandler
- Parameters:
request
- the status change requestfulfillment
- the fulfillment to have its status changedcontextInfo
- context information around sandbox and multitenant state- Returns:
- the fulfillment, or part of it, which has changed status
-
requestingCompleteFulfillment
protected boolean requestingCompleteFulfillment(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) Check if therequest
is requesting all of the items in the fulfillment.- Parameters:
request
- the status change requestfulfillment
- the fulfillment to have its status changed- Returns:
- whether all of the items in the fulfillment are being requested
-
processSingleFulfillment
protected com.broadleafcommerce.order.client.domain.OrderFulfillment processSingleFulfillment(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Process the status change for an entire single fulfillment without splitting.- Parameters:
request
- the status change requestfulfillment
- the fulfillment to have its status changedcontextInfo
- context information around sandbox and multitenant state.- Returns:
- the fulfillment with its state changed
-
processSplitFulfillments
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillment> processSplitFulfillments(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment leftoverFulfillment, com.broadleafcommerce.order.client.domain.OrderFulfillment newFulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Process the status change for fulfillments which were split.- Parameters:
request
- the status change requestleftoverFulfillment
- the remaining fulfillment containing items not requestednewFulfillment
- a new fulfillment with changed statuscontextInfo
- context information around sandbox and multitenant state- Returns:
- all of the fulfillments updated or created
-
postProcessStatusChange
protected com.broadleafcommerce.order.client.domain.OrderFulfillment postProcessStatusChange(FulfillmentStatusChangeRequest request, String originalStatus, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling after the fulfillment has changed status.- Parameters:
request
- the status change requestoriginalStatus
- the original status of the fulfillment before status changefulfillments
- the fulfillments involved in the status changeorder
- the order which contains the fulfillmentscontextInfo
- context information around sandbox and multitenant state- Returns:
- the fulfillment which changed status
-
getFulfillmentWithChangedStatus
protected com.broadleafcommerce.order.client.domain.OrderFulfillment getFulfillmentWithChangedStatus(FulfillmentStatusChangeRequest request, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Retrieve the fulfillment which changed status.- Parameters:
request
- the status change requestfulfillments
- the fulfillments involved in the status change- Returns:
- the fulfillment which changed status
-
addAdditionalOrderFulfillmentFields
protected void addAdditionalOrderFulfillmentFields(com.broadleafcommerce.order.client.domain.OrderFulfillment newOrderFulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling before replacing the single fulfillment order.- Parameters:
newOrderFulfillment
- the new fulfillment to replace withcontextInfo
- context information around sandbox and multitenant state
-
addAdditionalOrderFulfillmentFields
protected void addAdditionalOrderFulfillmentFields(com.broadleafcommerce.order.client.domain.OrderFulfillment newOrderFulfillment, @Nullable com.broadleafcommerce.order.client.domain.OrderFulfillment leftoverOrderFulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling before replacing the fulfillment order.- Parameters:
newOrderFulfillment
- the new fulfillment to replace withleftoverOrderFulfillment
- the leftover fulfillment if split to replace withcontextInfo
- context information around sandbox and multitenant state
-
sendFulfillmentStatusChangeEvent
protected void sendFulfillmentStatusChangeEvent(org.springframework.messaging.MessageChannel channel, FulfillmentStatusChangeRequest request, String originalStatus, com.broadleafcommerce.order.client.domain.OrderFulfillment changed, com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds aFulfillmentStatusChangeEvent
for the status change which occurred. Used in manyFulfillmentStatusChangeHandlers
to create messages to notify of the status change.- Parameters:
request
- the request to change statusoriginalStatus
- the original status of the fulfillment before the status changechanged
- the fulfillment which had status changedorder
- the order to which the changed fulfillment belongscontextInfo
- context information around sandbox and multitenant state
-
getSplittingService
protected FulfillmentSplittingService<com.broadleafcommerce.order.client.domain.OrderFulfillment> getSplittingService() -
getFulfillmentProvider
protected FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> getFulfillmentProvider() -
getOrderProvider
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getDetachedDurableMessageSender
protected com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender getDetachedDurableMessageSender() -
setDetachedDurableMessageSender
@Autowired(required=false) public void setDetachedDurableMessageSender(com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender detachedDurableMessageSender) -
getProperties
-
setProperties
-