Class DefaultOrderService

java.lang.Object
com.broadleafcommerce.search.index.order.service.DefaultOrderService
All Implemented Interfaces:
OrderService

public class DefaultOrderService extends Object implements OrderService
Default implementation to read orders from the Order Service.
  • Field Details

  • Constructor Details

    • DefaultOrderService

      public DefaultOrderService(org.springframework.web.reactive.function.client.WebClient webClient, String orderEndpoint, String readOrderIdsPath, String readOrdersPath)
  • Method Details

    • readBatchOfOrderIds

      public List<String> readBatchOfOrderIds(String startId, int batchSize) throws com.broadleafcommerce.search.api.SearchIndexException
      Specified by:
      readBatchOfOrderIds in interface OrderService
      Throws:
      com.broadleafcommerce.search.api.SearchIndexException
    • readBatchOfOrderIds

      public List<String> readBatchOfOrderIds(String startId, int batchSize, @Nullable Map<String,Object> additionalProperties) throws com.broadleafcommerce.search.api.SearchIndexException
      Description copied from interface: OrderService
      Reads a batch of IDs to be placed in a queue for processing. Additional properties can also be specified to limit the items being read to be indexed.
      Specified by:
      readBatchOfOrderIds in interface OrderService
      Parameters:
      startId - The starting ID
      batchSize - The size of the batch
      additionalProperties - additional information that can be used to filter the items to be indexed
      Returns:
      A list of order IDs.
      Throws:
      com.broadleafcommerce.search.api.SearchIndexException - if reading the order ids fails.
    • buildReadBatchOfOrderIdsUri

      @Deprecated(since="2.1.2-GA") protected String buildReadBatchOfOrderIdsUri(@Nullable String startId, int batchSize)
      Deprecated.
      in favor of buildReadBatchOfOrderIdsUri(String, int, Map<String, Object>) for the potential to utilize a time range when reading orders.
    • buildReadBatchOfOrderIdsUri

      protected String buildReadBatchOfOrderIdsUri(@Nullable String startId, int batchSize, @Nullable Map<String,Object> additionalProperties)
      Build the order URI based on the provided parameters.
      Parameters:
      startId - The starting ID
      batchSize - The size of the batch
      additionalProperties - additional information that can be used to filter the items to be indexed
      Returns:
      the built uri
    • readBatchOfOrders

      public List<com.broadleafcommerce.search.order.core.domain.Order> readBatchOfOrders(List<String> ids) throws com.broadleafcommerce.search.api.SearchIndexException
      Description copied from interface: OrderService
      Reads a batch of Orders by their IDs.
      Specified by:
      readBatchOfOrders in interface OrderService
      Parameters:
      ids - A list of order IDs.
      Returns:
      A list of orders or an empty list.
      Throws:
      com.broadleafcommerce.search.api.SearchIndexException - if reading the order fails.
    • readOrder

      public Optional<com.broadleafcommerce.search.order.core.domain.Order> readOrder(@NonNull @NonNull @NonNull String id) throws com.broadleafcommerce.search.api.SearchIndexException
      Description copied from interface: OrderService
      Reads an Order by its ID.
      Specified by:
      readOrder in interface OrderService
      Parameters:
      id - An order id
      Returns:
      An order optional or Optional.empty()
      Throws:
      com.broadleafcommerce.search.api.SearchIndexException - if reading the order fails.
    • buildReadBatchOfOrdersUri

      protected String buildReadBatchOfOrdersUri(List<String> ids)
    • addBatchOrderIdFilter

      protected void addBatchOrderIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids)
    • buildBatchOrderIdsFilters

      protected cz.jirutka.rsql.parser.ast.Node buildBatchOrderIdsFilters(@Nullable String startId, @Nullable Map<String,Object> additionalProperties)
    • getWebClient

      protected org.springframework.web.reactive.function.client.WebClient getWebClient()
    • getOrderEndpoint

      protected String getOrderEndpoint()
    • getReadOrderIdsPath

      protected String getReadOrderIdsPath()
    • getReadOrdersPath

      protected String getReadOrdersPath()
    • getServiceClient

      public String getServiceClient()
      The service client to use when calling inventory services. Default is "indexerclient"
    • setServiceClient

      public void setServiceClient(String serviceClient)
      The service client to use when calling inventory services. Default is "indexerclient"