mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jdemendi
12.26.2008 3337135b06dad7e2f48569ebee38ca96e732fca7
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;
  }
  /**