From 8228fb82f3ad657adf7832eb05c624bf48c4a30e Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Wed, 19 Sep 2007 00:31:06 +0000
Subject: [PATCH] More changes relating to issue 1449: aggregation support.

---
 opends/src/server/org/opends/server/admin/client/OperationRejectedException.java |   81 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 76 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/client/OperationRejectedException.java b/opends/src/server/org/opends/server/admin/client/OperationRejectedException.java
index fd5ed40..3fc6b22 100644
--- a/opends/src/server/org/opends/server/admin/client/OperationRejectedException.java
+++ b/opends/src/server/org/opends/server/admin/client/OperationRejectedException.java
@@ -57,6 +57,26 @@
 public class OperationRejectedException extends AdminClientException {
 
   /**
+   * The type of operation that caused this exception.
+   */
+  public enum OperationType {
+    /**
+     * A managed object could not be created.
+     */
+    CREATE,
+
+    /**
+     * A managed object could not be deleted.
+     */
+    DELETE,
+
+    /**
+     * A managed object could not be modified.
+     */
+    MODIFY;
+  }
+
+  /**
    * Serialization ID.
    */
   private static final long serialVersionUID = 8547688890613079044L;
@@ -102,14 +122,27 @@
   // The messages describing the constraint violations that occurred.
   private final Collection<Message> messages;
 
+  // The type of operation that caused this exception.
+  private final OperationType type;
+
+  // The user friendly name of the component that caused this
+  // exception.
+  private final Message ufn;
+
 
 
   /**
    * Creates a new operation rejected exception with a default
    * message.
+   *
+   * @param type
+   *          The type of operation that caused this exception.
+   * @param ufn
+   *          The user friendly name of the component that caused this
+   *          exception.
    */
-  public OperationRejectedException() {
-    this(ERR_OPERATION_REJECTED_DEFAULT.get());
+  public OperationRejectedException(OperationType type, Message ufn) {
+    this(type, ufn, ERR_OPERATION_REJECTED_DEFAULT.get());
   }
 
 
@@ -118,15 +151,23 @@
    * Creates a new operation rejected exception with the provided
    * messages.
    *
+   * @param type
+   *          The type of operation that caused this exception.
+   * @param ufn
+   *          The user friendly name of the component that caused this
+   *          exception.
    * @param messages
    *          The messages describing the constraint violations that
    *          occurred (must be non-<code>null</code> and
    *          non-empty).
    */
-  public OperationRejectedException(Collection<Message> messages) {
+  public OperationRejectedException(OperationType type, Message ufn,
+      Collection<Message> messages) {
     super(getDefaultMessage(messages));
 
     this.messages = new ArrayList<Message>(messages);
+    this.type = type;
+    this.ufn = ufn;
   }
 
 
@@ -135,12 +176,18 @@
    * Creates a new operation rejected exception with the provided
    * message.
    *
+   * @param type
+   *          The type of operation that caused this exception.
+   * @param ufn
+   *          The user friendly name of the component that caused this
+   *          exception.
    * @param message
    *          The message describing the constraint violation that
    *          occurred.
    */
-  public OperationRejectedException(Message message) {
-    this(Collections.singleton(message));
+  public OperationRejectedException(OperationType type, Message ufn,
+      Message message) {
+    this(type, ufn, Collections.singleton(message));
   }
 
 
@@ -169,4 +216,28 @@
     return getSingleMessage(messages);
   }
 
+
+
+  /**
+   * Gets the type of operation that caused this exception.
+   *
+   * @return Returns the type of operation that caused this exception.
+   */
+  public OperationType getOperationType() {
+    return type;
+  }
+
+
+
+  /**
+   * Gets the user friendly name of the component that caused this
+   * exception.
+   *
+   * @return Returns the user friendly name of the component that
+   *         caused this exception.
+   */
+  public Message getUserFriendlyName() {
+    return ufn;
+  }
+
 }

--
Gitblit v1.10.0