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
    Modifier and Type
    Field
    Description
    static final String
     
  • 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

    Modifier and Type
    Method
    Description
    protected void
    deleteCustomerFromIndex(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
    Deletes a customer from the index.
    protected String
    getCustomerCtxId(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
    Read the context ID of the customer associated with the given object.
    protected String
    Get the path for retrieving the customer context ID from a single index request JSON payload.
    protected String
     
    protected CustomerService
     
    protected com.broadleafcommerce.search.index.core.service.ReindexDelegationService
     
    protected com.broadleafcommerce.search.index.core.service.ReindexService
     
     
    void
    hook(String singleIndexRequest)
     
    protected void
    indexCustomer(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
     
    protected boolean
    isDelete(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
     
    void
    processSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
     
    protected com.broadleafcommerce.search.customer.core.domain.Customer
    readCustomer(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      @StreamListener("singleIndexRequestInputCustomer") public void hook(String singleIndexRequest)
      Specified by:
      hook in class com.broadleafcommerce.search.index.common.messaging.handler.AbstractSingleIndexRequestHandler
    • processSingleIndexRequest

      public void processSingleIndexRequest(com.fasterxml.jackson.databind.JsonNode singleIndexRequest)
      Specified by:
      processSingleIndexRequest in class com.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

      public String[] getSupportedSimpleTypeNames()
      Specified by:
      getSupportedSimpleTypeNames in class com.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()