Class DefaultFulfillmentOperationService
- All Implemented Interfaces:
FulfillmentOperationService
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentOperationService
(FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillmentProvider, FulfillmentStatusChangeValidator fulfillmentStatusChangeValidator, List<FulfillmentStatusChangeHandler> fulfillmentStatusChangeHandlers) -
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.order.client.domain.OrderFulfillment
changeFulfillmentStatus
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform the requested status change for theOrderFulfillment
.protected List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
getFulfillmentItemsByOrderItemId
(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> fulfillmentItems, String orderItemId) Gets a list ofOrderFulfillmentItems
based on the givenOrderFulfillmentItem.getOrderItemId()
.protected List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
getFulfillmentItemsChangingStatus
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, Map<String, Integer> quantityByItemId) Gets a list ofOrderFulfillmentItems
whose status is being changed.protected FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment>
protected List<FulfillmentStatusChangeHandler>
protected FulfillmentStatusChangeValidator
protected OrderOperationServiceOfferUtils
protected OrderProvider<com.broadleafcommerce.order.client.domain.Order>
protected List<com.broadleafcommerce.order.common.domain.OfferItemDetail>
getQualifierDetails
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem item, Map<String, com.broadleafcommerce.order.client.domain.OrderItem> orderItemById) Gets a list ofOfferItemDetails
representing qualifier details for the givenOrderFulfillmentItem
.protected List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
getStatusChangeableTargetItems
(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.order.client.domain.Order order) Gets a list ofOrderFulfillmentItems
that are offer targets, and whose status should automatically be changed along with their qualifier items.protected int
getTargetItemQuantityToChangeStatus
(Map<String, Integer> quantityByItemId, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem qualifierItem, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem targetItem, com.broadleafcommerce.order.common.domain.OfferItemDetail qualifierDetail, Map<String, com.broadleafcommerce.order.client.domain.OrderItem> orderItemById) Calculates and returns the quantity of the target item to change status along with its qualifier.protected void
processStatusChangeForOfferTargetItems
(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, com.broadleafcommerce.order.client.domain.Order order) Makes sure that whenever an offer qualifier item's status is being changed, the offer target item is being changed as well based on its qualifier details.protected void
processTargetItemToChangeStatus
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem targetItem, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> itemsChangingStatus, Map<String, com.broadleafcommerce.order.client.domain.OrderItem> orderItemById, Map<String, Integer> quantityByItemId) Adds the given target item toquantityByItemId
for status change based on its qualifier details.void
setOfferUtils
(OrderOperationServiceOfferUtils offerUtils) void
setOrderProvider
(OrderProvider<com.broadleafcommerce.order.client.domain.Order> orderProvider)
-
Constructor Details
-
DefaultFulfillmentOperationService
public DefaultFulfillmentOperationService(FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillmentProvider, FulfillmentStatusChangeValidator fulfillmentStatusChangeValidator, List<FulfillmentStatusChangeHandler> fulfillmentStatusChangeHandlers)
-
-
Method Details
-
changeFulfillmentStatus
@Nullable public com.broadleafcommerce.order.client.domain.OrderFulfillment changeFulfillmentStatus(FulfillmentStatusChangeRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOperationService
Perform the requested status change for theOrderFulfillment
.- Specified by:
changeFulfillmentStatus
in interfaceFulfillmentOperationService
- Parameters:
request
- the request to change the status of the fulfillmentcontextInfo
- context information around sandbox and multitenant state.- Returns:
- the fulfillment, or part of it, which has changed status
-
processStatusChangeForOfferTargetItems
protected void processStatusChangeForOfferTargetItems(FulfillmentStatusChangeRequest request, com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, com.broadleafcommerce.order.client.domain.Order order) Makes sure that whenever an offer qualifier item's status is being changed, the offer target item is being changed as well based on its qualifier details.For example, itemA is a free gift offer qualifier item, and itemFG is the target item that was added from the offer. Whenever the status of itemA is being changed, itemFG will automatically be added to the given
FulfillmentStatusChangeRequest
.By default, only the status of free gift items are automatically changed along with their qualifiers.
- Parameters:
request
- the request to change the status of the fulfillmentorderFulfillment
- the order fulfillment that the status is being changed
-
processTargetItemToChangeStatus
protected void processTargetItemToChangeStatus(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem targetItem, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> itemsChangingStatus, Map<String, com.broadleafcommerce.order.client.domain.OrderItem> orderItemById, Map<String, Integer> quantityByItemId) Adds the given target item toquantityByItemId
for status change based on its qualifier details.- Parameters:
targetItem
- theOrderFulfillmentItem
that is an offer target itemitemsChangingStatus
- a list ofOrderFulfillmentItems
whose status are being changedorderItemById
- a map ofOrderItem
byOrderItem.getId()
quantityByItemId
- a map of quantity having a status change byOrderFulfillmentItem.getId()
-
getStatusChangeableTargetItems
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> getStatusChangeableTargetItems(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.order.client.domain.Order order) Gets a list ofOrderFulfillmentItems
that are offer targets, and whose status should automatically be changed along with their qualifier items.By default, only free gift items will automatically change status along with their qualifier items.
- Parameters:
fulfillment
- theOrderFulfillment
to get the offer target items fromorder
- theOrder
to get the correspondingOrderItem
from- Returns:
- a list of
OrderFulfillmentItems
that are offer targets, and whose status should automatically be changed along with their qualifier items
-
getQualifierDetails
protected List<com.broadleafcommerce.order.common.domain.OfferItemDetail> getQualifierDetails(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem item, Map<String, com.broadleafcommerce.order.client.domain.OrderItem> orderItemById) Gets a list ofOfferItemDetails
representing qualifier details for the givenOrderFulfillmentItem
.The
OrderFulfillmentItem
itself can have qualifier details pointing to otherOrderFulfillmentItems
, but only the qualifier details for the correspondingOrderItem
is obtained by default.- Parameters:
item
- theOrderFulfillmentItem
to get the qualifier details fromorderItemById
- a map ofOrderItem
byOrderItem.getId()
- Returns:
- a list of
OfferItemDetails
representing qualifier details for the givenOrderFulfillmentItem
-
getFulfillmentItemsByOrderItemId
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> getFulfillmentItemsByOrderItemId(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> fulfillmentItems, String orderItemId) Gets a list ofOrderFulfillmentItems
based on the givenOrderFulfillmentItem.getOrderItemId()
.Note that there can be many
OrderFulfillmentItems
that have the sameOrderFulfillmentItem.getOrderItemId()
, since they can be split.- Parameters:
fulfillmentItems
- theOrderFulfillmentItems
to find the items fromorderItemId
- theOrderFulfillmentItem.getOrderItemId()
to filter by- Returns:
- a list of
OrderFulfillmentItems
based on the givenOrderFulfillmentItem.getOrderItemId()
-
getFulfillmentItemsChangingStatus
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> getFulfillmentItemsChangingStatus(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, Map<String, Integer> quantityByItemId) Gets a list ofOrderFulfillmentItems
whose status is being changed.- Parameters:
orderFulfillment
- theOrderFulfillment
to find the itemsfromquantityByItemId
- a map of quantity having a status change byOrderFulfillmentItem.getId()
- Returns:
- a list of
OrderFulfillmentItems
whose status is being changed
-
getTargetItemQuantityToChangeStatus
protected int getTargetItemQuantityToChangeStatus(Map<String, Integer> quantityByItemId, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem qualifierItem, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem targetItem, com.broadleafcommerce.order.common.domain.OfferItemDetail qualifierDetail, Map<String, com.broadleafcommerce.order.client.domain.OrderItem> orderItemById) Calculates and returns the quantity of the target item to change status along with its qualifier.Additionally, if the qualifier and target are the same item, then we'll add the quantity to confirm on top of the quantity already having a status change.
- Parameters:
quantityByItemId
- a map of quantity having a status change byOrderFulfillmentItem.getId()
qualifierItem
- theOrderFulfillmentItem
that is the qualifiertargetItem
- the targetOrderFulfillmentItem
to calculate the quantity forqualifierDetail
- theOfferItemDetail
representing the qualifier detailsorderItemById
- a map ofOrderItem
byOrderItem.getId()
- Returns:
- the quantity of the target item to change status
-
getFulfillmentProvider
protected FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> getFulfillmentProvider() -
getFulfillmentStatusChangeValidator
-
getFulfillmentStatusChangeHandlers
-
getOfferUtils
-
setOfferUtils
-
getOrderProvider
-
setOrderProvider
@Autowired public void setOrderProvider(OrderProvider<com.broadleafcommerce.order.client.domain.Order> orderProvider)
-