001/*
002 * Copyright 2013-2019 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2019 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 provides a request control which may be included in a delete or
038 * modify DN request to indicate that the server should skip any referential
039 * integrity processing that would have otherwise been done for that operation.
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
045 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
046 *   for proprietary functionality or for external specifications that are not
047 *   considered stable or mature enough to be guaranteed to work in an
048 *   interoperable way with other types of LDAP servers.
049 * </BLOCKQUOTE>
050 * <BR>
051 * The request control has an OID of "1.3.6.1.4.1.30221.2.5.30" and does not
052 * have a value.  The criticality for this control may be either {@code TRUE}
053 * or {@code FALSE}, which may impact whether a server will process the
054 * associated modify DN or delete operation if the server does not support the
055 * use of this control.  If a server receives a critical control that it does
056 * not support for the associated operation, then it will return a failure
057 * result without attempting to process that operation.  If a server receives
058 * a non-critical control that it does not support for the associated operation,
059 * then it will process the operation as if that control had not been provided.
060 */
061@NotMutable()
062@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
063public final class SuppressReferentialIntegrityUpdatesRequestControl
064       extends Control
065{
066  /**
067   * The OID (1.3.6.1.4.1.30221.2.5.30) for the suppress referential integrity
068   * updates request control.
069   */
070  public static final  String SUPPRESS_REFINT_REQUEST_OID =
071       "1.3.6.1.4.1.30221.2.5.30";
072
073
074
075  /**
076   * The serial version UID for this serializable class.
077   */
078  private static final long serialVersionUID = 4761880447993567116L;
079
080
081
082  /**
083   * Creates a new suppress referential integrity updates request control.  It
084   * will be critical.
085   */
086  public SuppressReferentialIntegrityUpdatesRequestControl()
087  {
088    this(true);
089  }
090
091
092
093  /**
094   * Creates a new suppress referential integrity updates request control.
095   *
096   * @param  isCritical  Indicates whether the control should be marked
097   *                     critical.
098   */
099  public SuppressReferentialIntegrityUpdatesRequestControl(
100              final boolean isCritical)
101  {
102    super(SUPPRESS_REFINT_REQUEST_OID, isCritical, null);
103  }
104
105
106
107  /**
108   * Creates a new suppress referential integrity updates request control which
109   * is decoded from the provided generic control.
110   *
111   * @param  control  The generic control to be decoded as a suppress
112   *                  referential integrity updates request control.
113   *
114   * @throws LDAPException  If the provided control cannot be decoded as a
115   *                         suppress referential integrity updates request
116   *                         control.
117   */
118  public SuppressReferentialIntegrityUpdatesRequestControl(
119              final Control control)
120         throws LDAPException
121  {
122    super(control);
123
124    if (control.hasValue())
125    {
126      throw new LDAPException(ResultCode.DECODING_ERROR,
127           ERR_SUPPRESS_REFINT_REQUEST_CONTROL_HAS_VALUE.get());
128    }
129  }
130
131
132
133  /**
134   * {@inheritDoc}
135   */
136  @Override()
137  public String getControlName()
138  {
139    return INFO_CONTROL_NAME_SUPPRESS_REFINT_REQUEST.get();
140  }
141
142
143
144  /**
145   * {@inheritDoc}
146   */
147  @Override()
148  public void toString(final StringBuilder buffer)
149  {
150    buffer.append("SuppressReferentialIntegrityUpdatesRequestControl(" +
151         "isCritical=");
152    buffer.append(isCritical());
153    buffer.append(')');
154  }
155}