*
* @param applications the applications
* @return the application report table
*/
private static Table getApplicationReportTable(List<ApplicationReport> applications) {
Table table = new Table();
table.addHeader(1, new TableHeader("Id"))
.addHeader(2, new TableHeader("User"))
.addHeader(3, new TableHeader("Name"))
.addHeader(4, new TableHeader("Queue"))
.addHeader(5, new TableHeader("StartTime"))
.addHeader(6, new TableHeader("FinishTime"))
.addHeader(7, new TableHeader("State"))
.addHeader(8, new TableHeader("FinalStatus"));
for (ApplicationReport a : applications) {
final TableRow row = new TableRow();
row.addValue(1, a.getApplicationId().toString())
.addValue(2, a.getUser())
.addValue(3, a.getName())
.addValue(4, a.getQueue())
.addValue(5, DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(
new Date(a.getStartTime())))
.addValue(6, DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(
new Date(a.getFinishTime())))
.addValue(7, a.getYarnApplicationState().toString())
.addValue(8, a.getFinalApplicationStatus().toString());
table.getRows().add(row);
}
return table;
}