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 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 given FulfillmentStatusChangeRequest.
      Specified by:
      canHandle in interface FulfillmentStatusChangeHandler
      Parameters:
      request - the status change request
      fulfillment - the fulfillment to have its status changed
      Returns:
      whether this handler can process the status change request
    • getValidTargetStatus

      protected abstract String getValidTargetStatus()
    • getValidOriginatingStatuses

      protected abstract Set<String> 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 the FulfillmentStatusChangeRequest.
      Specified by:
      process in interface FulfillmentStatusChangeHandler
      Parameters:
      request - the status change request
      fulfillment - the fulfillment to have its status changed
      contextInfo - 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 the request is requesting all of the items in the fulfillment.
      Parameters:
      request - the status change request
      fulfillment - 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 request
      fulfillment - the fulfillment to have its status changed
      contextInfo - 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 request
      leftoverFulfillment - the remaining fulfillment containing items not requested
      newFulfillment - a new fulfillment with changed status
      contextInfo - 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 request
      originalStatus - the original status of the fulfillment before status change
      fulfillments - the fulfillments involved in the status change
      order - the order which contains the fulfillments
      contextInfo - 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 request
      fulfillments - 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 with
      contextInfo - 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 with
      leftoverOrderFulfillment - the leftover fulfillment if split to replace with
      contextInfo - 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 a FulfillmentStatusChangeEvent for the status change which occurred. Used in many FulfillmentStatusChangeHandlers to create messages to notify of the status change.
      Parameters:
      request - the request to change status
      originalStatus - the original status of the fulfillment before the status change
      changed - the fulfillment which had status changed
      order - the order to which the changed fulfillment belongs
      contextInfo - 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

      protected OrderProvider<com.broadleafcommerce.order.client.domain.Order> 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

      protected OrderOperationProviderProperties getProperties()
    • setProperties

      @Autowired public void setProperties(OrderOperationProviderProperties properties)