Class DefaultScheduledJobService<P extends ScheduledJob>

  • All Implemented Interfaces:
    com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>, ScheduledJobService<P>

    public class DefaultScheduledJobService<P extends ScheduledJob>
    extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
    implements ScheduledJobService<P>
    Author:
    Chad Harchar (charchar)
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultScheduledJobService​(ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      P establishTriggerStateIfApplicable​(String contextId)
      Establish the NotificationStateAware contract for TriggeredJobEventProducer.TYPE.
      P executeJob​(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Causes the specified ScheduledJob to be executed immediately.
      protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()  
      protected ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()  
      P markJobAsExecuted​(String contextId, TimingType timingType)
      Mark a job as executed via ScheduledJob.isExecuted().
      org.springframework.data.domain.Page<P> readAllByName​(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read a page of job records focusing on name (optional)
      P replace​(String id, P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)  
      protected P resetUnmodifiableFieldsToOriginalValues​(String id, P scheduledJob, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)  
      Stream<P> streamAll​(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read a stream of all ScheduledJobs in the data store.
      • 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, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

        create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

        readAll, readAll, readAll, readAll
    • Constructor Detail

      • DefaultScheduledJobService

        public DefaultScheduledJobService​(ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository,
                                          com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper,
                                          com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager)
    • Method Detail

      • streamAll

        @NonNull
        public Stream<P> streamAll​(@Nullable
                                   com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: ScheduledJobService
        Read a stream of all ScheduledJobs in the data store.
        Specified by:
        streamAll in interface ScheduledJobService<P extends ScheduledJob>
        Parameters:
        contextInfo - context information surrounding multitenant state
        Returns:
        a stream of all ScheduledJobs in the data store
      • readAllByName

        @NonNull
        public org.springframework.data.domain.Page<P> readAllByName​(@Nullable
                                                                     String name,
                                                                     @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: ScheduledJobService
        Read a page of job records focusing on name (optional)
        Specified by:
        readAllByName in interface ScheduledJobService<P extends ScheduledJob>
        Parameters:
        name - The name of the job to retrieve (optional)
        filters - Any additional search filters to apply
        page - The configuration for the page of records to retrieve
        context - The fetch view context
        Returns:
        The page of records
      • replace

        public P replace​(@NonNull
                         String id,
                         @NonNull
                         P businessInstance,
                         @Nullable
                         com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Specified by:
        replace in interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P extends ScheduledJob>
        Overrides:
        replace in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends ScheduledJob>
      • executeJob

        public P executeJob​(@NonNull
                            String id,
                            @Nullable
                            com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Description copied from interface: ScheduledJobService
        Causes the specified ScheduledJob to be executed immediately.
        Specified by:
        executeJob in interface ScheduledJobService<P extends ScheduledJob>
        Parameters:
        id - The identifier for the scheduled job
        context - context information surrounding multitenant state
        Returns:
        The job that was executed
      • resetUnmodifiableFieldsToOriginalValues

        protected P resetUnmodifiableFieldsToOriginalValues​(String id,
                                                            P scheduledJob,
                                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      • getRepository

        @NonNull
        protected ScheduledJobRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
        Overrides:
        getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends ScheduledJob>
      • getNotificationManager

        @NonNull
        protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()