Class DefaultOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment,R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization>

java.lang.Object
com.broadleafcommerce.orderoperation.service.DefaultOrderHistoryService<O,F,R>
All Implemented Interfaces:
OrderHistoryService<O,OrderWithFulfillmentsAndReturns>

public class DefaultOrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment,R extends com.broadleafcommerce.order.client.domain.ReturnAuthorization> extends Object implements OrderHistoryService<O,OrderWithFulfillmentsAndReturns>
  • Field Details

  • Constructor Details

    • DefaultOrderHistoryService

      public DefaultOrderHistoryService(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, OrderProvider<O> orderProvider, FulfillmentProvider<F> fulfillmentProvider, ReturnAuthorizationProvider<R> returnAuthorizationProvider)
  • Method Details

    • readOrderHistoryForCustomer

      public org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns> readOrderHistoryForCustomer(@Nullable Integer days, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderHistoryService
      Read all orders with its fulfillments and returns for the currently authenticated customer for the past number of days.
      Specified by:
      readOrderHistoryForCustomer in interface OrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      days - The number of days to read order history
      page - the requested page of results from the database
      contextInfo - The current context
      Returns:
      The orders with the customer ID in the date range
    • readHistoricalOrdersForCustomer

      protected org.springframework.data.domain.Page<O> readHistoricalOrdersForCustomer(@Nullable Integer days, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildOrderHistoryFilters

      protected cz.jirutka.rsql.parser.ast.Node buildOrderHistoryFilters(String customerId, Instant start, Instant end)
    • readFulfillmentsIntoOrderHistory

      protected void readFulfillmentsIntoOrderHistory(List<OrderWithFulfillmentsAndReturns> orderHistory, List<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • readReturnsIntoOrderHistory

      protected void readReturnsIntoOrderHistory(List<OrderWithFulfillmentsAndReturns> orderHistory, List<String> orderIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • readOrderByIdOrNumber

      public OrderWithFulfillmentsAndReturns readOrderByIdOrNumber(String orderRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderHistoryService
      Retrieve the order with the given order reference (ID or order number) and its fulfillments and returns.
      Specified by:
      readOrderByIdOrNumber in interface OrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderRef - The ID or number of the order to read
      contextInfo - The current context
      Returns:
      The order with the given ID and its fulfillments and returns.
    • readOrderHistoryForAccount

      public org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns> readOrderHistoryForAccount(boolean includeChildren, @Nullable org.springframework.data.domain.Pageable page, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderHistoryService
      Read all orders with its fulfillments and returns for the currently authenticated account with or without including child accounts' orders
      Specified by:
      readOrderHistoryForAccount in interface OrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      includeChildren - whether to include child accounts' orders
      page - the requested page of results from the database
      filters - custom filters to be applied
      contextInfo - The current context
      Returns:
      The orders for the authenticated account and possibly child accounts
    • readOrderByIdOrNumberForAccount

      public OrderWithFulfillmentsAndReturns readOrderByIdOrNumberForAccount(@NonNull @NonNull String orderRef, boolean includeChildren, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: OrderHistoryService
      Retrieve the order with the given order reference (ID or order number) and its fulfillments and returns.
      Specified by:
      readOrderByIdOrNumberForAccount in interface OrderHistoryService<O extends com.broadleafcommerce.order.client.domain.Order,F extends com.broadleafcommerce.order.client.domain.OrderFulfillment>
      Parameters:
      orderRef - The ID or number of the order to read
      includeChildren - whether to search in child accounts' orders
      contextInfo - The current context
      Returns:
      The order with the given ID and its fulfillments and returns.
    • buildOrderWithFulfillmentsAndReturns

      protected org.springframework.data.domain.Page<OrderWithFulfillmentsAndReturns> buildOrderWithFulfillmentsAndReturns(@NonNull @NonNull org.springframework.data.domain.Page<O> orders, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Builds a page of OrderWithFulfillmentsAndReturns by retrieving the OrderFulfillment and ReturnAuthorization for the given Orders
    • buildAccountOrderHistoryFilters

      protected cz.jirutka.rsql.parser.ast.Node buildAccountOrderHistoryFilters(boolean includeChildren, @Nullable cz.jirutka.rsql.parser.ast.Node existingFilters, @NonNull @NonNull String accountId, @NonNull @NonNull String rootAccountId, @Nullable String orderRef)
      Builds Node filters based on the account id, root account id, and order id or number.
      Parameters:
      includeChildren - whether to include the sub-accounts' orders
      existingFilters - exising filters to build on top of
      accountId - the id of the account
      rootAccountId - the id of the root account
      orderRef - optional parameter to find by order id or number
      Returns:
      the Node filters based on the account id, root account id, and order id or number.
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getOrderProvider

      protected OrderProvider<O> getOrderProvider()
    • getFulfillmentProvider

      protected FulfillmentProvider<F> getFulfillmentProvider()
    • getReturnAuthorizationProvider

      protected ReturnAuthorizationProvider<R> getReturnAuthorizationProvider()