Class DefaultOrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>

java.lang.Object
com.broadleafcommerce.order.service.DefaultOrderFulfillmentItemService<P>
All Implemented Interfaces:
OrderFulfillmentItemService<P>

public class DefaultOrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> extends Object implements OrderFulfillmentItemService<P>
Author:
Nathan Moore (nathandmoore)
  • Constructor Details

    • DefaultOrderFulfillmentItemService

      public DefaultOrderFulfillmentItemService(OrderFulfillmentService<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillmentService, ReturnAuthorizationService<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returnAuthorizationService)
  • Method Details

    • readAllReturnableFulfillmentItemsForOrder

      public List<P> readAllReturnableFulfillmentItemsForOrder(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentItemService
      Returns a list of all OrderFulfillmentItems for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillments have a status of OrderFulfillmentStatus.FULFILLED and are not already in a return. This will also update the quantities on the items if any have been partially returned.
      Specified by:
      readAllReturnableFulfillmentItemsForOrder in interface OrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
      Parameters:
      orderId - ID of the parent Order
      contextInfo - Additional sandbox and tenant info
      Returns:
      Returns a list of all OrderFulfillmentItems for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillments have a status of OrderFulfillmentStatus.FULFILLED and are not already in a return.
    • readAllReturnableFulfillmentItemsForGroup

      public List<P> readAllReturnableFulfillmentItemsForGroup(String orderId, String orderFulfillmentId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentItemService
      Returns a list of all OrderFulfillmentItems in the specified OrderFulfillment for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillment has a status of OrderFulfillmentStatus.FULFILLED and are not already in a return. This will also update the quantities on the items if any have been partially returned.
      Specified by:
      readAllReturnableFulfillmentItemsForGroup in interface OrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
      Parameters:
      orderId - ID of the parent Order
      orderFulfillmentId - ID of the parent OrderFulfillment
      contextInfo - Additional sandbox and tenant info
      Returns:
      Returns a list of all OrderFulfillmentItems in the specified OrderFulfillment for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillment has a status of OrderFulfillmentStatus.FULFILLED and are not already in a return.
    • readAllReturnableFulfillmentItemsForOrderTenantContext

      public List<P> readAllReturnableFulfillmentItemsForOrderTenantContext(String orderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentItemService
      Returns a list of all OrderFulfillmentItems for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillments have a status of OrderFulfillmentStatus.FULFILLED and are not already in a return. This will also update the quantities on the items if any have been partially returned.

      Calls to services like ReturnAuthorizationService and OrderFulfillmentService differ from the standard narrowing behavior which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation involves all records within the tenant regardless of whether they're associated to an application.

      Specified by:
      readAllReturnableFulfillmentItemsForOrderTenantContext in interface OrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
      Parameters:
      orderId - ID of the parent Order
      contextInfo - Additional sandbox and tenant info
      Returns:
      Returns a list of all OrderFulfillmentItems for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillments have a status of OrderFulfillmentStatus.FULFILLED and are not already in a return, based on all records within the tenant.
    • readAllReturnableFulfillmentItemsForGroupTenantContext

      public List<P> readAllReturnableFulfillmentItemsForGroupTenantContext(String orderId, String orderFulfillmentId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderFulfillmentItemService
      Returns a list of all OrderFulfillmentItems in the specified OrderFulfillment for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillment has a status of OrderFulfillmentStatus.FULFILLED and are not already in a return. This will also update the quantities on the items if any have been partially returned.

      Calls to services like ReturnAuthorizationService and OrderFulfillmentService differ from the standard narrowing behavior which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation involves all records within the tenant regardless of whether they're associated to an application.

      Specified by:
      readAllReturnableFulfillmentItemsForGroupTenantContext in interface OrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
      Parameters:
      orderId - ID of the parent Order
      orderFulfillmentId - ID of the parent OrderFulfillment
      contextInfo - Additional sandbox and tenant info
      Returns:
      Returns a list of all OrderFulfillmentItems in the specified OrderFulfillment for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillment has a status of OrderFulfillmentStatus.FULFILLED and are not already in a return, based on all records within the tenant.
    • getItemsAlreadyInReturn

      protected Map<String,Integer> getItemsAlreadyInReturn(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned since it may be a partial return.
      Parameters:
      orderId - ID of the parent order
      contextInfo - Additional sandbox and tenant info
      Returns:
      Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned since it may be a partial return.
    • getItemsAlreadyInReturnTenantContext

      protected Map<String,Integer> getItemsAlreadyInReturnTenantContext(String orderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned since it may be a partial return, based on all records within the tenant context.
      Parameters:
      orderId - ID of the parent order
      contextInfo - Additional sandbox and tenant info
      Returns:
      Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned since it may be a partial return, based on all records within the tenant.
    • findReturnableItems

      protected List<P> findReturnableItems(Map<String,Integer> itemsAlreadyInReturn, Stream<P> items)
      Returns a list of OrderFulfillmentItems that can be returned with their quantities adjusted to the amount that can still be returned in the case of partial returns already existing.
      Parameters:
      itemsAlreadyInReturn - Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned
      items - List of candidate items from an entire Order or a single OrderFulfillment
      Returns:
      Returns a list of OrderFulfillmentItems that can be returned with their quantities adjusted to the amount that can still be returned.
    • getOrderFulfillmentService

      protected OrderFulfillmentService<com.broadleafcommerce.order.client.domain.OrderFulfillment> getOrderFulfillmentService()
    • getReturnAuthorizationService

      protected ReturnAuthorizationService<com.broadleafcommerce.order.client.domain.ReturnAuthorization> getReturnAuthorizationService()