com.unboundid.ldap.sdk.unboundidds.controls.BatchedTransactionSpecificationRequestControl Maven / Gradle / Ivy
                 Go to download
                
        
                    Show more of this group  Show more artifacts with this name
Show all versions of unboundid-ldapsdk-commercial-edition Show documentation
                Show all versions of unboundid-ldapsdk-commercial-edition Show documentation
      The UnboundID LDAP SDK for Java is a fast, comprehensive, and easy-to-use
      Java API for communicating with LDAP directory servers and performing
      related tasks like reading and writing LDIF, encoding and decoding data
      using base64 and ASN.1 BER, and performing secure communication.  This
      package contains the Commercial Edition of the LDAP SDK, which includes
      all of the general-purpose functionality contained in the Standard
      Edition, plus additional functionality specific to UnboundID server
      products.
    
                
            /*
 * Copyright 2007-2016 UnboundID Corp.
 * All Rights Reserved.
 */
/*
 * Copyright (C) 2015-2016 UnboundID Corp.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License (GPLv2 only)
 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see .
 */
package com.unboundid.ldap.sdk.unboundidds.controls;
import com.unboundid.asn1.ASN1OctetString;
import com.unboundid.ldap.sdk.Control;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.ResultCode;
import com.unboundid.ldap.sdk.controls.AssertionRequestControl;
import com.unboundid.ldap.sdk.controls.ManageDsaITRequestControl;
import com.unboundid.ldap.sdk.controls.PostReadRequestControl;
import com.unboundid.ldap.sdk.controls.PreReadRequestControl;
import com.unboundid.ldap.sdk.controls.ProxiedAuthorizationV1RequestControl;
import com.unboundid.ldap.sdk.controls.ProxiedAuthorizationV2RequestControl;
import com.unboundid.ldap.sdk.controls.SubtreeDeleteRequestControl;
import com.unboundid.ldap.sdk.unboundidds.extensions.
            StartBatchedTransactionExtendedRequest;
import com.unboundid.util.NotMutable;
import com.unboundid.util.ThreadSafety;
import com.unboundid.util.ThreadSafetyLevel;
import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
import static com.unboundid.util.Validator.*;
/**
 * 
 *   NOTE:  This class is part of the Commercial Edition of the UnboundID
 *   LDAP SDK for Java.  It is not available for use in applications that
 *   include only the Standard Edition of the LDAP SDK, and is not supported for
 *   use in conjunction with non-UnboundID products.
 * 
 * This class provides an implementation of the batched transaction
 * specification request control, which may be used to indicate that the
 * associated add, delete, modify, modify DN, or password modify operation is
 * part of a batched transaction.  The transaction should be created with the
 * start batched transaction extended operation, which will obtain a transaction
 * ID, and the transaction may be committed or aborted using the end batched
 * transaction extended operation.
 * 
 * Note that directory servers may limit the set of controls that are available
 * for use in requests that are part of a transaction.  RFC 5805 section 4
 * indicates that the following controls may be used in conjunction with the
 * transaction specification request control:  {@link AssertionRequestControl},
 * {@link ManageDsaITRequestControl}, {@link PreReadRequestControl}, and
 * {@link PostReadRequestControl}.  The
 * {@link ProxiedAuthorizationV1RequestControl} and
 * {@link ProxiedAuthorizationV2RequestControl} controls cannot be included in
 * requests that are part of a transaction, but you can include them in the
 * {@link StartBatchedTransactionExtendedRequest} to indicate that all
 * operations within the transaction should be processed with the specified
 * authorization identity.
 * 
 * The UnboundID Directory Server supports the following additional
 * UnboundID-specific controls in conjunction with operations included in a
 * transaction:  {@link AccountUsableRequestControl},
 * {@link HardDeleteRequestControl}, {@link IntermediateClientRequestControl},
 * {@link PasswordPolicyRequestControl},
 * {@link ReplicationRepairRequestControl}, {@link SoftDeleteRequestControl},
 * {@link SoftDeletedEntryAccessRequestControl},
 * {@link SubtreeDeleteRequestControl}, and {@link UndeleteRequestControl}.
 * 
 * See the documentation for the {@link StartBatchedTransactionExtendedRequest}
 * class for an example of processing a batched transaction.
 */
@NotMutable()
@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
public final class BatchedTransactionSpecificationRequestControl
       extends Control
{
  /**
   * The OID (1.3.6.1.4.1.30221.2.5.1) for the batched transaction specification
   * request control.
   */
  public static final String BATCHED_TRANSACTION_SPECIFICATION_REQUEST_OID =
       "1.3.6.1.4.1.30221.2.5.1";
  /**
   * The serial version UID for this serializable class.
   */
  private static final long serialVersionUID = -6817702055586260189L;
  // The transaction ID for the associated transaction.
  private final ASN1OctetString transactionID;
  // This is an ugly hack to prevent checkstyle from complaining about the
  // imports for classes only referenced in the javadoc.  Checkstyle apparently
  // doesn't recognize that so we just need to use it in some way in this class
  // to placate checkstyle.
  static
  {
    final AssertionRequestControl assertionControl = null;
    final ManageDsaITRequestControl manageDsaITControl = null;
    final PreReadRequestControl preReadControl = null;
    final PostReadRequestControl postReadControl = null;
    final ProxiedAuthorizationV1RequestControl proxiedAuthV1Control = null;
    final ProxiedAuthorizationV2RequestControl proxiedAuthV2Control = null;
    final SubtreeDeleteRequestControl subtreeDeleteControl = null;
    final StartBatchedTransactionExtendedRequest startBatchedTxnRequest = null;
  }
  /**
   * Creates a new batched transaction specification request control with the
   * provided transaction ID.
   *
   * @param  transactionID  The transaction ID for the associated transaction,
   *                        as obtained from the start batched transaction
   *                        extended operation.  It must not be {@code null}.
   */
  public BatchedTransactionSpecificationRequestControl(
              final ASN1OctetString transactionID)
  {
    super(BATCHED_TRANSACTION_SPECIFICATION_REQUEST_OID, true,
         new ASN1OctetString(transactionID.getValue()));
    this.transactionID = transactionID;
  }
  /**
   * Creates a new batched transaction specification request control which is
   * decoded from the provided generic control.
   *
   * @param  control  The generic control to be decoded as a batched transaction
   *                  specification request control.
   *
   * @throws  LDAPException  If the provided control cannot be decoded as a
   *                         batched transaction specification request control.
   */
  public BatchedTransactionSpecificationRequestControl(final Control control)
         throws LDAPException
  {
    super(control);
    transactionID = control.getValue();
    if (transactionID == null)
    {
      throw new LDAPException(ResultCode.DECODING_ERROR,
                              ERR_TXN_REQUEST_CONTROL_NO_VALUE.get());
    }
  }
  /**
   * Retrieves the transaction ID for the associated transaction.
   *
   * @return  The transaction ID for the associated transaction.
   */
  public ASN1OctetString getTransactionID()
  {
    return transactionID;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
  public String getControlName()
  {
    return INFO_CONTROL_NAME_BATCHED_TXN_REQUEST.get();
  }
  /**
   * {@inheritDoc}
   */
  @Override()
  public void toString(final StringBuilder buffer)
  {
    buffer.append("BatchedTransactionSpecificationRequestControl(" +
                  "transactionID='");
    buffer.append(transactionID.stringValue());
    buffer.append("')");
  }
}
     © 2015 - 2025 Weber Informatics LLC | Privacy Policy