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  ByteString getRawEntryDN();
043
044  /**
045   * Specifies the raw, unprocessed entry DN as included in the client request.
046   * This should only be called by pre-parse plugins.
047   *
048   * @param  rawEntryDN  The raw, unprocessed entry DN as included in the client
049   *                     request.
050   */
051  void setRawEntryDN(ByteString rawEntryDN);
052
053
054  /**
055   * Retrieves the DN of the entry to rename.  This should not be called by
056   * pre-parse plugins because the processed DN will not be available yet.
057   * Instead, they should call the <CODE>getRawEntryDN</CODE> method.
058   *
059   * @return  The DN of the entry to rename, or <CODE>null</CODE> if the raw
060   *          entry DN has not yet been processed.
061   */
062  DN getEntryDN();
063
064  /**
065   * Retrieves the raw, unprocessed newRDN as included in the request from the
066   * client.  This may or may not contain a valid RDN, as no validation will
067   * have been performed on it.
068   *
069   * @return  The raw, unprocessed newRDN as included in the request from the
070   *          client.
071   */
072  ByteString getRawNewRDN();
073
074  /**
075   * Specifies the raw, unprocessed newRDN as included in the request from the
076   * client.  This should only be called by pre-parse plugins and should not be
077   * used in later stages of processing.
078   *
079   * @param  rawNewRDN  The raw, unprocessed newRDN as included in the request
080   *                    from the client.
081   */
082  void setRawNewRDN(ByteString rawNewRDN);
083
084  /**
085   * Retrieves the new RDN to use for the entry.  This should not be called by
086   * pre-parse plugins, because the processed newRDN will not yet be available.
087   * Pre-parse plugins should instead use the <CODE>getRawNewRDN</CODE> method.
088   *
089   * @return  The new RDN to use for the entry, or <CODE>null</CODE> if the raw
090   *          newRDN has not yet been processed.
091   */
092  RDN getNewRDN();
093
094
095  /**
096   * Indicates whether the current RDN value should be removed from the entry.
097   *
098   * @return  <CODE>true</CODE> if the current RDN value should be removed from
099   *          the entry, or <CODE>false</CODE> if not.
100   */
101  boolean deleteOldRDN();
102
103  /**
104   * Specifies whether the current RDN value should be removed from the entry.
105   *
106   * @param  deleteOldRDN  Specifies whether the current RDN value should be
107   *                       removed from the entry.
108   */
109  void setDeleteOldRDN(boolean deleteOldRDN);
110
111  /**
112   * Retrieves the raw, unprocessed newSuperior from the client request.  This
113   * may or may not contain a valid DN, as no validation will have been
114   * performed on it.
115   *
116   * @return  The raw, unprocessed newSuperior from the client request, or
117   *          <CODE>null</CODE> if there is none.
118   */
119  ByteString getRawNewSuperior();
120
121  /**
122   * Specifies the raw, unprocessed newSuperior for this modify DN operation, as
123   * provided in the request from the client.  This method should only be called
124   * by pre-parse plugins.
125   *
126   * @param  rawNewSuperior  The raw, unprocessed newSuperior as provided in the
127   *                         request from the client.
128   */
129  void setRawNewSuperior(ByteString rawNewSuperior);
130
131  /**
132   * Retrieves the newSuperior DN for the entry.  This should not be called by
133   * pre-parse plugins, because the processed DN will not yet be available at
134   * that time.  Instead, they should use the <CODE>getRawNewSuperior</CODE>
135   * method.
136   *
137   * @return  The newSuperior DN for the entry, or <CODE>null</CODE> if there is
138   *          no newSuperior DN for this request or if the raw newSuperior has
139   *          not yet been processed.
140   */
141  DN getNewSuperior();
142
143  /**
144   * Retrieves the new DN for the entry.
145   *
146   * @return The new DN for the entry, or <CODE>null</CODE> if there is
147   *          neither newRDN, nor entryDN for this request.
148   */
149  DN getNewDN();
150
151  /**
152   * Retrieves the set of modifications applied to attributes of the target
153   * entry in the course of processing this modify DN operation.  This will
154   * include attribute-level changes from the modify DN itself (e.g., removing
155   * old RDN values if deleteOldRDN is set, or adding new RDN values that don't
156   * already exist), but it may also be used by pre-operation plugins to cause
157   * additional changes in the entry.  In this case, those plugins may add
158   * modifications to this list (they may not remove existing modifications) if
159   * any changes should be processed in addition to the core modify DN
160   * processing.  Backends may read this list to identify which attribute-level
161   * changes were applied in order to more easily apply updates to attribute
162   * indexes.
163   *
164   * @return  The set of modifications applied to attributes during the course
165   *          of the modify DN processing, or <CODE>null</CODE> if that
166   *          information is not yet available (e.g., during pre-parse plugins).
167   */
168  List<Modification> getModifications();
169
170  /**
171   * Adds the provided modification to the set of modifications to be applied
172   * as part of the update.  This should only be called by pre-operation
173   * plugins.
174   *
175   * @param  modification  The modification to add to the set of modifications
176   *                       to apply to the entry.
177   */
178  void addModification(Modification modification);
179
180  /**
181   * Retrieves the current entry, before it is renamed.  This will not be
182   * available to pre-parse plugins or during the conflict resolution portion of
183   * the synchronization processing.
184   *
185   * @return  The current entry, or <CODE>null</CODE> if it is not yet
186   *           available.
187   */
188  Entry getOriginalEntry();
189
190
191  /**
192   * Retrieves the new entry, as it will appear after it is renamed.  This will
193   * not be  available to pre-parse plugins or during the conflict resolution
194   * portion of the synchronization processing.
195   *
196   * @return  The updated entry, or <CODE>null</CODE> if it is not yet
197   *           available.
198   */
199  Entry getUpdatedEntry();
200
201  /**
202   * Retrieves the proxied authorization DN for this operation if proxied
203   * authorization has been requested.
204   *
205   * @return  The proxied authorization DN for this operation if proxied
206   *          authorization has been requested, or {@code null} if proxied
207   *          authorization has not been requested.
208   */
209  DN getProxiedAuthorizationDN();
210
211
212  /**
213   * Sets the proxied authorization DN for this operation if proxied
214   * authorization has been requested.
215   *
216   * @param dn  The proxied authorization DN for this operation if proxied
217   *            authorization has been requested, or {@code null} if proxied
218   *            authorization has not been requested.
219   */
220  void setProxiedAuthorizationDN(DN dn);
221
222}