Interface OrderService<P extends com.broadleafcommerce.order.client.domain.Order>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
All Known Implementing Classes:
DefaultOrderService

public interface OrderService<P extends com.broadleafcommerce.order.client.domain.Order> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service API for Orders. Supported by OrderRepository.
  • Method Summary

    Modifier and Type
    Method
    Description
    readAllByContextIdAndMatchingTenant(Iterable<String> contextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the orders matching the provided IDs and the tenant from ContextInfo if present.
    org.springframework.data.domain.Page<P>
    readAllByOrderNumber(String orderNumber, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the orders matching the provided order number from ContextInfo if present.
    readAllUniqueIds(int page, cz.jirutka.rsql.parser.ast.Node filters)
    Retrieves a list of unique order context IDs no larger than page.
    org.springframework.data.domain.Page<P>
    readByAccountHierarchyContaining(String accountId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find all orders where the account hierarchy contains the given account id.
    readByCartId(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read an order by its cart ID.
    readByContextIdAndMatchingTenant(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the order matching the provided ID and the tenant from ContextInfo if present.
    org.springframework.data.domain.Page<P>
    readByCustomerIdAndAccountId(String customerId, String accountId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find all orders for the given customer id and account id.
    readByOrderNumber(String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read an order by its order number.
    org.springframework.data.domain.Page<P>
    readByRootAccountId(String rootAccountId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find all orders for the given root account id.
    org.springframework.data.domain.Page<CustomerOrderInfo>
    readCustomerOrderInfo(ReadCustomerOrdersRequest request, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads the Orders and additional related data for the ReadCustomerOrdersRequest.
    com.broadleafcommerce.order.client.domain.Order
    updateOrder(UpdateOrderRequest updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the Order based on the provided reqest.

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

    readAll, readAll, readAll, readAll
  • Method Details

    • readByCartId

      Optional<P> readByCartId(String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read an order by its cart ID.
      Parameters:
      cartId - The order's cart ID
      contextInfo - The current context.
      Returns:
      The order with the cart ID if found
    • readByOrderNumber

      Optional<P> readByOrderNumber(String orderNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read an order by its order number.
      Parameters:
      orderNumber - The order's order number
      contextInfo - The current context.
      Returns:
      The order with the order number if found
    • readAllUniqueIds

      List<String> readAllUniqueIds(int page, @NonNull cz.jirutka.rsql.parser.ast.Node filters)
      Retrieves a list of unique order context IDs no larger than page. It is expected that any appropriate offset is achieved through criteria designated in filters.
      Parameters:
      page - the requested page of results from the database. -1 indicates no limit.
      filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
      Returns:
      unique order IDs
    • readByContextIdAndMatchingTenant

      P readByContextIdAndMatchingTenant(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves the order matching the provided ID and the tenant from ContextInfo if present.

      Differs from the standard narrowing behavior of TrackableRepository.findByContextId(String, ContextInfo), which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.

      Parameters:
      id - the id of the order fulfillment to find
      contextInfo - context information surrounding multitenant state.
      Returns:
      the requested order if found within the tenant
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if no entity is found with the given id
    • readAllByContextIdAndMatchingTenant

      Iterable<P> readAllByContextIdAndMatchingTenant(Iterable<String> contextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves the orders matching the provided IDs and the tenant from ContextInfo if present.

      Differs from the standard narrowing behavior of TrackableRepository.findByContextId(String, ContextInfo), which only returns tenant-level (non-application-associated) records when fetching from a tenant context. This implementation finds all records within the tenant regardless of whether they're associated to an application.

      Parameters:
      contextIds - the ids of the orders to find
      contextInfo - context information surrounding multitenant state.
      Returns:
      The list of narrowed orders
    • readAllByOrderNumber

      org.springframework.data.domain.Page<P> readAllByOrderNumber(@Nullable String orderNumber, cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieves the orders matching the provided order number from ContextInfo if present.
      Parameters:
      orderNumber - the order number to query on
      filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
      page - the requested page of results from the database. -1 indicates no limit.
      contextInfo - context information surrounding multitenant state.
      Returns:
      The page of narrowed orders
    • readByCustomerIdAndAccountId

      org.springframework.data.domain.Page<P> readByCustomerIdAndAccountId(String customerId, String accountId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all orders for the given customer id and account id.

      This is typically used for B2B account orders.

      Parameters:
      customerId - the id of the customer who owns the cart
      accountId - the id of the account that the cart belongs to
      page - the requested page of results from the database
      contextInfo - context information related to multitenancy
      Returns:
      all orders for the given customer id and account id
    • readByRootAccountId

      org.springframework.data.domain.Page<P> readByRootAccountId(String rootAccountId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all orders for the given root account id.

      This is useful to query all the orders that belongs to the same root account.

      For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this query is useful to query all the orders that belong to the root account and its sub-accounts.

      Parameters:
      rootAccountId - the root account id of the cart
      page - the requested page of results from the database
      contextInfo - context information related to multitenancy
      Returns:
      all orders for the given root account id
    • readByAccountHierarchyContaining

      org.springframework.data.domain.Page<P> readByAccountHierarchyContaining(String accountId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all orders where the account hierarchy contains the given account id.

      This is useful to query all the orders that belongs to the same non-root account and its sub-accounts.

      For example, if we have this account setup, rootAcct -> subAcct (child of rootAcct) -> subSubAcct (child of subAcct), this query is useful to query all the orders that belong to the subAcct and its sub-accounts (subSubAcct in this case).

      Parameters:
      accountId - the account id to filter the account hierarchy by
      page - the requested page of results from the database
      contextInfo - context information related to multitenancy
      Returns:
      all orders where the account hierarchy contains the given account id
    • updateOrder

      com.broadleafcommerce.order.client.domain.Order updateOrder(UpdateOrderRequest updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Updates the Order based on the provided reqest.
      Parameters:
      updateRequest - the request payload used to update the Order
      contextInfo - Context information related to multitenancy
      Returns:
      the updated order
    • readCustomerOrderInfo

      org.springframework.data.domain.Page<CustomerOrderInfo> readCustomerOrderInfo(ReadCustomerOrdersRequest request, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads the Orders and additional related data for the ReadCustomerOrdersRequest.
      Parameters:
      request - the request to read the Orders and the related data
      page - the requested page of results from the database
      contextInfo - context information related to multitenancy
      Returns:
      the page of the CustomerOrderInfo with the additional requested data if any