Package org.springframework.cloud.task.batch.listener.support

# Class JobExecutionEvent

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:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JobExecutionEvent()`
  `JobExecutionEvent(org.springframework.batch.core.JobExecution original)`
  Constructor for the StepExecution to initialize the DTO.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFailureException(Throwable t)`
  Add the provided throwable to the failure exception list.
  `List<Throwable>`
  `getAllFailureExceptions()`
  Return all failure causing exceptions for this JobExecution, including step executions.
  `Date`
  `getCreateTime()`
  `Date`
  `getEndTime()`
  `org.springframework.batch.item.ExecutionContext`
  `getExecutionContext()`
  Returns the `ExecutionContext` for this execution.
  `ExitStatus`
  `getExitStatus()`
  `List<Throwable>`
  `getFailureExceptions()`
  `Long`
  `getJobId()`
  Convenience getter for for the id of the enclosing job.
  `JobInstanceEvent`
  `getJobInstance()`
  `JobParametersEvent`
  `getJobParameters()`
  `Date`
  `getLastUpdated()`
  Get the date representing the last time this JobExecution was updated in the JobRepository.
  `Date`
  `getStartTime()`
  `org.springframework.batch.core.BatchStatus`
  `getStatus()`
  `Collection<StepExecutionEvent>`
  `getStepExecutions()`
  Accessor for the step executions.
  `void`
  `setCreateTime(Date createTime)`
  `void`
  `setEndTime(Date endTime)`
  `void`
  `setExecutionContext(org.springframework.batch.item.ExecutionContext executionContext)`
  Sets the `ExecutionContext` for this execution.
  `void`
  `setExitStatus(ExitStatus exitStatus)`
  `void`
  `setJobInstance(JobInstanceEvent jobInstance)`
  `void`
  `setLastUpdated(Date lastUpdated)`
  Set the last time this `JobExecution` was updated.
  `void`
  `setStartTime(Date startTime)`
  `void`
  `setStatus(org.springframework.batch.core.BatchStatus status)`
  Set the value of the status field.
  `String`
  `toString()`
  `void`
  `upgradeStatus(org.springframework.batch.core.BatchStatus status)`
  Upgrade the status field if the provided value is greater than the existing one.

  ### Methods inherited from class org.springframework.batch.core.Entity

  `equals, getId, getVersion, hashCode, incrementVersion, setId, setVersion`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## 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 Date getEndTime()

  - ### setEndTime

    public void setEndTime(Date endTime)

  - ### getStartTime

    public Date getStartTime()

  - ### setStartTime

    public void setStartTime(Date 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 Date getCreateTime()
    Returns:
      the time when this execution was created.

  - ### setCreateTime

    public void setCreateTime(Date createTime)
    Parameters:
      `createTime` - creation time of this execution.

  - ### getLastUpdated

    public Date 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(Date 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`