View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.model.message;
21  
22  
23  import org.apache.directory.api.ldap.model.name.Dn;
24  import org.apache.directory.api.ldap.model.name.Rdn;
25  
26  
27  /**
28   * Modify Dn request protocol message used to rename or move an existing entry
29   * in the directory. Here's what <a
30   * href="http://www.faqs.org/rfcs/rfc2251.html">RFC 2251</a> has to say about
31   * it:
32   * 
33   * <pre>
34   *  4.9. Modify Dn Operation
35   * 
36   *   The Modify Dn Operation allows a client to change the leftmost (least
37   *   significant) component of the name of an entry in the directory, or
38   *   to move a subtree of entries to a new location in the directory.  The
39   *   Modify Dn Request is defined as follows:
40   * 
41   *        ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
42   *                entry           LDAPDN,
43   *                newrdn          RelativeLDAPDN,
44   *                deleteoldrdn    BOOLEAN,
45   *                newSuperior     [0] LDAPDN OPTIONAL }
46   * 
47   *   Parameters of the Modify Dn Request are:
48   * 
49   *   - entry: the Distinguished Name of the entry to be changed.  This
50   *     entry may or may not have subordinate entries.
51   * 
52   *   - newrdn: the Rdn that will form the leftmost component of the new
53   *     name of the entry.
54   * 
55   *   - deleteoldrdn: a boolean parameter that controls whether the old Rdn
56   *     attribute values are to be retained as attributes of the entry, or
57   *     deleted from the entry.
58   * 
59   *   - newSuperior: if present, this is the Distinguished Name of the entry
60   *     which becomes the immediate superior of the existing entry.
61   * </pre>
62   * 
63   * Note that this operation can move an entry and change its Rdn at the same
64   * time in fact it might have no choice to comply with name forms.
65   * 
66   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
67   */
68  public interface ModifyDnRequest extends SingleReplyRequest, AbandonableRequest
69  {
70      /**
71       * Gets the entry's distinguished name representing the <b>entry</b> PDU
72       * field.
73       * 
74       * @return the distinguished name of the entry.
75       */
76      Dn getName();
77  
78  
79      /**
80       * Sets the entry's distinguished name representing the <b>entry</b> PDU
81       * field.
82       * 
83       * @param name the distinguished name of the entry.
84       * @return The ModifyDnRequest instance
85       */
86      ModifyDnRequest setName( Dn name );
87  
88  
89      /**
90       * Gets the new relative distinguished name for the entry which represents
91       * the PDU's <b>newrdn</b> field.
92       * 
93       * @return the relative dn with one component
94       */
95      Rdn getNewRdn();
96  
97  
98      /**
99       * Sets the new relative distinguished name for the entry which represents
100      * the PDU's <b>newrdn</b> field.
101      * 
102      * @param newRdn the relative dn with one component
103      * @return The ModifyDnRequest instance
104      */
105     ModifyDnRequest setNewRdn( Rdn newRdn );
106 
107 
108     /**
109      * Gets the flag which determines if the old Rdn attribute is to be removed
110      * from the entry when the new Rdn is used in its stead. This property
111      * corresponds to the <b>deleteoldrdn</b>.
112      * 
113      * @return true if the old rdn is to be deleted, false if it is not
114      */
115     boolean getDeleteOldRdn();
116 
117 
118     /**
119      * Sets the flag which determines if the old Rdn attribute is to be removed
120      * from the entry when the new Rdn is used in its stead. This property
121      * corresponds to the <b>deleteoldrdn</b>.
122      * 
123      * @param deleteOldRdn true if the old rdn is to be deleted, false if it is not
124      * @return The ModifyDnRequest instance
125      */
126     ModifyDnRequest setDeleteOldRdn( boolean deleteOldRdn );
127 
128 
129     /**
130      * Gets the optional distinguished name of the new superior entry where the
131      * candidate entry is to be moved. This property corresponds to the PDU's
132      * <b>newSuperior</b> field. May be null representing a simple Rdn change
133      * rather than a move operation.
134      * 
135      * @return the dn of the superior entry the candidate entry is moved under.
136      */
137     Dn getNewSuperior();
138 
139 
140     /**
141      * Sets the optional distinguished name of the new superior entry where the
142      * candidate entry is to be moved. This property corresponds to the PDU's
143      * <b>newSuperior</b> field. May be null representing a simple Rdn change
144      * rather than a move operation. Setting this property to a non-null value
145      * toggles the move flag obtained via the <code>isMove</code> method.
146      * 
147      * @param newSuperior the dn of the superior entry the candidate entry for Dn
148      * modification is moved under.
149      * @return The ModifyDnRequest instance
150      */
151     ModifyDnRequest setNewSuperior( Dn newSuperior );
152 
153 
154     /**
155      * Gets whether or not this request is a Dn change resulting in a move
156      * operation. Setting the newSuperior property to a non-null name, toggles
157      * this flag.
158      * 
159      * @return true if the newSuperior property is <b>NOT</b> null, false
160      * otherwise.
161      */
162     boolean isMove();
163 
164 
165     /**
166      * {@inheritDoc}
167      */
168     ModifyDnRequest setMessageId( int messageId );
169 
170 
171     /**
172      * {@inheritDoc}
173      */
174     ModifyDnRequest addControl( Control control );
175 
176 
177     /**
178      * {@inheritDoc}
179      */
180     ModifyDnRequest addAllControls( Control[] controls );
181 
182 
183     /**
184      * {@inheritDoc}
185      */
186     ModifyDnRequest removeControl( Control control );
187 }