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