From 4d1ec71c790e467ecae184df01abf825f94d1dc3 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 13 Nov 2013 12:00:06 -0500 Subject: Added paging on all find commands. The find commands in some REST services have been modified to support paging to be consistent with others. The other find commands have been cleaned up as well. --- .../src/com/netscape/cmstools/key/KeyFindCLI.java | 16 +++++++++++++++- .../src/com/netscape/cmstools/key/KeyRequestFindCLI.java | 6 +++--- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'base/java-tools/src/com/netscape/cmstools/key') diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java index 9a91f37e2..25fe6af3c 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyFindCLI.java @@ -63,6 +63,14 @@ public class KeyFindCLI extends CLI { option.setArgName("max time"); options.addOption(option); + option = new Option(null, "start", true, "Page start"); + option.setArgName("start"); + options.addOption(option); + + option = new Option(null, "size", true, "Page size"); + option.setArgName("size"); + options.addOption(option); + CommandLine cmd = null; try { @@ -83,7 +91,13 @@ public class KeyFindCLI extends CLI { s = cmd.getOptionValue("maxTime"); Integer maxTime = s == null ? null : Integer.valueOf(s); - KeyDataInfos keys = keyCLI.keyClient.findKeys(clientID, status, maxResults, maxTime); + s = cmd.getOptionValue("start"); + Integer start = s == null ? null : Integer.valueOf(s); + + s = cmd.getOptionValue("size"); + Integer size = s == null ? null : Integer.valueOf(s); + + KeyDataInfos keys = keyCLI.keyClient.findKeys(clientID, status, maxResults, maxTime, start, size); Collection entries = keys.getKeyInfos(); diff --git a/base/java-tools/src/com/netscape/cmstools/key/KeyRequestFindCLI.java b/base/java-tools/src/com/netscape/cmstools/key/KeyRequestFindCLI.java index d74a2c2f1..5ed2bf729 100644 --- a/base/java-tools/src/com/netscape/cmstools/key/KeyRequestFindCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/key/KeyRequestFindCLI.java @@ -106,10 +106,10 @@ public class KeyRequestFindCLI extends CLI { KeyRequestInfos keys = keyCLI.keyClient.findKeyRequests( status, type, clientID, start, pageSize, maxResults, maxTime); - Collection entries = keys.getRequests(); - - MainCLI.printMessage(entries.size() + " key request(s) matched"); + MainCLI.printMessage(keys.getTotal() + " entries matched"); + if (keys.getTotal() == 0) return; + Collection entries = keys.getEntries(); boolean first = true; for (KeyRequestInfo info : entries) { -- cgit