Class BatchContextHelper
java.lang.Object
com.broadleafcommerce.common.dataimport.context.BatchContextHelper
Intended to help with common batch context setup actions.
- Author:
 - Nathan Moore (nathandmoore)
 
- 
Constructor Summary
ConstructorsConstructorDescriptionBatchContextHelper(com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator hydrator)  - 
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfoForBatchContext(BatchRequest.BatchContext context, com.broadleafcommerce.data.tracking.core.type.OperationType operationType) Creates a hydratedContextInfowith data matching values fromcontext.protected CurrencyfindCurrencyForContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest) Finds the currency to use for the request context.protected LocalefindLocaleForContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest) Finds the locale to use for the request context.protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator 
- 
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 hydratedContextInfowith data matching values fromcontext. 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 usingContextInfo.withOperationType(ContextInfo, OperationType).- Parameters:
 context- the batch context from which to source context-info data- Returns:
 - a new hydrated 
ContextInfowith data matching values fromcontext 
 - 
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() 
 -