@SuppressWarnings("unchecked")
@Override
public void execute(ActionMessagePrinter printer)
throws CmdLineActionException {
try {
XmlRpcWorkflowManagerClient client = getClient();
WorkflowInstancePage page = null;
if (status != null && !status.equals("")) {
WorkflowInstancePage firstPage = client.paginateWorkflowInstances(
1, status);
page = client.paginateWorkflowInstances(firstPage.getTotalPages(),
status);
} else {
page = client.getLastPage();
}
printer.println("Page: [num=" + page.getPageNum() + ","
+ "pageSize=" + page.getPageSize() + ",totalPages="
+ page.getTotalPages() + "]");
if (page.getPageWorkflows() == null) {
throw new Exception(
"WorkflowManager returned null page of workflows");
}
for (WorkflowInstance inst : (List<WorkflowInstance>) page
.getPageWorkflows()) {
printer.println("Instance: [id=" + inst.getId() + ", status="
+ inst.getStatus() + ", currentTask="
+ inst.getCurrentTaskId() + ", workflow="
+ inst.getWorkflow().getName() + ",wallClockTime="
+ client.getWorkflowWallClockMinutes(inst.getId())
+ ",currentTaskWallClockTime="
+ client.getWorkflowCurrentTaskWallClockMinutes(inst.getId())
+ "]");
}
} catch (Exception e) {
throw new CmdLineActionException(
"Failed to get last page of workflows with " + "status '"