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 voidaddBatchOrderIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids) protected cz.jirutka.rsql.parser.ast.NodebuildBatchOrderIdsFilters(String startId, Map<String, Object> additionalProperties) protected StringbuildReadBatchOfOrderIdsUri(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 StringbuildReadBatchOfOrderIdsUri(String startId, int batchSize, Map<String, Object> additionalProperties) Build the order URI based on the provided parameters.protected Stringprotected Stringprotected Stringprotected StringThe service client to use when calling inventory services.protected org.springframework.web.reactive.function.client.WebClientreadBatchOfOrderIds(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 ofOrdersby their IDs.Optional<com.broadleafcommerce.search.order.core.domain.Order>Reads anOrderby its ID.voidsetServiceClient(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:
readBatchOfOrderIdsin 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:OrderServiceReads 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:
readBatchOfOrderIdsin 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:OrderServiceReads a batch ofOrdersby their IDs.- Specified by:
readBatchOfOrdersin 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:OrderServiceReads anOrderby its ID.- Specified by:
readOrderin 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()