From 1afbb2969f0f5bb254f2c777f57803635be23a9e Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 11 Jun 2007 10:08:13 +0000
Subject: [PATCH] Final part for issue 604 : replication needs to resolve naming conflicts

---
 opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 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 f93bb98..5979842 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
@@ -57,8 +57,8 @@
 public class AddMsg extends UpdateMessage
 {
   private static final long serialVersionUID = -4905520652801395185L;
-  private final byte[] encodedAttributes;
-  private final String parentUniqueId;
+  private byte[] encodedAttributes;
+  private String parentUniqueId;
 
   /**
    * Creates a new AddMessage.
@@ -263,4 +263,32 @@
   {
     return ("ADD " + getDn() + " " + getChangeNumber());
   }
+
+  /**
+   * Add the specified attribute/attribute value in the entry contained
+   * in this AddMsg.
+   *
+   * @param name  The name of the attribute to add.
+   * @param value The value of the attribute to add.
+   * @throws ASN1Exception When this Msg is not valid.
+   */
+  public void addAttribute(String name, String value)
+         throws ASN1Exception
+  {
+    RawAttribute newAttr = new LDAPAttribute(name, value);
+    ArrayList<ASN1Element> elems;
+    elems = ASN1Element.decodeElements(encodedAttributes);
+    elems.add(newAttr.encode());
+    encodedAttributes = ASN1Element.encodeValue(elems);
+  }
+
+  /**
+   * Set the parent unique id of this add msg.
+   *
+   * @param uid the parent unique id.
+   */
+  public void setParentUid(String uid)
+  {
+    parentUniqueId = uid;
+  }
 }

--
Gitblit v1.10.0