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 legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2014 ForgeRock AS
026 */
027package org.opends.server.core;
028
029import java.util.List;
030
031import org.opends.server.types.*;
032import org.forgerock.opendj.ldap.ByteString;
033import org.opends.server.types.operation.SubordinateModifyDNOperation;
034
035/**
036 * This interface defines an operation used to move an entry in
037 * the Directory Server.
038 */
039public interface ModifyDNOperation
040       extends Operation, SubordinateModifyDNOperation
041{
042
043  /**
044   * Retrieves the raw, unprocessed entry DN as included in the client request.
045   * The DN that is returned may or may not be a valid DN, since no validation
046   * will have been performed upon it.
047   *
048   * @return  The raw, unprocessed entry DN as included in the client request.
049   */
050  ByteString getRawEntryDN();
051
052  /**
053   * Specifies the raw, unprocessed entry DN as included in the client request.
054   * This should only be called by pre-parse plugins.
055   *
056   * @param  rawEntryDN  The raw, unprocessed entry DN as included in the client
057   *                     request.
058   */
059  void setRawEntryDN(ByteString rawEntryDN);
060
061
062  /**
063   * Retrieves the DN of the entry to rename.  This should not be called by
064   * pre-parse plugins because the processed DN will not be available yet.
065   * Instead, they should call the <CODE>getRawEntryDN</CODE> method.
066   *
067   * @return  The DN of the entry to rename, or <CODE>null</CODE> if the raw
068   *          entry DN has not yet been processed.
069   */
070  DN getEntryDN();
071
072  /**
073   * Retrieves the raw, unprocessed newRDN as included in the request from the
074   * client.  This may or may not contain a valid RDN, as no validation will
075   * have been performed on it.
076   *
077   * @return  The raw, unprocessed newRDN as included in the request from the
078   *          client.
079   */
080  ByteString getRawNewRDN();
081
082  /**
083   * Specifies the raw, unprocessed newRDN as included in the request from the
084   * client.  This should only be called by pre-parse plugins and should not be
085   * used in later stages of processing.
086   *
087   * @param  rawNewRDN  The raw, unprocessed newRDN as included in the request
088   *                    from the client.
089   */
090  void setRawNewRDN(ByteString rawNewRDN);
091
092  /**
093   * Retrieves the new RDN to use for the entry.  This should not be called by
094   * pre-parse plugins, because the processed newRDN will not yet be available.
095   * Pre-parse plugins should instead use the <CODE>getRawNewRDN</CODE> method.
096   *
097   * @return  The new RDN to use for the entry, or <CODE>null</CODE> if the raw
098   *          newRDN has not yet been processed.
099   */
100  RDN getNewRDN();
101
102
103  /**
104   * Indicates whether the current RDN value should be removed from the entry.
105   *
106   * @return  <CODE>true</CODE> if the current RDN value should be removed from
107   *          the entry, or <CODE>false</CODE> if not.
108   */
109  boolean deleteOldRDN();
110
111  /**
112   * Specifies whether the current RDN value should be removed from the entry.
113   *
114   * @param  deleteOldRDN  Specifies whether the current RDN value should be
115   *                       removed from the entry.
116   */
117  void setDeleteOldRDN(boolean deleteOldRDN);
118
119  /**
120   * Retrieves the raw, unprocessed newSuperior from the client request.  This
121   * may or may not contain a valid DN, as no validation will have been
122   * performed on it.
123   *
124   * @return  The raw, unprocessed newSuperior from the client request, or
125   *          <CODE>null</CODE> if there is none.
126   */
127  ByteString getRawNewSuperior();
128
129  /**
130   * Specifies the raw, unprocessed newSuperior for this modify DN operation, as
131   * provided in the request from the client.  This method should only be called
132   * by pre-parse plugins.
133   *
134   * @param  rawNewSuperior  The raw, unprocessed newSuperior as provided in the
135   *                         request from the client.
136   */
137  void setRawNewSuperior(ByteString rawNewSuperior);
138
139  /**
140   * Retrieves the newSuperior DN for the entry.  This should not be called by
141   * pre-parse plugins, because the processed DN will not yet be available at
142   * that time.  Instead, they should use the <CODE>getRawNewSuperior</CODE>
143   * method.
144   *
145   * @return  The newSuperior DN for the entry, or <CODE>null</CODE> if there is
146   *          no newSuperior DN for this request or if the raw newSuperior has
147   *          not yet been processed.
148   */
149  DN getNewSuperior();
150
151  /**
152   * Retrieves the new DN for the entry.
153   *
154   * @return The new DN for the entry, or <CODE>null</CODE> if there is
155   *          neither newRDN, nor entryDN for this request.
156   */
157  DN getNewDN();
158
159  /**
160   * Retrieves the set of modifications applied to attributes of the target
161   * entry in the course of processing this modify DN operation.  This will
162   * include attribute-level changes from the modify DN itself (e.g., removing
163   * old RDN values if deleteOldRDN is set, or adding new RDN values that don't
164   * already exist), but it may also be used by pre-operation plugins to cause
165   * additional changes in the entry.  In this case, those plugins may add
166   * modifications to this list (they may not remove existing modifications) if
167   * any changes should be processed in addition to the core modify DN
168   * processing.  Backends may read this list to identify which attribute-level
169   * changes were applied in order to more easily apply updates to attribute
170   * indexes.
171   *
172   * @return  The set of modifications applied to attributes during the course
173   *          of the modify DN processing, or <CODE>null</CODE> if that
174   *          information is not yet available (e.g., during pre-parse plugins).
175   */
176  List<Modification> getModifications();
177
178  /**
179   * Adds the provided modification to the set of modifications to be applied
180   * as part of the update.  This should only be called by pre-operation
181   * plugins.
182   *
183   * @param  modification  The modification to add to the set of modifications
184   *                       to apply to the entry.
185   */
186  void addModification(Modification modification);
187
188  /**
189   * Retrieves the current entry, before it is renamed.  This will not be
190   * available to pre-parse plugins or during the conflict resolution portion of
191   * the synchronization processing.
192   *
193   * @return  The current entry, or <CODE>null</CODE> if it is not yet
194   *           available.
195   */
196  Entry getOriginalEntry();
197
198
199  /**
200   * Retrieves the new entry, as it will appear after it is renamed.  This will
201   * not be  available to pre-parse plugins or during the conflict resolution
202   * portion of the synchronization processing.
203   *
204   * @return  The updated entry, or <CODE>null</CODE> if it is not yet
205   *           available.
206   */
207  Entry getUpdatedEntry();
208
209  /**
210   * Retrieves the proxied authorization DN for this operation if proxied
211   * authorization has been requested.
212   *
213   * @return  The proxied authorization DN for this operation if proxied
214   *          authorization has been requested, or {@code null} if proxied
215   *          authorization has not been requested.
216   */
217  DN getProxiedAuthorizationDN();
218
219
220  /**
221   * Sets the proxied authorization DN for this operation if proxied
222   * authorization has been requested.
223   *
224   * @param dn  The proxied authorization DN for this operation if proxied
225   *            authorization has been requested, or {@code null} if proxied
226   *            authorization has not been requested.
227   */
228  void setProxiedAuthorizationDN(DN dn);
229
230}