Interface CustomizedScheduledJobRepository<D>
-
- All Known Subinterfaces:
JpaScheduledJobRepository<D>,ScheduledJobRepository<D>
- All Known Implementing Classes:
JpaCustomizedScheduledJobRepository
public interface CustomizedScheduledJobRepository<D>Repository fragment supporting additional persistence functionality related toScheduledJob- Author:
- Jeff Fischer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DestablishTriggerStateIfApplicable(String contextId)Establish theNotificationStateAwarecontract forTriggeredJobEventProducer.TYPE.Optional<D>findByContextIdIgnoringNarrowing(String contextId)Retrieves the job whoseScheduledJob#contextIdmatches the one supplied.DmarkJobAsExecuted(String contextId, TimingType timingType)Mark a job as executed viaScheduledJob.isExecuted().Optional<D>resetNotificationStateByNameAndJobDetailsContaining(String notificationStateToReset, String detailName, Object detailValue)Finds the job whoseScheduledJob.detailscontains aScheduledJobDetailwith the givenScheduledJobDetail.nameandScheduledJobDetail#value, and resets the notification state with the matching name.Stream<D>streamAll(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Read a stream of all ScheduledJobs in the data store.
-
-
-
Method Detail
-
streamAll
@NonNull @Policy(operationTypes=READ) Stream<D> streamAll(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Read a stream of all ScheduledJobs in the data store.- Parameters:
contextInfo- context information surrounding multitenant state- Returns:
- a stream of all ScheduledJobs in the data store
-
establishTriggerStateIfApplicable
@NonNull D establishTriggerStateIfApplicable(@NonNull String contextId)
Establish theNotificationStateAwarecontract forTriggeredJobEventProducer.TYPE. This should initialize the basic support for a trigger typeNotificationStateitem in theNotificationStateAware.getNotificationStates()list. This state is generally completed during themarkJobAsExecuted(String, TimingType)lifecycle.- Parameters:
contextId- The tracking identifier for the scheduled job- Returns:
- The initialized entity instance
-
markJobAsExecuted
@Nullable D markJobAsExecuted(@NonNull String contextId, @NonNull TimingType timingType)
Mark a job as executed viaScheduledJob.isExecuted(). As part of an atomic operation, this method should also set theScheduledJob.getLastExecuted()field and disable the job viaScheduledJob.isEnabled()if the job is ofTimingType.TARGET_DATE. Finally, theNotificationStateof typeTriggeredJobEventProducer.TYPEshould be configured to start the resiliency lifecycle. SeeNotificationStatefor more information on the fields there related to messaging resiliency.- Parameters:
contextId- The tracking identifier for the scheduled jobtimingType- The type of job (e.g. whether it's recurring cron or single use)- Returns:
- the updated job if found and successfully updated, otherwise
null. For example, if another process had already updated the record as being executed, this update would not succeed.
-
resetNotificationStateByNameAndJobDetailsContaining
@NonNull Optional<D> resetNotificationStateByNameAndJobDetailsContaining(@NonNull String notificationStateToReset, String detailName, Object detailValue)
Finds the job whoseScheduledJob.detailscontains aScheduledJobDetailwith the givenScheduledJobDetail.nameandScheduledJobDetail#value, and resets the notification state with the matching name.- Parameters:
detailName- theScheduledJobDetail.namethat the detail should havedetailValue- theScheduledJobDetail#valuethat the detail should have- Returns:
- an
Optionalcontaining the updated job if updated,Optional.empty()otherwise
-
findByContextIdIgnoringNarrowing
@NonNull Optional<D> findByContextIdIgnoringNarrowing(@NonNull String contextId)
Retrieves the job whoseScheduledJob#contextIdmatches the one supplied. UnlikeTrackableRepository.findByContextId(String, ContextInfo), the results are not filtered by narrowing and thus even previously "deleted" results can be returned by this method.This functionality is useful for
DeploymentJobUnschedulingRequestListener, which requires access to the deleted record for proper notification behavior.- Parameters:
contextId- the context ID of the job to find- Returns:
- an
Optionalcontaining the job if found,Optional.empty()otherwise
-
-