Class DefaultCustomerService
java.lang.Object
com.broadleafcommerce.search.index.customer.service.DefaultCustomerService
- All Implemented Interfaces:
CustomerService
Default implementation to read
customers from the Customer Service.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCustomerService(org.springframework.web.reactive.function.client.WebClient webClient, String customerEndpoint, String readCustomerIdsPath, String readCustomersPath) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBatchCustomerIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids) protected cz.jirutka.rsql.parser.ast.NodebuildBatchCustomerIdsFilters(String startId, Map<String, Object> additionalProperties) protected StringbuildReadBatchOfCustomerIdsUri(String startId, int batchSize) Deprecated.protected StringbuildReadBatchOfCustomerIdsUri(String startId, int batchSize, Map<String, Object> additionalProperties) Build the product id 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.WebClientreadBatchOfCustomerIds(String startId, int batchSize) readBatchOfCustomerIds(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.customer.core.domain.Customer>readBatchOfCustomers(List<String> ids) Reads a batch ofCustomersby their IDs.Optional<com.broadleafcommerce.search.customer.core.domain.Customer>readCustomer(@NonNull String id) Reads a batch ofCustomersby their IDs.voidsetServiceClient(String serviceClient) The service client to use when calling inventory services.
-
Field Details
-
CLIENT_REGISTRATION_ID
- See Also:
-
-
Constructor Details
-
DefaultCustomerService
-
-
Method Details
-
readBatchOfCustomerIds
public List<String> readBatchOfCustomerIds(@Nullable String startId, int batchSize) throws com.broadleafcommerce.search.api.SearchIndexException - Specified by:
readBatchOfCustomerIdsin interfaceCustomerService- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-
readBatchOfCustomerIds
public List<String> readBatchOfCustomerIds(@Nullable String startId, int batchSize, @Nullable Map<String, Object> additionalProperties) throws com.broadleafcommerce.search.api.SearchIndexExceptionDescription copied from interface:CustomerServiceReads a batch of IDs to be placed in a queue for processing.- Specified by:
readBatchOfCustomerIdsin interfaceCustomerService- 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 customer IDs.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException- if reading the customer ids fails.
-
buildReadBatchOfCustomerIdsUri
@Deprecated(since="2.1.5-GA") protected String buildReadBatchOfCustomerIdsUri(@Nullable String startId, int batchSize) Deprecated.in favor ofbuildReadBatchOfCustomerIdsUri(String, int, Map<String, Object>)for the potential to utilize a time range when reading customers. -
buildReadBatchOfCustomerIdsUri
protected String buildReadBatchOfCustomerIdsUri(@Nullable String startId, int batchSize, @Nullable Map<String, Object> additionalProperties) Build the product id 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
-
readBatchOfCustomers
public List<com.broadleafcommerce.search.customer.core.domain.Customer> readBatchOfCustomers(List<String> ids) throws com.broadleafcommerce.search.api.SearchIndexException Description copied from interface:CustomerServiceReads a batch ofCustomersby their IDs.- Specified by:
readBatchOfCustomersin interfaceCustomerService- Parameters:
ids- A list of customer IDs.- Returns:
- A list of customers or an empty list.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException- if reading the customer fails.
-
readCustomer
public Optional<com.broadleafcommerce.search.customer.core.domain.Customer> readCustomer(@NonNull @NonNull @NonNull String id) throws com.broadleafcommerce.search.api.SearchIndexException Description copied from interface:CustomerServiceReads a batch ofCustomersby their IDs.- Specified by:
readCustomerin interfaceCustomerService- Parameters:
id- A customer id- Returns:
- A customer optional or
Optional.empty() - Throws:
com.broadleafcommerce.search.api.SearchIndexException- if reading the customer fails.
-
buildReadBatchOfCustomersUri
-
addBatchCustomerIdFilter
-
buildBatchCustomerIdsFilters
-
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient() -
getCustomerEndpoint
-
getReadCustomerIdsPath
-
getReadCustomersPath
-
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"
-
buildReadBatchOfCustomerIdsUri(String, int, Map<String, Object>)for the potential to utilize a time range when reading customers.