Class DefaultFulfillmentOperationService
- All Implemented Interfaces:
FulfillmentOperationService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultFulfillmentOperationService(FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillmentProvider, FulfillmentStatusChangeValidator fulfillmentStatusChangeValidator, List<FulfillmentStatusChangeHandler> fulfillmentStatusChangeHandlers) -
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.order.client.domain.OrderFulfillmentchangeFulfillmentStatus(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 ofOrderFulfillmentItemsbased 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 ofOrderFulfillmentItemswhose status is being changed.protected FulfillmentProvider<com.broadleafcommerce.order.client.domain.OrderFulfillment>protected List<FulfillmentStatusChangeHandler>protected FulfillmentStatusChangeValidatorprotected OrderOperationServiceOfferUtilsprotected 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 ofOfferItemDetailsrepresenting 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 ofOrderFulfillmentItemsthat are offer targets, and whose status should automatically be changed along with their qualifier items.protected intgetTargetItemQuantityToChangeStatus(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 voidprocessStatusChangeForOfferTargetItems(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 voidprocessTargetItemToChangeStatus(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 toquantityByItemIdfor status change based on its qualifier details.voidsetOfferUtils(OrderOperationServiceOfferUtils offerUtils) voidsetOrderProvider(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:FulfillmentOperationServicePerform the requested status change for theOrderFulfillment.- Specified by:
changeFulfillmentStatusin 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 toquantityByItemIdfor status change based on its qualifier details.- Parameters:
targetItem- theOrderFulfillmentItemthat is an offer target itemitemsChangingStatus- a list ofOrderFulfillmentItemswhose status are being changedorderItemById- a map ofOrderItembyOrderItem.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 ofOrderFulfillmentItemsthat 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- theOrderFulfillmentto get the offer target items fromorder- theOrderto get the correspondingOrderItemfrom- Returns:
- a list of
OrderFulfillmentItemsthat 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 ofOfferItemDetailsrepresenting qualifier details for the givenOrderFulfillmentItem.The
OrderFulfillmentItemitself can have qualifier details pointing to otherOrderFulfillmentItems, but only the qualifier details for the correspondingOrderItemis obtained by default.- Parameters:
item- theOrderFulfillmentItemto get the qualifier details fromorderItemById- a map ofOrderItembyOrderItem.getId()- Returns:
- a list of
OfferItemDetailsrepresenting 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 ofOrderFulfillmentItemsbased on the givenOrderFulfillmentItem.getOrderItemId().Note that there can be many
OrderFulfillmentItemsthat have the sameOrderFulfillmentItem.getOrderItemId(), since they can be split.- Parameters:
fulfillmentItems- theOrderFulfillmentItemsto find the items fromorderItemId- theOrderFulfillmentItem.getOrderItemId()to filter by- Returns:
- a list of
OrderFulfillmentItemsbased 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 ofOrderFulfillmentItemswhose status is being changed.- Parameters:
orderFulfillment- theOrderFulfillmentto find the itemsfromquantityByItemId- a map of quantity having a status change byOrderFulfillmentItem.getId()- Returns:
- a list of
OrderFulfillmentItemswhose 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- theOrderFulfillmentItemthat is the qualifiertargetItem- the targetOrderFulfillmentItemto calculate the quantity forqualifierDetail- theOfferItemDetailrepresenting the qualifier detailsorderItemById- a map ofOrderItembyOrderItem.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)
-