java.lang.Object
org.springframework.batch.core.Entity
org.springframework.cloud.task.batch.listener.support.JobExecutionEvent
All Implemented Interfaces:
Serializable

public class JobExecutionEvent extends org.springframework.batch.core.Entity
This is a JobEvent DTO created so that a JobExecution can be serialized into Json without having to add mixins to an ObjectMapper.
Author:
Glenn Renfro
See Also:
  • Constructor Details

    • JobExecutionEvent

      public JobExecutionEvent()
    • JobExecutionEvent

      public JobExecutionEvent(org.springframework.batch.core.JobExecution original)
      Constructor for the StepExecution to initialize the DTO.
      Parameters:
      original - the StepExecution to build this DTO around.
  • Method Details

    • getJobParameters

      public JobParametersEvent getJobParameters()
    • getEndTime

      public LocalDateTime getEndTime()
    • setEndTime

      public void setEndTime(LocalDateTime endTime)
    • getStartTime

      public LocalDateTime getStartTime()
    • setStartTime

      public void setStartTime(LocalDateTime startTime)
    • getStatus

      public org.springframework.batch.core.BatchStatus getStatus()
    • setStatus

      public void setStatus(org.springframework.batch.core.BatchStatus status)
      Set the value of the status field.
      Parameters:
      status - the status to set
    • upgradeStatus

      public void upgradeStatus(org.springframework.batch.core.BatchStatus status)
      Upgrade the status field if the provided value is greater than the existing one. Clients using this method to set the status can be sure that they don't overwrite a failed status with an successful one.
      Parameters:
      status - the new status value
    • getJobId

      public Long getJobId()
      Convenience getter for for the id of the enclosing job. Useful for DAO implementations.
      Returns:
      the id of the enclosing job
    • getExitStatus

      public ExitStatus getExitStatus()
      Returns:
      the exitCode for the job.
    • setExitStatus

      public void setExitStatus(ExitStatus exitStatus)
      Parameters:
      exitStatus - the exit status for the job.
    • getJobInstance

      public JobInstanceEvent getJobInstance()
      Returns:
      the Job that is executing.
    • setJobInstance

      public void setJobInstance(JobInstanceEvent jobInstance)
    • getStepExecutions

      public Collection<StepExecutionEvent> getStepExecutions()
      Accessor for the step executions.
      Returns:
      the step executions that were registered
    • getExecutionContext

      public org.springframework.batch.item.ExecutionContext getExecutionContext()
      Returns the ExecutionContext for this execution. The content is expected to be persisted after each step completion (successful or not).
      Returns:
      the context
    • setExecutionContext

      public void setExecutionContext(org.springframework.batch.item.ExecutionContext executionContext)
      Sets the ExecutionContext for this execution.
      Parameters:
      executionContext - the context
    • getCreateTime

      public LocalDateTime getCreateTime()
      Returns:
      the time when this execution was created.
    • setCreateTime

      public void setCreateTime(LocalDateTime createTime)
      Parameters:
      createTime - creation time of this execution.
    • getLastUpdated

      public LocalDateTime getLastUpdated()
      Get the date representing the last time this JobExecution was updated in the JobRepository.
      Returns:
      Date representing the last time this JobExecution was updated.
    • setLastUpdated

      public void setLastUpdated(LocalDateTime lastUpdated)
      Set the last time this JobExecution was updated.
      Parameters:
      lastUpdated - The date the JobExecution was updated.
    • getFailureExceptions

      public List<Throwable> getFailureExceptions()
    • addFailureException

      public void addFailureException(Throwable t)
      Add the provided throwable to the failure exception list.
      Parameters:
      t - a Throwable to be added to the exception list.
    • getAllFailureExceptions

      public List<Throwable> getAllFailureExceptions()
      Return all failure causing exceptions for this JobExecution, including step executions.
      Returns:
      List<Throwable> containing all exceptions causing failure for this JobExecution.
    • toString

      public String toString()
      Overrides:
      toString in class org.springframework.batch.core.Entity