Class CustomerSingleIndexRequestHandler
- java.lang.Object
-
- com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
- com.broadleafcommerce.search.index.customer.messaging.handler.CustomerSingleIndexRequestHandler
-
public class CustomerSingleIndexRequestHandler extends com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandlerListens for single index requests originating from changes to Customers and sends them to be updated in the index.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DELETE_PROPERTY
-
Constructor Summary
Constructors Constructor Description CustomerSingleIndexRequestHandler(CustomerService customerService, com.broadleafcommerce.search.index.core.service.ReindexDelegationService reindexDelegationService, com.broadleafcommerce.search.index.core.service.ReindexService reindexService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddeleteCustomerFromIndex(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)Deletes a customer from the index.protected StringgetCustomerCtxId(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)Read the context ID of the customer associated with the given object.protected StringgetCustomerCtxIdPath()Get the path for retrieving the customer context ID from a single index request JSON payload.protected StringgetCustomerDeleteProperty()protected CustomerServicegetCustomerService()protected com.broadleafcommerce.search.index.core.service.ReindexDelegationServicegetReindexDelegationService()protected com.broadleafcommerce.search.index.core.service.ReindexServicegetReindexService()String[]getSupportedSimpleTypeNames()voidhook(String singleIndexRequest)protected voidindexCustomer(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)protected booleanisDelete(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)voidprocessSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)protected com.broadleafcommerce.search.customer.core.domain.CustomerreadCustomer(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)Read all state versions of customers with the context ID of the customer associated with the given object.
-
-
-
Field Detail
-
DEFAULT_DELETE_PROPERTY
public static final String DEFAULT_DELETE_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CustomerSingleIndexRequestHandler
public CustomerSingleIndexRequestHandler(CustomerService customerService, com.broadleafcommerce.search.index.core.service.ReindexDelegationService reindexDelegationService, com.broadleafcommerce.search.index.core.service.ReindexService reindexService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Detail
-
hook
@StreamListener("singleIndexRequestInputCustomer") public void hook(String singleIndexRequest)- Specified by:
hookin classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
processSingleIndexRequest
public void processSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
- Specified by:
processSingleIndexRequestin classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
indexCustomer
protected void indexCustomer(com.fasterxml.jackson.databind.JsonNode singleIndexRequest) throws com.broadleafcommerce.search.api.SearchIndexException- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-
deleteCustomerFromIndex
protected void deleteCustomerFromIndex(com.fasterxml.jackson.databind.JsonNode singleIndexRequest) throws com.broadleafcommerce.search.api.SearchIndexExceptionDeletes a customer from the index.- Parameters:
singleIndexRequest- The JSON representation of the single index request- Throws:
com.broadleafcommerce.search.api.SearchIndexException- If the deletion fails.
-
isDelete
protected boolean isDelete(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
- Parameters:
singleIndexRequest- The JSON representation of the single index request- Returns:
- true if this is a customer delete, else false.
-
readCustomer
@Nullable protected com.broadleafcommerce.search.customer.core.domain.Customer readCustomer(com.fasterxml.jackson.databind.JsonNode singleIndexRequest) throws com.broadleafcommerce.search.api.SearchIndexExceptionRead all state versions of customers with the context ID of the customer associated with the given object.- Parameters:
singleIndexRequest- The JSON representation of the single index request- Returns:
- list of all state versions of customers with the object's customer context ID
- Throws:
com.broadleafcommerce.search.api.SearchIndexException- if the object has no context ID for a customer
-
getCustomerCtxId
protected String getCustomerCtxId(com.fasterxml.jackson.databind.JsonNode singleIndexRequest) throws com.broadleafcommerce.search.api.SearchIndexException
Read the context ID of the customer associated with the given object.- Parameters:
singleIndexRequest- The JSON representation of the single index request- Returns:
- the context ID of the associated customer
- Throws:
com.broadleafcommerce.search.api.SearchIndexException- if the object has no context ID for a customer
-
getSupportedSimpleTypeNames
public String[] getSupportedSimpleTypeNames()
- Specified by:
getSupportedSimpleTypeNamesin classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
getCustomerCtxIdPath
protected String getCustomerCtxIdPath()
Get the path for retrieving the customer context ID from a single index request JSON payload.- Returns:
- path to customer context ID
-
getCustomerDeleteProperty
protected String getCustomerDeleteProperty()
-
getCustomerService
protected CustomerService getCustomerService()
-
getReindexDelegationService
protected com.broadleafcommerce.search.index.core.service.ReindexDelegationService getReindexDelegationService()
-
getReindexService
protected com.broadleafcommerce.search.index.core.service.ReindexService getReindexService()
-
-