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