From 4204e17ef5a801f50836310143394d801229ba3b Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 04 Sep 2007 01:55:31 +0000
Subject: [PATCH] Update the LDIFPluginResult object to provide the ability to specify a reject message that explains why the entry should not be imported/exported.

---
 opends/src/server/org/opends/server/api/plugin/LDIFPluginResult.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/api/plugin/LDIFPluginResult.java b/opends/src/server/org/opends/server/api/plugin/LDIFPluginResult.java
index 882f90e..af1ff06 100644
--- a/opends/src/server/org/opends/server/api/plugin/LDIFPluginResult.java
+++ b/opends/src/server/org/opends/server/api/plugin/LDIFPluginResult.java
@@ -28,6 +28,10 @@
 
 
 
+import org.opends.messages.Message;
+
+
+
 /**
  * This class defines a data structure that holds information about
  * the result of processing an LDIF import or export plugin.
@@ -56,6 +60,9 @@
   // imported/exported.
   private final boolean continueEntryProcessing;
 
+  // A message explaining why the entry was rejected.
+  private final Message rejectMessage;
+
 
 
   /**
@@ -65,7 +72,7 @@
    */
   private LDIFPluginResult()
   {
-    this(true, true);
+    this(true, true, null);
   }
 
 
@@ -85,8 +92,33 @@
   public LDIFPluginResult(boolean continuePluginProcessing,
                           boolean continueEntryProcessing)
   {
+    this(continuePluginProcessing, continueEntryProcessing, null);
+  }
+
+
+
+  /**
+   * Creates a new pre-operation plugin result with the provided
+   * information.
+   *
+   * @param  continuePluginProcessing  Indicates whether any further
+   *                                   LDIF import/export plugins
+   *                                   should be invoked for the
+   *                                   associated entry.
+   * @param  continueEntryProcessing   Indicates whether the
+   *                                   associated entry should still
+   *                                   be imported/exported.
+   * @param  rejectMessage             A message explaining why the
+   *                                   entry should not be
+   *                                   imported/exported.
+   */
+  public LDIFPluginResult(boolean continuePluginProcessing,
+                          boolean continueEntryProcessing,
+                          Message rejectMessage)
+  {
     this.continuePluginProcessing = continuePluginProcessing;
     this.continueEntryProcessing  = continueEntryProcessing;
+    this.rejectMessage            = rejectMessage;
   }
 
 
@@ -121,6 +153,20 @@
 
 
   /**
+   * Retrieves a message explaining why the entry should not be
+   * imported/exported, if one was provided.
+   *
+   * @return  A message explaining why the entry should not be
+   *          imported/exported, or {@code null} if none was provided.
+   */
+  public Message getRejectMessage()
+  {
+    return rejectMessage;
+  }
+
+
+
+  /**
    * Retrieves a string representation of this post-response plugin
    * result.
    *
@@ -149,6 +195,14 @@
     buffer.append(continuePluginProcessing);
     buffer.append(", continueEntryProcessing=");
     buffer.append(continueEntryProcessing);
+
+    if (rejectMessage != null)
+    {
+      buffer.append(", rejectMessage=\"");
+      buffer.append(rejectMessage);
+      buffer.append("\"");
+    }
+
     buffer.append(")");
   }
 }

--
Gitblit v1.10.0