From 954d09160c9e6833ad16743165ee7c3e4940a7ac Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Sat, 16 Dec 2017 01:07:35 +0530 Subject: Add getNoOfRows in Results object Issue-ID: CLI-66 Change-Id: I89fa87019c63504e8f8ceb4f052f12e62941bc3a Signed-off-by: Kanagaraj Manickam k00365106 --- .../main/java/org/onap/cli/fw/output/OnapCommandResult.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'framework/src') diff --git a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java index 3544fd7c..0b9f9be7 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java +++ b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java @@ -171,6 +171,17 @@ public class OnapCommandResult { this.isDebug = isDebug; } + public int getNumberOfRows() { + int noOfRecords = 0; + + for (OnapCommandResultAttribute cols : this.records) { + if (cols != null && noOfRecords < cols.getValues().size()) { + noOfRecords = cols.getValues().size(); + } + } + + return noOfRecords; + } /** * Helps to print the result based on the type. * -- cgit 1.2.3-korg