01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.harmony.jndi.provider.ldap;
19:
20: import org.apache.harmony.jndi.provider.ldap.asn1.ASN1Decodable;
21: import org.apache.harmony.jndi.provider.ldap.asn1.ASN1Encodable;
22: import org.apache.harmony.jndi.provider.ldap.asn1.LdapASN1Constant;
23: import org.apache.harmony.jndi.provider.ldap.asn1.Utils;
24:
25: public class ModifyDNOp implements LdapOperation, ASN1Encodable {
26: private LdapResult result;
27:
28: private String entry;
29:
30: private String newrdn;
31:
32: private boolean deleteoldrdn;
33:
34: private String newSuperior;
35:
36: public ModifyDNOp(String entry, String newrdn,
37: boolean deleteoldrdn, String newSuperior) {
38: this .entry = entry;
39: this .newrdn = newrdn;
40: this .deleteoldrdn = deleteoldrdn;
41: this .newSuperior = newSuperior;
42: }
43:
44: public ASN1Encodable getRequest() {
45: return this ;
46: }
47:
48: public int getRequestId() {
49: return LdapASN1Constant.OP_MODIFY_DN_REQUEST;
50: }
51:
52: public ASN1Decodable getResponse() {
53: return result = (result == null) ? new LdapResult() : result;
54: }
55:
56: public int getResponseId() {
57: return LdapASN1Constant.OP_MODIFY_DN_RESPONSE;
58: }
59:
60: public void encodeValues(Object[] values) {
61: values[0] = Utils.getBytes(entry);
62: values[1] = Utils.getBytes(newrdn);
63: values[2] = Boolean.valueOf(deleteoldrdn);
64: if (newSuperior != null) {
65: values[3] = Utils.getBytes(newSuperior);
66: }
67: }
68:
69: public LdapResult getResult() {
70: return result;
71: }
72:
73: public boolean isDeleteoldrdn() {
74: return deleteoldrdn;
75: }
76:
77: public String getEntry() {
78: return entry;
79: }
80:
81: public String getNewrdn() {
82: return newrdn;
83: }
84:
85: public String getNewSuperior() {
86: return newSuperior;
87: }
88:
89: }
|