Class DefaultOrderService

  • All Implemented Interfaces:
    OrderService

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

      • DefaultOrderService

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

      • readBatchOfOrderIds

        public List<String> readBatchOfOrderIds​(String startId,
                                                int batchSize)
                                         throws com.broadleafcommerce.search.api.SearchIndexException
        Description copied from interface: OrderService
        Reads a batch of IDs to be placed in a queue for processing.
        Specified by:
        readBatchOfOrderIds in interface OrderService
        Parameters:
        startId - The starting ID
        batchSize - The size of the batch
        Returns:
        A list of order IDs.
        Throws:
        com.broadleafcommerce.search.api.SearchIndexException - if reading the order ids fails.
      • buildReadBatchOfOrderIdsUri

        protected String buildReadBatchOfOrderIdsUri​(@Nullable
                                                     String startId,
                                                     int batchSize)
      • 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)
      • 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"