else if (operation.equals("--getFirstPage")) {
XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
new URL(url));
WorkflowInstancePage page = null;
String status = null;
for (int i = 4; i < args.length; i++) {
if (args[i].equals("--status")) {
status = args[++i];
}
}
try {
if (status != null && !status.equals("")) {
page = client.paginateWorkflowInstances(1, status);
} else {
page = client.getFirstPage();
}
System.out.println("Page: [num=" + page.getPageNum() + ","
+ "pageSize=" + page.getPageSize() + ",totalPages="
+ page.getTotalPages() + "]");
if (page.getPageWorkflows() != null
&& page.getPageWorkflows().size() > 0) {
for (Iterator i = page.getPageWorkflows().iterator(); i
.hasNext();) {
WorkflowInstance inst = (WorkflowInstance) i.next();
System.out
.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 RuntimeException(e);
}
} else if (operation.equals("--getLastPage")) {
XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
new URL(url));
WorkflowInstancePage page = null;
String status = null;
for (int i = 4; i < args.length; i++) {
if (args[i].equals("--status")) {
status = args[++i];
}
}
try {
if (status != null && !status.equals("")) {
WorkflowInstancePage firstPage = client
.paginateWorkflowInstances(1, status);
page = client.paginateWorkflowInstances(firstPage
.getTotalPages(), status);
} else {
page = client.getLastPage();
}
System.out.println("Page: [num=" + page.getPageNum() + ","
+ "pageSize=" + page.getPageSize() + ",totalPages="
+ page.getTotalPages() + "]");
if (page.getPageWorkflows() != null
&& page.getPageWorkflows().size() > 0) {
for (Iterator i = page.getPageWorkflows().iterator(); i
.hasNext();) {
WorkflowInstance inst = (WorkflowInstance) i.next();
System.out
.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 RuntimeException(e);
}
} else if (operation.equals("--getNextPage")) {
XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
new URL(url));
WorkflowInstancePage page = null;
String status = null;
int pageNum = -1;
for (int i = 4; i < args.length; i++) {
if (args[i].equals("--status")) {
status = args[++i];
} else if (args[i].equals("--pageNum")) {
pageNum = Integer.parseInt(args[++i]);
}
}
if (pageNum == -1) {
System.err.println(getNextPageOperation);
System.exit(1);
}
try {
if (status != null && !status.equals("")) {
page = client
.paginateWorkflowInstances(pageNum + 1, status);
} else {
page = client.paginateWorkflowInstances(pageNum + 1);
}
System.out.println("Page: [num=" + page.getPageNum() + ","
+ "pageSize=" + page.getPageSize() + ",totalPages="
+ page.getTotalPages() + "]");
if (page.getPageWorkflows() != null
&& page.getPageWorkflows().size() > 0) {
for (Iterator i = page.getPageWorkflows().iterator(); i
.hasNext();) {
WorkflowInstance inst = (WorkflowInstance) i.next();
System.out
.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 RuntimeException(e);
}
} else if (operation.equals("--getPrevPage")) {
XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
new URL(url));
WorkflowInstancePage page = null;
String status = null;
int pageNum = -1;
for (int i = 4; i < args.length; i++) {
if (args[i].equals("--status")) {
status = args[++i];
} else if (args[i].equals("--pageNum")) {
pageNum = Integer.parseInt(args[++i]);
}
}
if (pageNum == -1) {
System.err.println(getPrevPageOperation);
System.exit(1);
}
try {
if (status != null && !status.equals("")) {
page = client
.paginateWorkflowInstances(pageNum - 1, status);
} else {
page = client.paginateWorkflowInstances(pageNum - 1);
}
System.out.println("Page: [num=" + page.getPageNum() + ","
+ "pageSize=" + page.getPageSize() + ",totalPages="
+ page.getTotalPages() + "]");
if (page.getPageWorkflows() != null
&& page.getPageWorkflows().size() > 0) {
for (Iterator i = page.getPageWorkflows().iterator(); i
.hasNext();) {
WorkflowInstance inst = (WorkflowInstance) i.next();
System.out
.println("Instance: [id="
+ inst.getId()