Class DefaultOrderService
java.lang.Object
com.broadleafcommerce.search.index.order.service.DefaultOrderService
- All Implemented Interfaces:
OrderService
Default implementation to read
orders
from the Order Service.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultOrderService
(org.springframework.web.reactive.function.client.WebClient webClient, String orderEndpoint, String readOrderIdsPath, String readOrdersPath) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBatchOrderIdFilter
(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids) protected cz.jirutka.rsql.parser.ast.Node
buildBatchOrderIdsFilters
(String startId, Map<String, Object> additionalProperties) protected String
buildReadBatchOfOrderIdsUri
(String startId, int batchSize) Deprecated.in favor ofbuildReadBatchOfOrderIdsUri(String, int, Map<String, Object>)
for the potential to utilize a time range when reading orders.protected String
buildReadBatchOfOrderIdsUri
(String startId, int batchSize, Map<String, Object> additionalProperties) Build the order URI based on the provided parameters.protected String
protected String
protected String
protected String
The service client to use when calling inventory services.protected org.springframework.web.reactive.function.client.WebClient
readBatchOfOrderIds
(String startId, int batchSize) readBatchOfOrderIds
(String startId, int batchSize, Map<String, Object> additionalProperties) Reads a batch of IDs to be placed in a queue for processing.List<com.broadleafcommerce.search.order.core.domain.Order>
readBatchOfOrders
(List<String> ids) Reads a batch ofOrders
by their IDs.Optional<com.broadleafcommerce.search.order.core.domain.Order>
Reads anOrder
by its ID.void
setServiceClient
(String serviceClient) The service client to use when calling inventory services.
-
Field Details
-
CLIENT_REGISTRATION_ID
Deprecated.- See Also:
-
-
Constructor Details
-
DefaultOrderService
-
-
Method Details
-
readBatchOfOrderIds
public List<String> readBatchOfOrderIds(String startId, int batchSize) throws com.broadleafcommerce.search.api.SearchIndexException - Specified by:
readBatchOfOrderIds
in interfaceOrderService
- 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.SearchIndexExceptionDescription 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 interfaceOrderService
- Parameters:
startId
- The starting IDbatchSize
- The size of the batchadditionalProperties
- 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 ofbuildReadBatchOfOrderIdsUri(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 IDbatchSize
- The size of the batchadditionalProperties
- 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 ofOrders
by their IDs.- Specified by:
readBatchOfOrders
in interfaceOrderService
- 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 anOrder
by its ID.- Specified by:
readOrder
in interfaceOrderService
- Parameters:
id
- An order id- Returns:
- An order optional or
Optional.empty()
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if reading the order fails.
-
buildReadBatchOfOrdersUri
-
addBatchOrderIdFilter
-
buildBatchOrderIdsFilters
-
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient() -
getOrderEndpoint
-
getReadOrderIdsPath
-
getReadOrdersPath
-
getServiceClient
The service client to use when calling inventory services. Default is "indexerclient" -
setServiceClient
The service client to use when calling inventory services. Default is "indexerclient"
-
getServiceClient()