From 2a6a436cf43f43eeb25210a5c72301a932598d1c Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 05 Aug 2016 10:14:28 +0000
Subject: [PATCH] Partial OPENDJ-3106 Migrate Entry

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index 38bb08e..282f166 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -214,8 +214,7 @@
     // attributes that we don't recognize will be included directly in the
     // schema entry.
     userDefinedAttributes = new ArrayList<>();
-    addAllNonSchemaConfigAttributes(userDefinedAttributes, configEntry.getUserAttributes().values());
-    addAllNonSchemaConfigAttributes(userDefinedAttributes, configEntry.getOperationalAttributes().values());
+    addAllNonSchemaConfigAttributes(userDefinedAttributes, configEntry.getAllAttributes());
 
     currentConfig = cfg;
   }
@@ -2802,8 +2801,7 @@
     try
     {
       Entry configEntry = DirectoryServer.getConfigEntry(configEntryDN);
-      addAllNonSchemaConfigAttributes(newUserAttrs, configEntry.getUserAttributes().values());
-      addAllNonSchemaConfigAttributes(newUserAttrs, configEntry.getOperationalAttributes().values());
+      addAllNonSchemaConfigAttributes(newUserAttrs, configEntry.getAllAttributes());
     }
     catch (ConfigException e)
     {
@@ -2870,16 +2868,13 @@
     return ccr;
   }
 
-  private void addAllNonSchemaConfigAttributes(List<Attribute> newUserAttrs, Collection<List<Attribute>> attributes)
+  private void addAllNonSchemaConfigAttributes(List<Attribute> newUserAttrs, Iterable<Attribute> attributes)
   {
-    for (List<Attribute> attrs : attributes)
+    for (Attribute a : attributes)
     {
-      for (Attribute a : attrs)
+      if (!isSchemaConfigAttribute(a))
       {
-        if (!isSchemaConfigAttribute(a))
-        {
-          newUserAttrs.add(a);
-        }
+        newUserAttrs.add(a);
       }
     }
   }

--
Gitblit v1.10.0