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.AbstractSingleIndexRequestHandler
Listens for single index requests originating from changes to Customers and sends them to be
updated in the index.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCustomerSingleIndexRequestHandler(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
Modifier and TypeMethodDescriptionprotected 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 StringGet the path for retrieving the customer context ID from a single index request JSON payload.protected Stringprotected CustomerServiceprotected com.broadleafcommerce.search.index.core.service.ReindexDelegationServiceprotected com.broadleafcommerce.search.index.core.service.ReindexServiceString[]voidprotected 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.Methods inherited from class com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
getObjectMapper, handle, isValidType
-
Field Details
-
DEFAULT_DELETE_PROPERTY
- See Also:
-
-
Constructor Details
-
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 Details
-
hook
- 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.SearchIndexException Deletes 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.SearchIndexException Read 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
- Specified by:
getSupportedSimpleTypeNamesin classcom.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
-
getCustomerCtxIdPath
Get the path for retrieving the customer context ID from a single index request JSON payload.- Returns:
- path to customer context ID
-
getCustomerDeleteProperty
-
getCustomerService
-
getReindexDelegationService
protected com.broadleafcommerce.search.index.core.service.ReindexDelegationService getReindexDelegationService() -
getReindexService
protected com.broadleafcommerce.search.index.core.service.ReindexService getReindexService()
-