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

matthew_swift
19.31.2007 8228fb82f3ad657adf7832eb05c624bf48c4a30e
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;
  }
}