From 3337135b06dad7e2f48569ebee38ca96e732fca7 Mon Sep 17 00:00:00 2001
From: jdemendi <jdemendi@localhost>
Date: Wed, 12 Mar 2008 13:26:46 +0000
Subject: [PATCH] Fix bug #2991. Each workflow element must implement a returnEntry method. The returnEntry method performs a processing on  the search entry before the entry is sent to the client application. In the particular case of JE local backend, no  processing is required, so the retunEntry is doing nothing but call the returnEntry on its super class.

---
 opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index 84b0af5..c249023 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -46,9 +46,13 @@
 import org.opends.server.core.ModifyOperation;
 import org.opends.server.core.SearchOperation;
 import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.Control;
+import org.opends.server.types.DN;
+import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.Operation;
 import org.opends.server.types.ResultCode;
+import org.opends.server.types.SearchResultReference;
 import org.opends.server.workflowelement.LeafWorkflowElement;
 
 
@@ -348,8 +352,15 @@
         break;
 
       case SEARCH:
+        // First of all store the original operation basis so that returned
+        // entries can be sent to it later on
+        setOriginalOperationBasis(operation);
+
         LocalBackendSearchOperation searchOperation =
              new LocalBackendSearchOperation((SearchOperation) operation);
+        // Set the calling workflow element so that returnEntry and
+        // returnReference callbacks can be invoked later on.
+        searchOperation.setCallingWorkflowElement(this);
         searchOperation.processLocalSearch(backend);
         break;
 
@@ -427,5 +438,45 @@
     globalOperation.setAttachment(Operation.LOCALBACKENDOPERATIONS,
                                   newAttachment);
   }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public boolean returnEntry(
+      Entry entry,
+      List<Control> controls)
+  {
+    boolean result;
+
+    // There is no specific processing to perform on the returned entry.
+    // Just let the superclass execute the generic processing on the
+    // returned entry.
+    result = super.returnEntry(entry, controls);
+
+    return result;
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public boolean returnReference(
+      DN dn,
+      SearchResultReference reference)
+  {
+    boolean result;
+
+    // There is no specific processing to perform on the returned reference.
+    // Just let the superclass execute the generic processing on the
+    // returned reference.
+    result = super.returnReference(dn, reference);
+
+    return result;
+  }
+
+
 }
 

--
Gitblit v1.10.0