001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.shared.ldap.message;
021
022 import org.apache.directory.shared.ldap.name.LdapDN;
023 import org.apache.directory.shared.ldap.name.Rdn;
024
025
026 /**
027 * Modify DN request protocol message used to rename or move an existing entry
028 * in the directory. Here's what <a
029 * href="http://www.faqs.org/rfcs/rfc2251.html">RFC 2251</a> has to say about
030 * it:
031 *
032 * <pre>
033 * 4.9. Modify DN Operation
034 *
035 * The Modify DN Operation allows a client to change the leftmost (least
036 * significant) component of the name of an entry in the directory, or
037 * to move a subtree of entries to a new location in the directory. The
038 * Modify DN Request is defined as follows:
039 *
040 * ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
041 * entry LDAPDN,
042 * newrdn RelativeLDAPDN,
043 * deleteoldrdn BOOLEAN,
044 * newSuperior [0] LDAPDN OPTIONAL }
045 *
046 * Parameters of the Modify DN Request are:
047 *
048 * - entry: the Distinguished Name of the entry to be changed. This
049 * entry may or may not have subordinate entries.
050 *
051 * - newrdn: the RDN that will form the leftmost component of the new
052 * name of the entry.
053 *
054 * - deleteoldrdn: a boolean parameter that controls whether the old RDN
055 * attribute values are to be retained as attributes of the entry, or
056 * deleted from the entry.
057 *
058 * - newSuperior: if present, this is the Distinguished Name of the entry
059 * which becomes the immediate superior of the existing entry.
060 * </pre>
061 *
062 * Note that this operation can move an entry and change its Rdn at the same
063 * time in fact it might have no choice to comply with name forms.
064 *
065 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
066 * @version $Revision: 764131 $
067 */
068 public interface InternalModifyDnRequest extends SingleReplyRequest, InternalAbandonableRequest
069 {
070 /** Modify DN request message type enumeration value */
071 MessageTypeEnum TYPE = MessageTypeEnum.MOD_DN_REQUEST;
072
073 /** Modify DN response message type enumeration value */
074 MessageTypeEnum RESP_TYPE = InternalModifyDnResponse.TYPE;
075
076
077 /**
078 * Gets the entry's distinguished name representing the <b>entry</b> PDU
079 * field.
080 *
081 * @return the distinguished name of the entry.
082 */
083 LdapDN getName();
084
085
086 /**
087 * Sets the entry's distinguished name representing the <b>entry</b> PDU
088 * field.
089 *
090 * @param name
091 * the distinguished name of the entry.
092 */
093 void setName( LdapDN name );
094
095
096 /**
097 * Gets the new relative distinguished name for the entry which represents
098 * the PDU's <b>newrdn</b> field.
099 *
100 * @return the relative dn with one component
101 */
102 Rdn getNewRdn();
103
104
105 /**
106 * Sets the new relative distinguished name for the entry which represents
107 * the PDU's <b>newrdn</b> field.
108 *
109 * @param newRdn
110 * the relative dn with one component
111 */
112 void setNewRdn( Rdn newRdn );
113
114
115 /**
116 * Gets the flag which determines if the old Rdn attribute is to be removed
117 * from the entry when the new Rdn is used in its stead. This property
118 * corresponds to the <b>deleteoldrdn
119 * </p>
120 * PDU field.
121 *
122 * @return true if the old rdn is to be deleted, false if it is not
123 */
124 boolean getDeleteOldRdn();
125
126
127 /**
128 * Sets the flag which determines if the old Rdn attribute is to be removed
129 * from the entry when the new Rdn is used in its stead. This property
130 * corresponds to the <b>deleteoldrdn
131 * </p>
132 * PDU field.
133 *
134 * @param deleteOldRdn
135 * true if the old rdn is to be deleted, false if it is not
136 */
137 void setDeleteOldRdn( boolean deleteOldRdn );
138
139
140 /**
141 * Gets 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.
145 *
146 * @return the dn of the superior entry the candidate entry is moved under.
147 */
148 LdapDN getNewSuperior();
149
150
151 /**
152 * Sets the optional distinguished name of the new superior entry where the
153 * candidate entry is to be moved. This property corresponds to the PDU's
154 * <b>newSuperior</b> field. May be null representing a simple Rdn change
155 * rather than a move operation. Setting this property to a non-null value
156 * toggles the move flag obtained via the <code>isMove</code> method.
157 *
158 * @param newSuperior
159 * the dn of the superior entry the candidate entry for DN
160 * modification is moved under.
161 */
162 void setNewSuperior( LdapDN newSuperior );
163
164
165 /**
166 * Gets whether or not this request is a DN change resulting in a move
167 * operation. Setting the newSuperior property to a non-null name, toggles
168 * this flag.
169 *
170 * @return true if the newSuperior property is <b>NOT</b> null, false
171 * otherwise.
172 */
173 boolean isMove();
174 }