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 readorders
from the Order Service.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CLIENT_REGISTRATION_ID
Deprecated.
-
Constructor Summary
Constructors Constructor Description DefaultOrderService(org.springframework.web.reactive.function.client.WebClient webClient, String orderEndpoint, String readOrderIdsPath, String readOrdersPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBatchOrderIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids)
protected String
buildReadBatchOfOrderIdsUri(String startId, int batchSize)
protected String
buildReadBatchOfOrdersUri(List<String> ids)
protected String
getOrderEndpoint()
protected String
getReadOrderIdsPath()
protected String
getReadOrdersPath()
String
getServiceClient()
The service client to use when calling inventory services.protected org.springframework.web.reactive.function.client.WebClient
getWebClient()
List<String>
readBatchOfOrderIds(String startId, int batchSize)
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>
readOrder(@NonNull String id)
Reads anOrder
by its ID.void
setServiceClient(String serviceClient)
The service client to use when calling inventory services.
-
-
-
Field Detail
-
CLIENT_REGISTRATION_ID
@Deprecated protected static final String CLIENT_REGISTRATION_ID
Deprecated.- See Also:
- Constant Field Values
-
-
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 interfaceOrderService
- Parameters:
startId
- The starting IDbatchSize
- 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 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.
-
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"
-
-