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/core/SearchOperationWrapper.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/SearchOperationWrapper.java b/opends/src/server/org/opends/server/core/SearchOperationWrapper.java
index 61c7b03..f4545c9 100644
--- a/opends/src/server/org/opends/server/core/SearchOperationWrapper.java
+++ b/opends/src/server/org/opends/server/core/SearchOperationWrapper.java
@@ -41,12 +41,13 @@
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchResultReference;
import org.opends.server.types.SearchScope;
+import org.opends.server.workflowelement.WorkflowElement;
/**
* This abstract class wraps/decorates a given search operation.
* This class will be extended by sub-classes to enhance the
- * functionnality of the SearchOperationBasis.
+ * functionality of the SearchOperationBasis.
*/
public abstract class SearchOperationWrapper extends OperationWrapper
implements SearchOperation
@@ -54,6 +55,24 @@
// The wrapped operation.
private SearchOperation search;
+ // The workflow element which has invoked the current operation.
+ // The returned entries and returned references must be sent to that
+ // workflow element.
+ private WorkflowElement<?> callingWorkflowElement = null;
+
+ /**
+ * Set the calling workflow element.
+ *
+ * @param callingWorkflowElement the workflow element which has invoked
+ * the current operation
+ */
+ public void setCallingWorkflowElement(
+ WorkflowElement<?> callingWorkflowElement
+ )
+ {
+ this.callingWorkflowElement = callingWorkflowElement;
+ }
+
/**
* Creates a new search operation based on the provided search operation.
*
@@ -70,7 +89,24 @@
*/
public boolean returnEntry(Entry entry, List<Control> controls)
{
- return search.returnEntry(entry, controls);
+ boolean result;
+
+ // If the calling workflow element is defined then send the return
+ // entry to the workflow element, otherwise send the entry to the
+ // calling operation.
+ // Sometimes, the calling workflow element might not be set for
+ // an internal operation because the internal search is done using
+ // a local backend operation instead of an operation basis.
+ if (callingWorkflowElement != null)
+ {
+ result = callingWorkflowElement.returnEntry(entry, controls);
+ }
+ else
+ {
+ result = this.search.returnEntry(entry, controls);
+ }
+
+ return result;
}
/**
@@ -78,7 +114,23 @@
*/
public boolean returnReference(DN dn, SearchResultReference reference)
{
- return search.returnReference(dn, reference);
+ boolean result;
+
+ // If the calling workflow element is not set then send the
+ // reference to the calling operation, otherwise send the reference
+ // to the calling workflow element.
+ // an internal operation because the internal search is done using
+ // a local backend operation instead of an operation basis.
+ if (callingWorkflowElement != null)
+ {
+ result = callingWorkflowElement.returnReference(dn, reference);
+ }
+ else
+ {
+ result = this.search.returnReference(dn, reference);
+ }
+
+ return result;
}
/**
--
Gitblit v1.10.0