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.controls;
022    
023    
024    
025    import com.unboundid.ldap.sdk.Control;
026    import com.unboundid.ldap.sdk.LDAPException;
027    import com.unboundid.ldap.sdk.ResultCode;
028    import com.unboundid.util.NotMutable;
029    import com.unboundid.util.ThreadSafety;
030    import com.unboundid.util.ThreadSafetyLevel;
031    
032    import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
033    
034    
035    
036    /**
037     * <BLOCKQUOTE>
038     *   <B>NOTE:</B>  This class is part of the Commercial Edition of the UnboundID
039     *   LDAP SDK for Java.  It is not available for use in applications that
040     *   include only the Standard Edition of the LDAP SDK, and is not supported for
041     *   use in conjunction with non-UnboundID products.
042     * </BLOCKQUOTE>
043     * This class defines a request control that may be included in a search request
044     * to indicate that the server should include replication conflict entries in
045     * the set of search result entries.
046     * <BR><BR>
047     * This control is not based on any public standard.  It was originally
048     * developed for use with the UnboundID Directory Server.  It does not have a
049     * value.
050     * <BR><BR>
051     * There is no corresponding response control.  Replication conflict entries may
052     * be identified by the object class "ds-sync-conflict-entry".
053     */
054    @NotMutable()
055    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
056    public final class ReturnConflictEntriesRequestControl
057           extends Control
058    {
059      /**
060       * The OID (1.3.6.1.4.1.30221.2.5.13) for the return conflict entries request
061       * control.
062       */
063      public static final String RETURN_CONFLICT_ENTRIES_REQUEST_OID =
064           "1.3.6.1.4.1.30221.2.5.13";
065    
066    
067    
068      /**
069       * The serial version UID for this serializable class.
070       */
071      private static final long serialVersionUID = -7688556660280234650L;
072    
073    
074    
075      /**
076       * Creates a new return conflict entries request control.  It will be marked
077       * critical.
078       */
079      public ReturnConflictEntriesRequestControl()
080      {
081        this(true);
082      }
083    
084    
085    
086      /**
087       * Creates a new return conflict entries request control.
088       *
089       * @param  isCritical  Indicates whether this control should be marked
090       *                     critical.
091       */
092      public ReturnConflictEntriesRequestControl(final boolean isCritical)
093      {
094        super(RETURN_CONFLICT_ENTRIES_REQUEST_OID, isCritical, null);
095      }
096    
097    
098    
099      /**
100       * Creates a new return conflict entries request control which is decoded from
101       * the provided generic control.
102       *
103       * @param  control  The generic control to be decoded as a return conflict
104       *                  entries request control.
105       *
106       * @throws  LDAPException  If the provided control cannot be decoded as a
107       *                         return conflict entries request control.
108       */
109      public ReturnConflictEntriesRequestControl(final Control control)
110             throws LDAPException
111      {
112        super(control);
113    
114        if (control.hasValue())
115        {
116          throw new LDAPException(ResultCode.DECODING_ERROR,
117               ERR_RETURN_CONFLICT_ENTRIES_REQUEST_HAS_VALUE.get());
118        }
119      }
120    
121    
122    
123      /**
124       * {@inheritDoc}
125       */
126      @Override()
127      public String getControlName()
128      {
129        return INFO_CONTROL_NAME_RETURN_CONFLICT_ENTRIES_REQUEST.get();
130      }
131    
132    
133    
134      /**
135       * {@inheritDoc}
136       */
137      @Override()
138      public void toString(final StringBuilder buffer)
139      {
140        buffer.append("ReturnConflictEntriesRequestControl(isCritical=");
141        buffer.append(isCritical());
142        buffer.append(')');
143      }
144    }