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 String
JOB_ENDED_SUFFIX
static String
JOB_FAILED_SUFFIX
static String
JOB_STARTED_SUFFIX
protected String
jobEndedEventId
protected String
jobFailedEventId
protected String
jobName
protected String
jobStartedEventId
protected AuditLogger
logger
-
Constructor Summary
Constructors Constructor Description JobHistoryHelper(String jobName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Date
getLastFailedRun()
Gets the last date the Job was failed.protected Date
getLastRunWithStatus(String status)
Date
getLastStarted()
Gets the last date the Job was started.Date
getLastSuccessfulRun()
Gets the last date the Job was successfully run.protected AuditLogger
getLogger()
protected LogEntry
getNewLogEntry()
void
logJobEnded()
Logs an event for a successful Job completion.void
logJobFailed(String errMessage)
Logs an event for a failed Job execution.void
logJobStarted()
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.
-
-