Class DefaultDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.datafeed.service.DefaultDataFeedProcessExecutionService<P>
- Type Parameters:
P
- business/projection type ofDataFeedProcessExecution
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
,DataFeedProcessExecutionService<P>
public class DefaultDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements DataFeedProcessExecutionService<P>
Default implementation of
DataFeedProcessExecutionService
-
Constructor Summary
ConstructorDescriptionDefaultDataFeedProcessExecutionService
(DataFeedProcessExecutionRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.common.messaging.notification.NotificationManager
protected DataFeedProcessExecutionRepository<com.broadleafcommerce.data.tracking.core.Trackable>
initializeNotificationStateAndEmitMessage
(String id, String messageType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Atomically finds theDataFeedProcessExecution
for the givenid
, and initializes itsNotificationState
formessageType
.org.springframework.data.domain.Page<P>
readAllByDataFeedProcessId
(String dataFeedProcessId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads theDataFeedProcessExecution
instances for the specified data feed process id.readByContextIdAndDataFeedProcessId
(String id, String dataFeedProcessId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads theDataFeedProcessExecution
by id and the data feed process id.readByContextIdOpt
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Similar toCrudEntityService.readByContextId(String, ContextInfo)
, but returns anOptional
instead of throwingEntityMissingException
when not found.setQueriedDataFileLocation
(String id, String queriedDataFileLocation, String whereCurrentStatus, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Atomically setsDataFeedProcessExecution.getQueriedDataFileLocation()
on the specified execution.setStatus
(String id, String newStatus, String whereCurrentStatus, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Atomically sets a newDataFeedProcessExecution.getStatus()
on the specified execution.setStatusAndCompletionDetails
(String id, String newStatus, Instant endTime, boolean containsErrors, List<String> errorDetails, String whereCurrentStatus, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Atomically sets a newDataFeedProcessExecution.getStatus()
and completion details on the specified execution.setStatusAndStartTime
(String id, String newStatus, Instant startTime, String whereCurrentStatus, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Atomically sets a newDataFeedProcessExecution.getStatus()
andDataFeedProcessExecution.getStartTime()
on the specified execution.Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAll, readAll
Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Constructor Details
-
DefaultDataFeedProcessExecutionService
public DefaultDataFeedProcessExecutionService(DataFeedProcessExecutionRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, @Nullable com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager)
-
-
Method Details
-
readByContextIdOpt
public Optional<P> readByContextIdOpt(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:DataFeedProcessExecutionService
Similar toCrudEntityService.readByContextId(String, ContextInfo)
, but returns anOptional
instead of throwingEntityMissingException
when not found.- Specified by:
readByContextIdOpt
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- an
Optional
containing the narrowed entity instance in the form of a business instance, elseOptional.empty()
-
readByContextIdAndDataFeedProcessId
public Optional<P> readByContextIdAndDataFeedProcessId(String id, String dataFeedProcessId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:DataFeedProcessExecutionService
Reads theDataFeedProcessExecution
by id and the data feed process id.- Specified by:
readByContextIdAndDataFeedProcessId
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- The context id for the entitydataFeedProcessId
- the data feed process idcontext
- context information around multitenant state- Returns:
- an
Optional
containing the narrowed entity instance in the form of a business instance, elseOptional.empty()
-
readAllByDataFeedProcessId
public org.springframework.data.domain.Page<P> readAllByDataFeedProcessId(String dataFeedProcessId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:DataFeedProcessExecutionService
Reads theDataFeedProcessExecution
instances for the specified data feed process id.- Specified by:
readAllByDataFeedProcessId
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
dataFeedProcessId
- the data feed process idfilters
- the RSQLNode
used to restrict resultpage
- the requested page of results from the databasecontext
- context information around multitenant state- Returns:
- the
DataFeedProcessExecution
instances for the specified data feed process id
-
initializeNotificationStateAndEmitMessage
@Nullable public P initializeNotificationStateAndEmitMessage(String id, String messageType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:DataFeedProcessExecutionService
Atomically finds theDataFeedProcessExecution
for the givenid
, and initializes itsNotificationState
formessageType
.If the update is successful, calls
NotificationManager.handle(NotificationStateRepository, NotificationStateAware, String)
for themessageType
, which will emit the message.- Specified by:
initializeNotificationStateAndEmitMessage
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- theDataFeedProcessExecution.getId()
for which to initialize and emit the messagemessageType
- the message type (ex:NotificationState.getName()
contextInfo
- context information around multitenant state- Returns:
- the updated
DataFeedProcessExecution
if successfully found and updated,null
otherwise
-
setStatus
@Nullable public P setStatus(String id, String newStatus, @Nullable String whereCurrentStatus, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:DataFeedProcessExecutionService
Atomically sets a newDataFeedProcessExecution.getStatus()
on the specified execution.- Specified by:
setStatus
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- the ID of the execution to updatenewStatus
- the new value to set forDataFeedProcessExecution.getStatus()
whereCurrentStatus
- (optional) if provided, the update will only be applied if the execution currently has this value for itsDataFeedProcessExecution.getStatus()
contextInfo
- context information around multitenant state- Returns:
- the updated execution if successfully updated, else
null
-
setStatusAndStartTime
@Nullable public P setStatusAndStartTime(String id, String newStatus, Instant startTime, @Nullable String whereCurrentStatus, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:DataFeedProcessExecutionService
Atomically sets a newDataFeedProcessExecution.getStatus()
andDataFeedProcessExecution.getStartTime()
on the specified execution.- Specified by:
setStatusAndStartTime
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- the ID of the execution to updatenewStatus
- the new value to set forDataFeedProcessExecution.getStatus()
startTime
- the value to set forDataFeedProcessExecution.getStartTime()
whereCurrentStatus
- (optional) if provided, the update will only be applied if the execution currently has this value for itsDataFeedProcessExecution.getStatus()
contextInfo
- context information around multitenant state- Returns:
- the updated execution if successfully updated, else
null
-
setStatusAndCompletionDetails
@Nullable public P setStatusAndCompletionDetails(String id, String newStatus, Instant endTime, boolean containsErrors, @Nullable List<String> errorDetails, @Nullable String whereCurrentStatus, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:DataFeedProcessExecutionService
Atomically sets a newDataFeedProcessExecution.getStatus()
and completion details on the specified execution.- Specified by:
setStatusAndCompletionDetails
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- the ID of the execution to updatenewStatus
- the new value to set forDataFeedProcessExecution.getStatus()
endTime
- the value to set forDataFeedProcessExecution.getEndTime()
containsErrors
- 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()
contextInfo
- context information around multitenant state- Returns:
- the updated execution if successfully updated, else
null
-
setQueriedDataFileLocation
@Nullable public P setQueriedDataFileLocation(String id, String queriedDataFileLocation, @Nullable String whereCurrentStatus, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:DataFeedProcessExecutionService
Atomically setsDataFeedProcessExecution.getQueriedDataFileLocation()
on the specified execution.- Specified by:
setQueriedDataFileLocation
in interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>
- Parameters:
id
- the ID of the execution to updatequeriedDataFileLocation
- the value to set forDataFeedProcessExecution.getQueriedDataFileLocation()
whereCurrentStatus
- (optional) if provided, the update will only be applied if the execution currently has this value for itsDataFeedProcessExecution.getStatus()
contextInfo
- context information around multitenant state- Returns:
- the updated execution if successfully updated, else
null
-
getProcessExecutionRepository
protected DataFeedProcessExecutionRepository<com.broadleafcommerce.data.tracking.core.Trackable> getProcessExecutionRepository() -
getNotificationManager
@Nullable protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()
-