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
ConstructorsConstructorDescriptionDefaultDataFeedProcessExecutionService(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.NotificationManagerprotected DataFeedProcessExecutionRepository<com.broadleafcommerce.data.tracking.core.Trackable>initializeNotificationStateAndEmitMessage(String id, String messageType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Atomically finds theDataFeedProcessExecutionfor the givenid, and initializes itsNotificationStateformessageType.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 theDataFeedProcessExecutioninstances for the specified data feed process id.readByContextIdAndDataFeedProcessId(String id, String dataFeedProcessId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads theDataFeedProcessExecutionby 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 anOptionalinstead of throwingEntityMissingExceptionwhen 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, readAllMethods 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, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, updateSortMethods 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:DataFeedProcessExecutionServiceSimilar toCrudEntityService.readByContextId(String, ContextInfo), but returns anOptionalinstead of throwingEntityMissingExceptionwhen not found.- Specified by:
readByContextIdOptin 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
Optionalcontaining 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:DataFeedProcessExecutionServiceReads theDataFeedProcessExecutionby id and the data feed process id.- Specified by:
readByContextIdAndDataFeedProcessIdin interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>- Parameters:
id- The context id for the entitydataFeedProcessId- the data feed process idcontext- context information around multitenant state- Returns:
- an
Optionalcontaining 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:DataFeedProcessExecutionServiceReads theDataFeedProcessExecutioninstances for the specified data feed process id.- Specified by:
readAllByDataFeedProcessIdin interfaceDataFeedProcessExecutionService<P extends DataFeedProcessExecution>- Parameters:
dataFeedProcessId- the data feed process idfilters- the RSQLNodeused to restrict resultpage- the requested page of results from the databasecontext- context information around multitenant state- Returns:
- the
DataFeedProcessExecutioninstances 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:DataFeedProcessExecutionServiceAtomically finds theDataFeedProcessExecutionfor the givenid, and initializes itsNotificationStateformessageType.If the update is successful, calls
NotificationManager.handle(NotificationStateRepository, NotificationStateAware, String)for themessageType, which will emit the message.- Specified by:
initializeNotificationStateAndEmitMessagein 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
DataFeedProcessExecutionif successfully found and updated,nullotherwise
-
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:DataFeedProcessExecutionServiceAtomically sets a newDataFeedProcessExecution.getStatus()on the specified execution.- Specified by:
setStatusin 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:DataFeedProcessExecutionServiceAtomically sets a newDataFeedProcessExecution.getStatus()andDataFeedProcessExecution.getStartTime()on the specified execution.- Specified by:
setStatusAndStartTimein 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:DataFeedProcessExecutionServiceAtomically sets a newDataFeedProcessExecution.getStatus()and completion details on the specified execution.- Specified by:
setStatusAndCompletionDetailsin 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:DataFeedProcessExecutionServiceAtomically setsDataFeedProcessExecution.getQueriedDataFileLocation()on the specified execution.- Specified by:
setQueriedDataFileLocationin 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()
-