Class DataFeedProcessExecutionManager
java.lang.Object
com.broadleafcommerce.datafeed.service.manager.DataFeedProcessExecutionManager
Responsible for managing the lifecycle of a
DataFeedProcessExecution operation.
While DataFeedProcessExecutionService is in charge of CRUD-related operations on
DataFeedProcessExecution, this service is a higher-level abstraction that performs the
surrounding logic of processing execution operations. It internally delegates to
DataFeedProcessExecutionService for CRUD operations.
-
Constructor Summary
ConstructorsConstructorDescriptionDataFeedProcessExecutionManager(DataFeedProcessService<DataFeedProcess> processService, DataFeedProcessExecutionService<DataFeedProcessExecution> processExecutionService, DataFeedPublicationService<DataFeedPublication> publicationService, IncrementalDataFeedEntityUpdateRecordService<IncrementalDataFeedEntityUpdateRecord> incrementalRecordService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, List<DataFeedCollector> dataFeedCollectors, StorageService storageService) -
Method Summary
Modifier and TypeMethodDescriptionattemptCompletionOfExecution(String dataFeedProcessExecutionId, String requestingTenantId, boolean containsErrors, List<String> errorDetails, String whereCurrentStatus) Attempt marking the givenDataFeedProcessExecutionas completed.protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfo(String tenantId, com.broadleafcommerce.data.tracking.core.type.OperationType operationType) protected DataFeedProcessExecutionbuildExecution(DataFeedProcess parent, String status) protected DataFeedPublicationbuildPublication(String dataFeedPublicationConfigurationId, DataFeedProcessExecution executionReadyForPublishing, String publicationStatus) Builds a newDataFeedPublicationinstance.protected List<DataFeedPublication>buildPublications(DataFeedProcessExecution executionReadyForPublishing, String publicationStatus) protected DataFeedCollectionResponseengageCollection(DataFeedProcessExecution execution, String tenantId) protected Optional<DataFeedCollector>protected List<DataFeedCollector>protected DataFeedProcessService<DataFeedProcess>protected DataFeedPublicationService<DataFeedPublication>protected StorageServiceprotected com.broadleafcommerce.common.extension.TypeFactoryprotected DataFeedProcessExecutionhandleCollectionResponse(DataFeedCollectionResponse dataFeedCollectionResponse, DataFeedProcessExecution execution, String tenantId) Handles a data feed collection response.protected voidhandleRequestExecutionForFullAuthoritativeProcess(DataFeedProcess fullAuthoritativeProcess, String tenantId) HandlesrequestExecution(String, String)for the givenDefaultDataFeedProcessTypes.FULL_AUTHORITATIVEprocess.protected voidhandleRequestExecutionForPartialUpdateProcess(DataFeedProcess partialUpdateProcess, String tenantId) HandlesrequestExecution(String, String)for the givenDefaultDataFeedProcessTypes.PARTIAL_UPDATEprocess.protected DataFeedCollectionRequestprepareCollectionRequest(DataFeedProcessExecution execution, String tenantId) voidrequestExecution(String dataFeedProcessId, String requestingTenantId) Prepares, creates, and initiates aDataFeedProcessExecutionfor the specifiedDataFeedProcess.protected voidrequestPublication(String dataFeedProcessExecutionId, String requestingTenantId) voidrunExecution(String dataFeedProcessExecutionId, String requestingTenantId) Actually runs the provided existing data feed execution.
-
Constructor Details
-
DataFeedProcessExecutionManager
public DataFeedProcessExecutionManager(DataFeedProcessService<DataFeedProcess> processService, DataFeedProcessExecutionService<DataFeedProcessExecution> processExecutionService, DataFeedPublicationService<DataFeedPublication> publicationService, IncrementalDataFeedEntityUpdateRecordService<IncrementalDataFeedEntityUpdateRecord> incrementalRecordService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, List<DataFeedCollector> dataFeedCollectors, StorageService storageService)
-
-
Method Details
-
requestExecution
Prepares, creates, and initiates aDataFeedProcessExecutionfor the specifiedDataFeedProcess.This only creates and requests the execution - it does not actually begin running or processing that execution. For that, see
runExecution(String, String)- Parameters:
dataFeedProcessId- the ID of theDataFeedProcessto start a new execution forrequestingTenantId- the tenant ID of where this execution request is coming from. This is important to prevent different tenants from requesting execution of processes in each other
-
buildContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfo(String tenantId, com.broadleafcommerce.data.tracking.core.type.OperationType operationType) -
handleRequestExecutionForFullAuthoritativeProcess
protected void handleRequestExecutionForFullAuthoritativeProcess(DataFeedProcess fullAuthoritativeProcess, String tenantId) HandlesrequestExecution(String, String)for the givenDefaultDataFeedProcessTypes.FULL_AUTHORITATIVEprocess.- Parameters:
fullAuthoritativeProcess- theDefaultDataFeedProcessTypes.FULL_AUTHORITATIVEprocess to handle execution request fortenantId- the tenant ID of the request
-
buildExecution
-
handleRequestExecutionForPartialUpdateProcess
protected void handleRequestExecutionForPartialUpdateProcess(DataFeedProcess partialUpdateProcess, String tenantId) HandlesrequestExecution(String, String)for the givenDefaultDataFeedProcessTypes.PARTIAL_UPDATEprocess.- Parameters:
partialUpdateProcess- theDefaultDataFeedProcessTypes.PARTIAL_UPDATEprocess to handle execution request fortenantId- the tenant ID of the request
-
runExecution
Actually runs the provided existing data feed execution.- Parameters:
dataFeedProcessExecutionId- theDataFeedProcessExecution.getId()which needs to be run. This must exist in the datastore with statusDefaultDataFeedExecutionStatuses.REQUESTED.requestingTenantId- the tenant ID of where this run-execution request is coming from. This is important to prevent different tenants from running executions in each other
-
engageCollection
protected DataFeedCollectionResponse engageCollection(DataFeedProcessExecution execution, String tenantId) -
prepareCollectionRequest
protected DataFeedCollectionRequest prepareCollectionRequest(DataFeedProcessExecution execution, String tenantId) -
findDataFeedCollector
-
handleCollectionResponse
@Nullable protected DataFeedProcessExecution handleCollectionResponse(DataFeedCollectionResponse dataFeedCollectionResponse, DataFeedProcessExecution execution, String tenantId) Handles a data feed collection response. This includes transferringDataFeedCollectionResponse.getLocalCollectedDataFile()to theStorageService, as well as updatingDataFeedProcessExecutionin the data store as necessary.- Parameters:
dataFeedCollectionResponse- the data feed collection responseexecution- the execution that this collection was originally happening for. This instance itself will not be directly mutated, and any changes will be directly applied in the data store.tenantId- the tenant ID in which this process is happening- Returns:
- a new instance of the
executionafter being updated in the data store (either with success or failure), ornullif the instance could not be updated in the datastore altogether
-
requestPublication
-
buildPublications
protected List<DataFeedPublication> buildPublications(DataFeedProcessExecution executionReadyForPublishing, String publicationStatus) -
buildPublication
protected DataFeedPublication buildPublication(String dataFeedPublicationConfigurationId, DataFeedProcessExecution executionReadyForPublishing, String publicationStatus) Builds a newDataFeedPublicationinstance.- Parameters:
dataFeedPublicationConfigurationId- one of the values fromDataFeedProcessExecution.getDataFeedPublicationConfigurationIds()to build the instance forexecutionReadyForPublishing- the parentDataFeedProcessExecutionto build the instance forpublicationStatus- a value fromDefaultDataFeedPublicationStatusesto set on the publication- Returns:
- the built instance
-
attemptCompletionOfExecution
@Nullable public DataFeedProcessExecution attemptCompletionOfExecution(String dataFeedProcessExecutionId, String requestingTenantId, boolean containsErrors, @Nullable List<String> errorDetails, @Nullable String whereCurrentStatus) Attempt marking the givenDataFeedProcessExecutionas completed.Before calling this method, ensure that any
DataFeedPublicationinstances for this execution are already marked completed.- Parameters:
dataFeedProcessExecutionId- theDataFeedProcessExecution.getId()which needs to be marked completedrequestingTenantId- the tenant ID of where this complete-execution request is coming fromcontainsErrors- the value to set forDataFeedProcessExecution.isContainsErrors()errorDetails- (optional) the value to set forDataFeedProcessExecution.getErrorDetails()whereCurrentStatus- (optional) if provided, the update will only be applied if the execution currently has this value for itsDataFeedProcessExecution.getStatus()- Returns:
- the
DataFeedProcessExecutionif successfully completed,nullotherwise
-
getProcessService
-
getProcessExecutionService
-
getPublicationService
-
getIncrementalRecordService
protected IncrementalDataFeedEntityUpdateRecordService<IncrementalDataFeedEntityUpdateRecord> getIncrementalRecordService() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getDataFeedCollectors
-
getStorageService
-