public String display(
@CliOption(mandatory = true, key = { "", "id" }, help = "the id of the job execution") long jobExecutionId) {
final JobExecutionInfoResource jobExecutionInfoResource = jobOperations().displayJobExecution(jobExecutionId);
final Table jobExecutionTable = new Table();
jobExecutionTable.addHeader(1, new TableHeader("Property"))
.addHeader(2, new TableHeader("Value"));
final StringBuilder details = new StringBuilder();
details.append("Job Execution Details:\n");
details.append(UiUtils.HORIZONTAL_LINE);
final String localCreateTime = this.configuration.getLocalTime(jobExecutionInfoResource.getJobExecution().getCreateTime());
final String localStartTime = this.configuration.getLocalTime(jobExecutionInfoResource.getJobExecution().getStartTime());
final Date endTimeDate = jobExecutionInfoResource.getJobExecution().getEndTime();
final String localEndTime = (endTimeDate == null) ? "" : this.configuration.getLocalTime(endTimeDate);
jobExecutionTable.addRow("Job Execution ID", String.valueOf(jobExecutionInfoResource.getExecutionId()))
.addRow("Job Name", jobExecutionInfoResource.getName())
.addRow("Create Time", localCreateTime)
.addRow("Start Time", localStartTime)
.addRow("End Time", localEndTime)
.addRow("Running", String.valueOf(jobExecutionInfoResource.getJobExecution().isRunning()))
.addRow("Stopping", String.valueOf(jobExecutionInfoResource.getJobExecution().isStopping()))
.addRow("Step Execution Count", String.valueOf(jobExecutionInfoResource.getStepExecutionCount()))
.addRow("Execution Status", jobExecutionInfoResource.getJobExecution().getStatus().name());
details.append(jobExecutionTable);
details.append(UiUtils.HORIZONTAL_LINE);
details.append("Job Parameters:\n");
details.append(UiUtils.HORIZONTAL_LINE);
if (jobExecutionInfoResource.getJobExecution().getJobParameters().isEmpty()) {
details.append("No Job Parameters are present");
}
else {
final Table jobParameterTable = new Table();
jobParameterTable.addHeader(1, new TableHeader("Name"))
.addHeader(2, new TableHeader("Value"))
.addHeader(3, new TableHeader("Type"))
.addHeader(4, new TableHeader("Identifying"));
for (Map.Entry<String, JobParameter> jobParameterEntry : jobExecutionInfoResource.getJobExecution().getJobParameters().getParameters().entrySet()) {
jobParameterTable.addRow(jobParameterEntry.getKey(),
jobParameterEntry.getValue().getValue().toString(),
jobParameterEntry.getValue().getType().name(),
String.valueOf(jobParameterEntry.getValue().isIdentifying()));
}