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