001    /*
002     * Copyright 2012-2015 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2015 UnboundID Corp.
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     */
021    package com.unboundid.ldap.sdk.unboundidds.extensions;
022    
023    
024    
025    /**
026     * <BLOCKQUOTE>
027     *   <B>NOTE:</B>  This class is part of the Commercial Edition of the UnboundID
028     *   LDAP SDK for Java.  It is not available for use in applications that
029     *   include only the Standard Edition of the LDAP SDK, and is not supported for
030     *   use in conjunction with non-UnboundID products.
031     * </BLOCKQUOTE>
032     * This enum defines the set of possible error behavior values that may be used
033     * in the multi-update extended request.
034     *
035     * @see MultiUpdateExtendedRequest
036     */
037    public enum MultiUpdateErrorBehavior
038    {
039      /**
040       * The behavior which indicates that all operations must be processed
041       * atomically.  The entire set of updates will succeed or fail as a single
042       * unit, and directory clients will not see any updates while the multi-update
043       * request is in progress.  Note that the server may place constraints on
044       * the ability to use this error behavior such that it may not be usable in
045       * all circumstances (e.g., when passing through a Directory Proxy Server with
046       * entry balancing enabled or that would otherwise need to communicate with
047       * multiple servers, or if it is necessary to interact with entries in
048       * multiple Directory Server backends).
049       */
050      ATOMIC(0),
051    
052    
053    
054      /**
055       * The behavior which indicates that processing will end for the multi-update
056       * operation after the first failure is encountered while attempting to
057       * apply a change.  Any changes processed before the first failure was
058       * encountered will still have been applied, and clients accessing the server
059       * in the course of processing the multi-update request may see changes after
060       * only some of them have been completed.
061       */
062      ABORT_ON_ERROR(1),
063    
064    
065    
066      /**
067       * The behavior which indicates that the server should attempt to process all
068       * elements of the multi-update request even if one or more failures are
069       * encountered.  Clients accessing the server in the course of processing the
070       * multi-update request may see changes after only some of them have been
071       * completed.
072       */
073      CONTINUE_ON_ERROR(2);
074    
075    
076    
077      // The integer value associated with this error behavior.
078      private final int intValue;
079    
080    
081    
082      /**
083       * Creates a new multi-update error behavior value with the provided integer
084       * representation.
085       *
086       * @param  intValue  The integer value associated with this error behavior.
087       */
088      MultiUpdateErrorBehavior(final int intValue)
089      {
090        this.intValue = intValue;
091      }
092    
093    
094    
095      /**
096       * Retrieves the integer value associated with this error behavior.
097       *
098       * @return  The integer value associated with this error behavior.
099       */
100      public int intValue()
101      {
102        return intValue;
103      }
104    
105    
106    
107      /**
108       * Retrieves the multi-update error behavior value with the specified integer
109       * value.
110       *
111       * @param  intValue  The integer value for the error behavior to retrieve.
112       *
113       * @return  The multi-update error behavior with the specified integer value,
114       *          or {@code null} if there is no error behavior with the specified
115       *          value.
116       */
117      public static MultiUpdateErrorBehavior valueOf(final int intValue)
118      {
119        for (final MultiUpdateErrorBehavior v : values())
120        {
121          if (intValue == v.intValue)
122          {
123            return v;
124          }
125        }
126    
127        return null;
128      }
129    }