001/*
002 * Copyright 2012-2017 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2017 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.extensions;
022
023
024
025/**
026 * This enum defines the set of possible error behavior values that may be used
027 * in the multi-update extended request.
028 * <BR>
029 * <BLOCKQUOTE>
030 *   <B>NOTE:</B>  This class, and other classes within the
031 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
032 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
033 *   server products.  These classes provide support for proprietary
034 *   functionality or for external specifications that are not considered stable
035 *   or mature enough to be guaranteed to work in an interoperable way with
036 *   other types of LDAP servers.
037 * </BLOCKQUOTE>
038 *
039 * @see MultiUpdateExtendedRequest
040 */
041public enum MultiUpdateErrorBehavior
042{
043  /**
044   * The behavior which indicates that all operations must be processed
045   * atomically.  The entire set of updates will succeed or fail as a single
046   * unit, and directory clients will not see any updates while the multi-update
047   * request is in progress.  Note that the server may place constraints on
048   * the ability to use this error behavior such that it may not be usable in
049   * all circumstances (e.g., when passing through a Directory Proxy Server with
050   * entry balancing enabled or that would otherwise need to communicate with
051   * multiple servers, or if it is necessary to interact with entries in
052   * multiple Directory Server backends).
053   */
054  ATOMIC(0),
055
056
057
058  /**
059   * The behavior which indicates that processing will end for the multi-update
060   * operation after the first failure is encountered while attempting to
061   * apply a change.  Any changes processed before the first failure was
062   * encountered will still have been applied, and clients accessing the server
063   * in the course of processing the multi-update request may see changes after
064   * only some of them have been completed.
065   */
066  ABORT_ON_ERROR(1),
067
068
069
070  /**
071   * The behavior which indicates that the server should attempt to process all
072   * elements of the multi-update request even if one or more failures are
073   * encountered.  Clients accessing the server in the course of processing the
074   * multi-update request may see changes after only some of them have been
075   * completed.
076   */
077  CONTINUE_ON_ERROR(2);
078
079
080
081  // The integer value associated with this error behavior.
082  private final int intValue;
083
084
085
086  /**
087   * Creates a new multi-update error behavior value with the provided integer
088   * representation.
089   *
090   * @param  intValue  The integer value associated with this error behavior.
091   */
092  MultiUpdateErrorBehavior(final int intValue)
093  {
094    this.intValue = intValue;
095  }
096
097
098
099  /**
100   * Retrieves the integer value associated with this error behavior.
101   *
102   * @return  The integer value associated with this error behavior.
103   */
104  public int intValue()
105  {
106    return intValue;
107  }
108
109
110
111  /**
112   * Retrieves the multi-update error behavior value with the specified integer
113   * value.
114   *
115   * @param  intValue  The integer value for the error behavior to retrieve.
116   *
117   * @return  The multi-update error behavior with the specified integer value,
118   *          or {@code null} if there is no error behavior with the specified
119   *          value.
120   */
121  public static MultiUpdateErrorBehavior valueOf(final int intValue)
122  {
123    for (final MultiUpdateErrorBehavior v : values())
124    {
125      if (intValue == v.intValue)
126      {
127        return v;
128      }
129    }
130
131    return null;
132  }
133}