Class QuartzService

java.lang.Object
io.jmix.quartz.service.QuartzService

@Service("quartz_QuartzService") public class QuartzService extends Object
Serves as proxy from Jmix to the Quartz engine for fetch information about jobs and triggers and update them
  • Field Details

  • Constructor Details

    • QuartzService

      public QuartzService()
  • Method Details

    • getAllJobs

      public List<JobModel> getAllJobs()
      Returns information about all configured quartz jobs with related triggers
    • updateQuartzJob

      @Transactional(rollbackForClassName="Exception") public void updateQuartzJob(JobModel jobModel, List<JobDataParameterModel> jobDataParameterModels, List<TriggerModel> triggerModels, boolean replaceJobIfExists)
      Updates job in the Quartz engine
      Parameters:
      jobModel - job to edit
      jobDataParameterModels - parameters for job
      triggerModels - triggers for job
      replaceJobIfExists - replace if job with the same name already exists
    • resumeJob

      public void resumeJob(String jobName, String jobGroup)
      Delegates to the Quartz engine resuming given job. This operation makes sense only for job with paused triggers.
      Parameters:
      jobName - name of the job
      jobGroup - group of the job
    • pauseJob

      public void pauseJob(String jobName, String jobGroup)
      Delegates to the Quartz engine pausing given job. This operation makes sense only for jobs with active triggers.
      Parameters:
      jobName - name of the job
      jobGroup - group of the job
    • executeNow

      public void executeNow(String jobName, String jobGroup)
      Delegates to the Quartz engine triggering given job (executing now)
      Parameters:
      jobName - name of the job
      jobGroup - group of the job
    • deleteJob

      public void deleteJob(String jobName, String jobGroup)
      Delegates to the Quartz engine deleting given job
      Parameters:
      jobName - name of the job
      jobGroup - group of the job
    • checkJobExists

      public boolean checkJobExists(String jobName, String jobGroup)
      Delegates to the Quartz engine determination if the given job exists
      Parameters:
      jobName - name of the job
      jobGroup - group of the job
      Returns:
      true if job with provided name and group exists, false otherwise
    • checkTriggerExists

      public boolean checkTriggerExists(String triggerName, String triggerGroup)
      Delegates to the Quartz engine determination if the given trigger exists
      Parameters:
      triggerName - name of the trigger
      triggerGroup - group of the trigger
      Returns:
      true if trigger with provided name and group exists, false otherwise
    • resolveJobDetail

      public @Nullable org.quartz.JobDetail resolveJobDetail(org.quartz.JobKey jobKey)
      Fetches the JobDetail for the given key. Returns an InvalidJobDetail when the job class is missing, or null when the detail cannot be fetched.
    • isJobRunning

      public boolean isJobRunning(org.quartz.JobKey jobKey)
      Checks if provided job is running
    • getDisplayedClassName

      public String getDisplayedClassName(org.quartz.JobDetail jobDetail)
    • getDataParamsOfJob

      public List<JobDataParameterModel> getDataParamsOfJob(org.quartz.JobKey jobKey)
      Returns given job's parameters
      Parameters:
      jobKey - key of job
      Returns:
      parameters of given job
    • getJobGroupNames

      public List<String> getJobGroupNames()
      Returns names of all known JobDetail groups
    • getTriggerGroupNames

      public List<String> getTriggerGroupNames()
      Returns names of all known Trigger groups
    • createJobModel

      protected JobModel createJobModel(org.quartz.JobKey jobKey, org.quartz.JobDetail jobDetail, List<org.quartz.JobKey> jobDetailsKeys) throws org.quartz.SchedulerException
      Throws:
      org.quartz.SchedulerException
    • createTriggerModel

      protected TriggerModel createTriggerModel(org.quartz.Trigger trigger, Date now)
    • resolveJobState

      protected JobState resolveJobState(org.quartz.JobKey jobKey, org.quartz.JobDetail jobDetail, boolean active, boolean hasBlockedTrigger)
    • isJobRunningWithinCurrentScheduler

      protected boolean isJobRunningWithinCurrentScheduler(org.quartz.JobKey jobKey)
    • resolveMisfireInstructionId

      protected String resolveMisfireInstructionId(org.quartz.Trigger trigger)
    • buildJobDetail

      protected org.quartz.JobDetail buildJobDetail(JobModel jobModel, @Nullable org.quartz.JobDetail existedJobDetail, List<JobDataParameterModel> jobDataParameterModels) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • buildTrigger

      protected org.quartz.Trigger buildTrigger(org.quartz.JobDetail jobDetail, TriggerModel triggerModel)
    • setupSchedule

      protected void setupSchedule(org.quartz.TriggerBuilder<org.quartz.Trigger> triggerBuilder, TriggerModel triggerModel)
    • setupTriggerActivityDates

      protected void setupTriggerActivityDates(org.quartz.TriggerBuilder<org.quartz.Trigger> triggerBuilder, TriggerModel triggerModel)
    • buildCronSchedule

      protected org.quartz.CronScheduleBuilder buildCronSchedule(TriggerModel triggerModel)
    • buildSimpleSchedule

      protected org.quartz.SimpleScheduleBuilder buildSimpleSchedule(TriggerModel triggerModel)
    • logMissingMisfireInstruction

      protected void logMissingMisfireInstruction(String misfireInstructionId)