Class BatchContextHelper

java.lang.Object
com.broadleafcommerce.common.dataimport.context.BatchContextHelper

public class BatchContextHelper extends Object
Intended to help with common batch context setup actions.
Author:
Nathan Moore (nathandmoore)
  • Constructor Details

    • BatchContextHelper

      public BatchContextHelper(com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator hydrator)
  • Method Details

    • buildContextInfoForBatchContext

      public com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfoForBatchContext(BatchRequest.BatchContext context, com.broadleafcommerce.data.tracking.core.type.OperationType operationType)
      Creates a hydrated ContextInfo with data matching values from context. This can be used as a basis for all persistent operations that take place during the processing of a batch—the only change that should be needed is to the operation type. This can be easily done using ContextInfo.withOperationType(ContextInfo, OperationType).
      Parameters:
      context - the batch context from which to source context-info data
      Returns:
      a new hydrated ContextInfo with data matching values from context
    • findLocaleForContextRequest

      protected Locale findLocaleForContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
      Finds the locale to use for the request context. This will first look at the resolved catalog, then the application, before falling back on the system locale.
      Parameters:
      contextRequest - The resolved, hydrated context request
      Returns:
      The locale to use for this context if it can be determined
    • findCurrencyForContextRequest

      protected Currency findCurrencyForContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
      Finds the currency to use for the request context. This will first look at the resolved catalog, then the application, before falling back on the system currency.
      Parameters:
      contextRequest - The resolved, hydrated context request
      Returns:
      The currency to use for this context
    • getHydrator

      protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator getHydrator()