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:
-
Constructor Summary
ConstructorDescriptionJobExecutionEvent
(org.springframework.batch.core.JobExecution original) Constructor for the StepExecution to initialize the DTO. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the provided throwable to the failure exception list.Return all failure causing exceptions for this JobExecution, including step executions.org.springframework.batch.item.ExecutionContext
Returns theExecutionContext
for this execution.getJobId()
Convenience getter for for the id of the enclosing job.Get the date representing the last time this JobExecution was updated in the JobRepository.org.springframework.batch.core.BatchStatus
Accessor for the step executions.void
setCreateTime
(LocalDateTime createTime) void
setEndTime
(LocalDateTime endTime) void
setExecutionContext
(org.springframework.batch.item.ExecutionContext executionContext) Sets theExecutionContext
for this execution.void
setExitStatus
(ExitStatus exitStatus) void
setJobInstance
(JobInstanceEvent jobInstance) void
setLastUpdated
(LocalDateTime lastUpdated) Set the last time thisJobExecution
was updated.void
setStartTime
(LocalDateTime startTime) void
setStatus
(org.springframework.batch.core.BatchStatus status) Set the value of the status field.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
-
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
-
getEndTime
-
setEndTime
-
getStartTime
-
setStartTime
-
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
Convenience getter for for the id of the enclosing job. Useful for DAO implementations.- Returns:
- the id of the enclosing job
-
getExitStatus
- Returns:
- the exitCode for the job.
-
setExitStatus
- Parameters:
exitStatus
- the exit status for the job.
-
getJobInstance
- Returns:
- the Job that is executing.
-
setJobInstance
-
getStepExecutions
Accessor for the step executions.- Returns:
- the step executions that were registered
-
getExecutionContext
public org.springframework.batch.item.ExecutionContext getExecutionContext()Returns theExecutionContext
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 theExecutionContext
for this execution.- Parameters:
executionContext
- the context
-
getCreateTime
- Returns:
- the time when this execution was created.
-
setCreateTime
- Parameters:
createTime
- creation time of this execution.
-
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
Set the last time thisJobExecution
was updated.- Parameters:
lastUpdated
- The date theJobExecution
was updated.
-
getFailureExceptions
-
addFailureException
Add the provided throwable to the failure exception list.- Parameters:
t
- aThrowable
to be added to the exception list.
-
getAllFailureExceptions
Return all failure causing exceptions for this JobExecution, including step executions.- Returns:
- List<Throwable> containing all exceptions causing failure for this JobExecution.
-
toString
- Overrides:
toString
in classorg.springframework.batch.core.Entity
-