Class SimpleJobExplorer

java.lang.Object
org.springframework.batch.core.explore.support.SimpleJobExplorer
All Implemented Interfaces:
JobExplorer

public class SimpleJobExplorer extends Object implements JobExplorer
Implementation of JobExplorer that uses the injected DAOs.
Since:
2.0
Author:
Dave Syer, Lucas Ward, Michael Minella, Will Schipp, Mahmoud Ben Hassine
See Also:
  • Constructor Details

  • Method Details

    • getJobExecutions

      public List<JobExecution> getJobExecutions(JobInstance jobInstance)
      Description copied from interface: JobExplorer
      Retrieve job executions by their job instance. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, use JobExplorer.getStepExecution(Long, Long) to hydrate them.
      Specified by:
      getJobExecutions in interface JobExplorer
      Parameters:
      jobInstance - The JobInstance to query.
      Returns:
      the set of all executions for the specified JobInstance.
    • getLastJobExecution

      @Nullable public JobExecution getLastJobExecution(JobInstance jobInstance)
      Description copied from interface: JobExplorer
      Find the last JobExecution that has been created for a given JobInstance.
      Specified by:
      getLastJobExecution in interface JobExplorer
      Parameters:
      jobInstance - The JobInstance for which to find the last JobExecution.
      Returns:
      the last JobExecution that has been created for this instance or null if no job execution is found for the given job instance.
    • findRunningJobExecutions

      public Set<JobExecution> findRunningJobExecutions(@Nullable String jobName)
      Description copied from interface: JobExplorer
      Retrieve running job executions. The corresponding step executions may not be fully hydrated (for example, their execution context may be missing), depending on the implementation. In that case, use JobExplorer.getStepExecution(Long, Long) to hydrate them.
      Specified by:
      findRunningJobExecutions in interface JobExplorer
      Parameters:
      jobName - The name of the job.
      Returns:
      the set of running executions for jobs with the specified name.
    • getJobExecution

      @Nullable public JobExecution getJobExecution(@Nullable Long executionId)
      Description copied from interface: JobExplorer
      Retrieve a JobExecution by its ID. The complete object graph for this execution should be returned (unless otherwise indicated), including the parent JobInstance and associated ExecutionContext and StepExecution instances (also including their execution contexts).
      Specified by:
      getJobExecution in interface JobExplorer
      Parameters:
      executionId - The job execution ID.
      Returns:
      the JobExecution that has this ID or null if not found.
    • getStepExecution

      @Nullable public StepExecution getStepExecution(@Nullable Long jobExecutionId, @Nullable Long executionId)
      Description copied from interface: JobExplorer
      Retrieve a StepExecution by its ID and parent JobExecution ID. The execution context for the step should be available in the result, and the parent job execution should have its primitive properties, but it may not contain the job instance information.
      Specified by:
      getStepExecution in interface JobExplorer
      Parameters:
      jobExecutionId - The parent job execution ID.
      executionId - The step execution ID.
      Returns:
      the StepExecution that has this ID or null if not found.
      See Also:
    • getJobInstance

      @Nullable public JobInstance getJobInstance(@Nullable Long instanceId)
      Specified by:
      getJobInstance in interface JobExplorer
      Parameters:
      instanceId - Long The ID for the JobInstance to obtain.
      Returns:
      the JobInstance that has this ID, or null if not found.
    • getLastJobInstance

      @Nullable public JobInstance getLastJobInstance(String jobName)
      Description copied from interface: JobExplorer
      Find the last job instance, by ID, for the given job.
      Specified by:
      getLastJobInstance in interface JobExplorer
      Parameters:
      jobName - The name of the job.
      Returns:
      the last job instance by Id if any or null otherwise.
    • getJobInstances

      public List<JobInstance> getJobInstances(String jobName, int start, int count)
      Description copied from interface: JobExplorer
      Fetch JobInstance values in descending order of creation (and, therefore, usually, of first execution).
      Specified by:
      getJobInstances in interface JobExplorer
      Parameters:
      jobName - The name of the job to query.
      start - The start index of the instances to return.
      count - The maximum number of instances to return.
      Returns:
      the JobInstance values up to a maximum of count values.
    • getJobNames

      public List<String> getJobNames()
      Description copied from interface: JobExplorer
      Query the repository for all unique JobInstance names (sorted alphabetically).
      Specified by:
      getJobNames in interface JobExplorer
      Returns:
      the set of job names that have been executed.
    • getJobInstanceCount

      public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException
      Description copied from interface: JobExplorer
      Query the repository for the number of unique JobInstance objects associated with the supplied job name.
      Specified by:
      getJobInstanceCount in interface JobExplorer
      Parameters:
      jobName - The name of the job for which to query.
      Returns:
      the number of JobInstances that exist within the associated job repository.
      Throws:
      NoSuchJobException - thrown when there is no JobInstance for the jobName specified.
    • findJobInstancesByJobName

      public List<JobInstance> findJobInstancesByJobName(String jobName, int start, int count)
      Description copied from interface: JobExplorer
      Fetch JobInstance values in descending order of creation (and, therefore, usually of first execution) with a 'like' or wildcard criteria.
      Specified by:
      findJobInstancesByJobName in interface JobExplorer
      Parameters:
      jobName - The name of the job for which to query.
      start - The start index of the instances to return.
      count - The maximum number of instances to return.
      Returns:
      a list of JobInstance for the requested job name.