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
ConstructorDescriptionDataFeedProcessExecutionManager
(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 givenDataFeedProcessExecution
as completed.protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildContextInfo
(String tenantId, com.broadleafcommerce.data.tracking.core.type.OperationType operationType) protected DataFeedProcessExecution
buildExecution
(DataFeedProcess parent, String status) protected DataFeedPublication
buildPublication
(String dataFeedPublicationConfigurationId, DataFeedProcessExecution executionReadyForPublishing, String publicationStatus) Builds a newDataFeedPublication
instance.protected List<DataFeedPublication>
buildPublications
(DataFeedProcessExecution executionReadyForPublishing, String publicationStatus) protected DataFeedCollectionResponse
engageCollection
(DataFeedProcessExecution execution, String tenantId) protected Optional<DataFeedCollector>
protected List<DataFeedCollector>
protected DataFeedProcessService<DataFeedProcess>
protected DataFeedPublicationService<DataFeedPublication>
protected StorageService
protected com.broadleafcommerce.common.extension.TypeFactory
protected DataFeedProcessExecution
handleCollectionResponse
(DataFeedCollectionResponse dataFeedCollectionResponse, DataFeedProcessExecution execution, String tenantId) Handles a data feed collection response.protected void
handleRequestExecutionForFullAuthoritativeProcess
(DataFeedProcess fullAuthoritativeProcess, String tenantId) HandlesrequestExecution(String, String)
for the givenDefaultDataFeedProcessTypes.FULL_AUTHORITATIVE
process.protected void
handleRequestExecutionForPartialUpdateProcess
(DataFeedProcess partialUpdateProcess, String tenantId) HandlesrequestExecution(String, String)
for the givenDefaultDataFeedProcessTypes.PARTIAL_UPDATE
process.protected DataFeedCollectionRequest
prepareCollectionRequest
(DataFeedProcessExecution execution, String tenantId) void
requestExecution
(String dataFeedProcessId, String requestingTenantId) Prepares, creates, and initiates aDataFeedProcessExecution
for the specifiedDataFeedProcess
.protected void
requestPublication
(String dataFeedProcessExecutionId, String requestingTenantId) void
runExecution
(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 aDataFeedProcessExecution
for 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 theDataFeedProcess
to 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_AUTHORITATIVE
process.- Parameters:
fullAuthoritativeProcess
- theDefaultDataFeedProcessTypes.FULL_AUTHORITATIVE
process 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_UPDATE
process.- Parameters:
partialUpdateProcess
- theDefaultDataFeedProcessTypes.PARTIAL_UPDATE
process 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 updatingDataFeedProcessExecution
in 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
execution
after being updated in the data store (either with success or failure), ornull
if 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 newDataFeedPublication
instance.- Parameters:
dataFeedPublicationConfigurationId
- one of the values fromDataFeedProcessExecution.getDataFeedPublicationConfigurationIds()
to build the instance forexecutionReadyForPublishing
- the parentDataFeedProcessExecution
to build the instance forpublicationStatus
- a value fromDefaultDataFeedPublicationStatuses
to 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 givenDataFeedProcessExecution
as completed.Before calling this method, ensure that any
DataFeedPublication
instances 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
DataFeedProcessExecution
if successfully completed,null
otherwise
-
getProcessService
-
getProcessExecutionService
-
getPublicationService
-
getIncrementalRecordService
protected IncrementalDataFeedEntityUpdateRecordService<IncrementalDataFeedEntityUpdateRecord> getIncrementalRecordService() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getDataFeedCollectors
-
getStorageService
-