001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt.  If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 *      Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 *      Portions Copyright 2010-2023 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.common.operation;
028
029
030
031import com.unboundid.ldap.sdk.ReadOnlyDeleteRequest;
032import com.unboundid.ldap.sdk.unboundidds.controls.HardDeleteRequestControl;
033import com.unboundid.ldap.sdk.unboundidds.controls.SoftDeleteRequestControl;
034import com.unboundid.ldif.LDIFDeleteChangeRecord;
035import com.unboundid.util.NotExtensible;
036import com.unboundid.util.ThreadSafety;
037import com.unboundid.util.ThreadSafetyLevel;
038
039
040
041/**
042 * This interface defines a set of methods which may be used to interact with a
043 * delete request.
044 */
045@NotExtensible()
046@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
047public interface DeleteRequest
048       extends ChangeRequest
049{
050  /**
051   * Retrieves the DN of the entry to be deleted.
052   *
053   * @return  The DN of the entry to be deleted.
054   */
055  String getDN();
056
057
058
059  /**
060   * Retrieves an LDAP SDK representation of this delete request.
061   *
062   * @return  An LDAP SDK representation of this delete request.
063   */
064  ReadOnlyDeleteRequest toLDAPSDKRequest();
065
066
067
068  /**
069   * Retrieves an LDIF change record that corresponds to this delete request.
070   *
071   * @return  An LDIF change record that corresponds to this delete request.
072   */
073  LDIFDeleteChangeRecord toLDIFChangeRecord();
074
075
076
077  /**
078   * Indicates whether this request will result in the target entry being
079   * soft-deleted. This will be true either if the
080   * {@link SoftDeleteRequestControl} is included or if the request matches
081   * the auto-soft-delete connection criteria or request criteria specified in
082   * the Soft Delete Policy for the server.
083   *
084   * @return true if this request will result in the target entry being
085   *         soft-deleted, false otherwise.
086   */
087  boolean isSoftDelete();
088
089
090
091  /**
092   * Retrieves the soft-delete request control included in the delete request if
093   * it is present. Note that soft delete operations can occur without the
094   * {@link SoftDeleteRequestControl} if the request matches the
095   * auto-soft-delete connection criteria; in that case this method will return
096   * {@code null}.
097   *
098   * @return the soft-delete request control if it is present in the request,
099   *         otherwise {@code null}.
100   */
101  SoftDeleteRequestControl getSoftDeleteRequestControl();
102
103
104
105  /**
106   * Indicates whether this request will result in the target entry being
107   * hard-deleted. This will be true either if the
108   * {@link HardDeleteRequestControl} is included or if the request didn't match
109   * any condition necessary to make it a soft-delete.
110   *
111   * @return true if this request will result in the target entry being
112   *         hard-deleted, false otherwise.
113   */
114  boolean isHardDelete();
115
116
117
118  /**
119   * Retrieves the hard-delete request control included in the delete request if
120   * it is present. Note that hard delete operations can occur without the
121   * {@link HardDeleteRequestControl}. If the request is not a soft-delete, it
122   * is effectively a hard delete; the presence of the
123   * {@link HardDeleteRequestControl} just makes it explicit.
124   *
125   * @return the hard-delete request control if it is present in the request,
126   *         otherwise {@code null}.
127   */
128  HardDeleteRequestControl getHardDeleteRequestControl();
129}