(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap / LdapModifyDNRequest.cs
blobe487b8bf3f59a45ea9006a9d764aeeb7f1df48eb
1 /******************************************************************************
2 * The MIT License
3 * Copyright (c) 2003 Novell Inc. www.novell.com
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *******************************************************************************/
24 // Novell.Directory.Ldap.LdapModifyDNRequest.cs
26 // Author:
27 // Sunil Kumar (Sunilk@novell.com)
29 // (C) 2003 Novell, Inc (http://www.novell.com)
32 using System;
33 using Novell.Directory.Ldap.Asn1;
34 using Novell.Directory.Ldap.Rfc2251;
36 namespace Novell.Directory.Ldap
39 /// <summary> Represents an Ldap ModifyDN request
40 ///
41 /// </summary>
42 /// <seealso cref="LdapConnection.SendRequest">
43 /// </seealso>
45 * ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
46 * entry LdapDN,
47 * newrdn RelativeLdapDN,
48 * deleteoldrdn BOOLEAN,
49 * newSuperior [0] LdapDN OPTIONAL }
51 public class LdapModifyDNRequest:LdapMessage
53 /// <summary> Returns the dn of the entry to rename or move in the directory
54 ///
55 /// </summary>
56 /// <returns> the dn of the entry to rename or move
57 /// </returns>
58 virtual public System.String DN
60 get
62 return Asn1Object.RequestDN;
66 /// <summary> Returns the newRDN of the entry to rename or move in the directory
67 ///
68 /// </summary>
69 /// <returns> the newRDN of the entry to rename or move
70 /// </returns>
71 virtual public System.String NewRDN
73 get
75 // Get the RFC request object for this request
76 RfcModifyDNRequest req = (RfcModifyDNRequest) Asn1Object.getRequest();
77 RfcRelativeLdapDN relDN = (RfcRelativeLdapDN) req.toArray()[1];
78 return relDN.stringValue();
82 /// <summary> Returns the DeleteOldRDN flag that applies to the entry to rename or
83 /// move in the directory
84 ///
85 /// </summary>
86 /// <returns> the DeleteOldRDN flag for the entry to rename or move
87 /// </returns>
88 virtual public bool DeleteOldRDN
90 get
92 // Get the RFC request object for this request
93 RfcModifyDNRequest req = (RfcModifyDNRequest) Asn1Object.getRequest();
94 Asn1Boolean delOld = (Asn1Boolean) req.toArray()[2];
95 return delOld.booleanValue();
99 /// <summary> Returns the ParentDN for the entry move in the directory
100 ///
101 /// </summary>
102 /// <returns> the ParentDN for the entry to move, or <dd>null</dd>
103 /// if the request is not a move.
104 /// </returns>
105 virtual public System.String ParentDN
109 // Get the RFC request object for this request
110 RfcModifyDNRequest req = (RfcModifyDNRequest) Asn1Object.getRequest();
111 Asn1Object[] seq = req.toArray();
112 if ((seq.Length < 4) || (seq[3] == null))
114 return null;
116 RfcLdapDN parentDN = (RfcLdapDN) req.toArray()[3];
117 return parentDN.stringValue();
121 /// <summary> Constructs a ModifyDN (rename) Request.
122 ///
123 /// </summary>
124 /// <param name="dn"> The current distinguished name of the entry.
125 ///
126 /// </param>
127 /// <param name="newRdn"> The new relative distinguished name for the entry.
128 ///
129 /// </param>
130 /// <param name="newParentdn"> The distinguished name of an existing entry which
131 /// is to be the new parent of the entry.
132 ///
133 /// </param>
134 /// <param name="deleteOldRdn"> If true, the old name is not retained as an
135 /// attribute value. If false, the old name is
136 /// retained as an attribute value.
137 ///
138 /// </param>
139 /// <param name="cont"> Any controls that apply to the modifyDN request,
140 /// or null if none.
141 /// </param>
142 public LdapModifyDNRequest(System.String dn, System.String newRdn, System.String newParentdn, bool deleteOldRdn, LdapControl[] cont):base(LdapMessage.MODIFY_RDN_REQUEST, new RfcModifyDNRequest(new RfcLdapDN(dn), new RfcRelativeLdapDN(newRdn), new Asn1Boolean(deleteOldRdn), ((System.Object) newParentdn != null)?new RfcLdapDN(newParentdn):null), cont)
144 return ;
147 /// <summary> Return an Asn1 representation of this mod DN request
148 ///
149 /// #return an Asn1 representation of this object
150 /// </summary>
151 public override System.String ToString()
153 return Asn1Object.ToString();