Class JobHistoryHelper
- java.lang.Object
-
- org.nuxeo.ecm.platform.audit.api.job.JobHistoryHelper
-
public class JobHistoryHelper extends Object
Simple helper class to trace job execution using the Audit Service.- Author:
- Thierry Delprat
-
-
Field Summary
Fields Modifier and Type Field Description static StringJOB_ENDED_SUFFIXstatic StringJOB_FAILED_SUFFIXstatic StringJOB_STARTED_SUFFIXprotected StringjobEndedEventIdprotected StringjobFailedEventIdprotected StringjobNameprotected StringjobStartedEventIdprotected AuditLoggerlogger
-
Constructor Summary
Constructors Constructor Description JobHistoryHelper(String jobName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DategetLastFailedRun()Gets the last date the Job was failed.protected DategetLastRunWithStatus(String status)DategetLastStarted()Gets the last date the Job was started.DategetLastSuccessfulRun()Gets the last date the Job was successfully run.protected AuditLoggergetLogger()protected LogEntrygetNewLogEntry()voidlogJobEnded()Logs an event for a successful Job completion.voidlogJobFailed(String errMessage)Logs an event for a failed Job execution.voidlogJobStarted()Logs an event for Job startup.
-
-
-
Field Detail
-
JOB_STARTED_SUFFIX
public static final String JOB_STARTED_SUFFIX
- See Also:
- Constant Field Values
-
JOB_ENDED_SUFFIX
public static final String JOB_ENDED_SUFFIX
- See Also:
- Constant Field Values
-
JOB_FAILED_SUFFIX
public static final String JOB_FAILED_SUFFIX
- See Also:
- Constant Field Values
-
logger
protected AuditLogger logger
-
jobName
protected String jobName
-
jobStartedEventId
protected final String jobStartedEventId
-
jobEndedEventId
protected final String jobEndedEventId
-
jobFailedEventId
protected final String jobFailedEventId
-
-
Constructor Detail
-
JobHistoryHelper
public JobHistoryHelper(String jobName)
-
-
Method Detail
-
getNewLogEntry
protected LogEntry getNewLogEntry()
-
getLogger
protected AuditLogger getLogger()
-
logJobStarted
public void logJobStarted()
Logs an event for Job startup.
-
logJobEnded
public void logJobEnded()
Logs an event for a successful Job completion.
-
logJobFailed
public void logJobFailed(String errMessage)
Logs an event for a failed Job execution.
-
getLastSuccessfulRun
public Date getLastSuccessfulRun()
Gets the last date the Job was successfully run.
-
getLastFailedRun
public Date getLastFailedRun()
Gets the last date the Job was failed.
-
getLastStarted
public Date getLastStarted()
Gets the last date the Job was started.
-
-