From 4738da898c0e9289f0b1171d7f3023c6c834d82e Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Mon, 22 Oct 2007 21:47:06 +0000
Subject: [PATCH] Added the ability to retrieve the number of entries in the entire subordinate subtree to the numSubordinates method in the backend API. Changed the replication code to use numSubordinates of the entires subtree to determine how many entries will be exported and imported during initialization.

---
 opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskBackend.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskBackend.java b/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskBackend.java
index 895f15f..e81ff8a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskBackend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskBackend.java
@@ -412,7 +412,7 @@
   public ConditionResult hasSubordinates(DN entryDN)
          throws DirectoryException
   {
-    long ret = numSubordinates(entryDN);
+    long ret = numSubordinates(entryDN, false);
     if(ret < 0)
     {
       return ConditionResult.UNDEFINED;
@@ -433,7 +433,8 @@
    * {@inheritDoc}
    */
   @Override()
-  public long numSubordinates(DN entryDN) throws DirectoryException
+  public long numSubordinates(DN entryDN, boolean subtree)
+      throws DirectoryException
   {
     if (entryDN == null)
     {
@@ -443,7 +444,15 @@
     if (entryDN.equals(taskRootDN))
     {
       // scheduled and recurring parents.
-      return 2;
+      if(!subtree)
+      {
+        return 2;
+      }
+      else
+      {
+        return taskScheduler.getScheduledTaskCount() +
+            taskScheduler.getRecurringTaskCount() + 2;
+      }
     }
     else if (entryDN.equals(scheduledTaskParentDN))
     {

--
Gitblit v1.10.0