From 9a3c2aa661a2e88ee90ef3e42ca882b2d9dde7cf Mon Sep 17 00:00:00 2001
From: fdorson <fdorson@localhost>
Date: Tue, 07 Jul 2009 13:21:10 +0000
Subject: [PATCH] Fix for issue #4095 : Add getters methods to LDAPUpdateMsg
---
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java | 22 ++++++++++++++++++++++
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java | 19 +++++++++++++++++++
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java | 10 ++++++++++
3 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
index dd7ae4b..2c3972a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
@@ -364,6 +364,24 @@
}
/**
+ * Get the attributes of this add msg.
+ * @throws LDAPException In case of LDAP decoding exception
+ * @throws ASN1Exception In case of ASN1 decoding exception
+ * @return the list of attributes
+ */
+ public List<Attribute> getAttributes() throws LDAPException, ASN1Exception
+ {
+ List<Attribute> attrs = new ArrayList<Attribute>();
+
+ ASN1Reader reader = ASN1.getReader(encodedAttributes);
+
+ while (reader.hasNextElement())
+ attrs.add(LDAPAttribute.decode(reader).toAttribute());
+
+ return attrs;
+ }
+
+ /**
* Set the parent unique id of this add msg.
*
* @param uid the parent unique id.
@@ -394,6 +412,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public byte[] getBytes_V1() throws UnsupportedEncodingException
{
int length = encodedAttributes.length;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java
index fddd078..edf8877 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyCommonMsg.java
@@ -26,9 +26,12 @@
*/
package org.opends.server.replication.protocol;
+import java.util.ArrayList;
import java.util.List;
import org.opends.server.protocols.asn1.ASN1;
+import org.opends.server.protocols.asn1.ASN1Exception;
+import org.opends.server.protocols.asn1.ASN1Reader;
import org.opends.server.protocols.asn1.ASN1Writer;
import org.opends.server.protocols.ldap.LDAPAttribute;
import org.opends.server.protocols.ldap.LDAPModification;
@@ -38,6 +41,7 @@
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeUsage;
import org.opends.server.types.ByteStringBuilder;
+import org.opends.server.types.LDAPException;
import org.opends.server.types.Modification;
/**
@@ -97,6 +101,24 @@
}
/**
+ * Get the Modifications associated to the UpdateMsg to the provided value.
+ * @throws LDAPException In case of LDAP decoding exception
+ * @throws ASN1Exception In case of ASN1 decoding exception
+ * @return the list of modifications
+ */
+ public List<Modification> getMods() throws ASN1Exception, LDAPException
+ {
+ List<Modification> mods = new ArrayList<Modification>();
+
+ ASN1Reader reader = ASN1.getReader(encodedMods);
+
+ while (reader.hasNextElement())
+ mods.add((LDAPModification.decode(reader)).toModification());
+
+ return mods;
+ }
+
+ /**
* Encode an ArrayList of Modification into a byte[] suitable
* for storage in a database or send on the network.
*
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
index ea1e85e..c7bff36 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
@@ -401,6 +401,15 @@
}
/**
+ * Get the delete old rdn option.
+ * @return true if delete old rdn option
+ */
+ public boolean getDeleteOldRdn()
+ {
+ return deleteOldRdn;
+ }
+
+ /**
* Get the new RDN of this operation.
*
* @return The new RDN of this operation.
@@ -525,6 +534,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public byte[] getBytes_V1() throws UnsupportedEncodingException
{
if (bytes == null)
--
Gitblit v1.10.0