From dff791d6bdd93ee5127094248f5e3cbc0d529653 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 16 Nov 2006 01:32:41 +0000
Subject: [PATCH] Update the ldapsearch tool to provide a --countEntries option that can be used to count the number of matching entries.  The count will be displayed as a comment at the end of the results, and will also be used as the exit code for the tool.  This addresses issue #1013.

---
 opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearchOptions.java |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearchOptions.java b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearchOptions.java
index 0d84db0..8913370 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearchOptions.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPSearchOptions.java
@@ -56,6 +56,7 @@
   private int sizeLimit = 0;
   private int timeLimit = 0;
   private boolean typesOnly = false;
+  private boolean countMatchingEntries = false;
 
   /**
    * Creates the options instance.
@@ -228,5 +229,30 @@
     this.typesOnly = typesOnly;
   }
 
+
+  /**
+   * Indicates whether to report the number of matching entries returned by the
+   * server.
+   *
+   * @return  {@code true} if the number of matching entries should be reported,
+   *          or {@code false} if not.
+   */
+  public boolean countMatchingEntries()
+  {
+    return countMatchingEntries;
+  }
+
+
+  /**
+   * Specifies whether to report the number of matching entries returned by the
+   * server.
+   *
+   * @param  countMatchingEntries  Specifies whether to report the number of
+   *                               matching entries returned by the server.
+   */
+  public void setCountMatchingEntries(boolean countMatchingEntries)
+  {
+    this.countMatchingEntries = countMatchingEntries;
+  }
 }
 

--
Gitblit v1.10.0