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