From 1b570922c1772fde4fbd44855453dbd86bb9e276 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 29 Mar 2016 16:17:05 +0000
Subject: [PATCH] Prep work for OPENDJ-2803 Migrate Attribute

---
 opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java             |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java                                            |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java                              |   14 +-
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java                         |    2 
 opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java                                     |    4 
 opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java                              |   26 ++--
 opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java                          |   18 +-
 opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java                       |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java                                   |   14 +-
 opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java                                   |    2 
 opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java      |    4 
 opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java                                            |    4 
 opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java                                     |   18 +--
 opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java                                 |   10 +-
 opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java                                    |   13 --
 opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java                              |    4 
 opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java                                  |    2 
 opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java                                             |    2 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java                |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java                               |   14 +-
 opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java                                  |    2 
 opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java   |   65 +++++++-----
 opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java |    4 
 opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java                |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java                      |   24 ++--
 opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java                         |   12 +-
 opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java                                            |    7 -
 opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java                                                |   24 ++--
 28 files changed, 144 insertions(+), 155 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
index eb2574e..732a2a9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -285,7 +285,7 @@
     {
       final org.opends.server.types.Attribute attribute =
         LDIFReader.parseAttrDescription(wholeName);
-      final String attrName = attribute.getName();
+      final String attrName = attribute.getAttributeDescription().getNameOrOID();
 
       // See if this is an objectclass or an attribute.  Then get the
       // corresponding definition and add the value to the appropriate hash.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
index a98e54b..ee4ac33 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -641,7 +641,7 @@
     for (String wholeName : csr.getAttributeNames())
     {
       final Attribute attribute = parseAttrDescription(wholeName);
-      final String attrName = attribute.getName();
+      final String attrName = attribute.getAttributeDescription().getNameOrOID();
 
       // See if this is an objectclass or an attribute.  Then get the
       // corresponding definition and add the value to the appropriate hash.
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 224dba4..bb6c3ec 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
@@ -925,9 +925,8 @@
           else
           {
             LocalizableMessage message =
-                ERR_SCHEMA_MODIFY_UNSUPPORTED_ATTRIBUTE_TYPE.get(a.getName());
-            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
-                message);
+                ERR_SCHEMA_MODIFY_UNSUPPORTED_ATTRIBUTE_TYPE.get(a.getAttributeDescription().getNameOrOID());
+            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
           }
 
           break;
@@ -937,9 +936,8 @@
           if (a.isEmpty())
           {
             LocalizableMessage message =
-                ERR_SCHEMA_MODIFY_DELETE_NO_VALUES.get(a.getName());
-            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
-                message);
+                ERR_SCHEMA_MODIFY_DELETE_NO_VALUES.get(a.getAttributeDescription().getNameOrOID());
+            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
           }
 
           if (at.equals(attributeTypesType))
@@ -1084,9 +1082,8 @@
           else
           {
             LocalizableMessage message =
-                ERR_SCHEMA_MODIFY_UNSUPPORTED_ATTRIBUTE_TYPE.get(a.getName());
-            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
-                message);
+                ERR_SCHEMA_MODIFY_UNSUPPORTED_ATTRIBUTE_TYPE.get(a.getAttributeDescription().getNameOrOID());
+            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
           }
 
           break;
@@ -1181,8 +1178,7 @@
 
       LocalizableMessage message =
           ERR_SCHEMA_MODIFY_CANNOT_WRITE_NEW_SCHEMA.get(getExceptionMessage(e));
-      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
-                                   message, e);
+      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message, e);
     }
     finally
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java
index a88e400..3a306ac 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java
@@ -404,12 +404,12 @@
           if (pendingValueSet)
           {
             // We cannot have multiple pending values.
-            throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc.getNameOrOID()));
           }
           if (a.isEmpty())
           {
             // This is illegal -- it must have a value.
-            throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
           }
 
           // Get the value and parse it as a Boolean.
@@ -437,14 +437,14 @@
           if (iterator.hasNext())
           {
             // This is illegal -- it must be single-valued.
-            throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID()));
           }
         }
         else
         {
           // This is illegal -- only the pending option is allowed for
           // configuration attributes.
-          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc.getNameOrOID()));
         }
       }
       else
@@ -453,12 +453,12 @@
         if (activeValueSet)
         {
           // We cannot have multiple active values.
-          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc.getNameOrOID()));
         }
         if (a.isEmpty())
         {
           // This is illegal -- it must have a value.
-          throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
         }
 
         // Get the value and parse it as a Boolean.
@@ -486,7 +486,7 @@
         if (iterator.hasNext())
         {
           // This is illegal -- it must be single-valued.
-          throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID()));
         }
       }
     }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java
index da0dd9c..34e528e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java
@@ -711,7 +711,7 @@
           {
             // We cannot have multiple pending value sets.
             LocalizableMessage message =
-                ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName());
+                ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc.getNameOrOID());
             throw new ConfigException(message);
           }
 
@@ -721,7 +721,7 @@
             if (isRequired())
             {
               // This is illegal -- it must have a value.
-              throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+              throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
             }
             // This is fine. The pending value set can be empty.
             pendingValues = new ArrayList<>(0);
@@ -732,7 +732,7 @@
             if (numValues > 1 && !isMultiValued())
             {
               // This is illegal -- the attribute is single-valued.
-              throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()));
+              throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID()));
             }
 
             pendingValues = new ArrayList<>(numValues);
@@ -760,7 +760,7 @@
           // This is illegal -- only the pending option is allowed for
           // configuration attributes.
           throw new ConfigException(
-              ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(a.getName()));
+              ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc.getNameOrOID()));
         }
       }
       else
@@ -770,7 +770,7 @@
         {
           // We cannot have multiple active value sets.
           throw new ConfigException(
-              ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName()));
+              ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc.getNameOrOID()));
         }
 
 
@@ -779,7 +779,7 @@
           if (isRequired())
           {
             // This is illegal -- it must have a value.
-            throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
           }
           // This is fine. The active value set can be empty.
           activeValues = new ArrayList<>(0);
@@ -790,7 +790,7 @@
           if (numValues > 1 && !isMultiValued())
           {
             // This is illegal -- the attribute is single-valued.
-            throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID()));
           }
 
           activeValues = new ArrayList<>(numValues);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
index 5215cf4..678149b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
@@ -905,7 +905,7 @@
           {
             // We cannot have multiple pending value sets.
             LocalizableMessage message =
-                ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName());
+                ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getAttributeDescription().getNameOrOID());
             throw new ConfigException(message);
           }
 
@@ -914,7 +914,7 @@
             if (isRequired())
             {
               // This is illegal -- it must have a value.
-              LocalizableMessage message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName());
+              LocalizableMessage message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getAttributeDescription().getNameOrOID());
               throw new ConfigException(message);
             }
             else
@@ -930,7 +930,7 @@
             {
               // This is illegal -- the attribute is single-valued.
               LocalizableMessage message =
-                  ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName());
+                  ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getAttributeDescription().getNameOrOID());
               throw new ConfigException(message);
             }
 
@@ -945,7 +945,7 @@
               catch (Exception e)
               {
                 LocalizableMessage message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get(
-                    v, a.getName(), e);
+                    v, a.getAttributeDescription().getNameOrOID(), e);
                 throw new ConfigException(message, e);
               }
 
@@ -953,14 +953,14 @@
               if (hasLowerBound && longValue < lowerBound)
               {
                 LocalizableMessage message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(
-                    a.getName(), longValue, lowerBound);
+                    a.getAttributeDescription().getNameOrOID(), longValue, lowerBound);
                 throw new ConfigException(message);
               }
 
               if (hasUpperBound && longValue > upperBound)
               {
                 LocalizableMessage message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(
-                    a.getName(), longValue, upperBound);
+                    a.getAttributeDescription().getNameOrOID(), longValue, upperBound);
                 throw new ConfigException(message);
               }
 
@@ -974,7 +974,7 @@
           // configuration attributes.
           LocalizableMessage message =
               ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(
-                      a.getName());
+                      a.getAttributeDescription().getNameOrOID());
           throw new ConfigException(message);
         }
       }
@@ -985,7 +985,7 @@
         {
           // We cannot have multiple active value sets.
           LocalizableMessage message =
-              ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName());
+              ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getAttributeDescription().getNameOrOID());
           throw new ConfigException(message);
         }
 
@@ -994,7 +994,7 @@
           if (isRequired())
           {
             // This is illegal -- it must have a value.
-            LocalizableMessage message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName());
+            LocalizableMessage message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getAttributeDescription().getNameOrOID());
             throw new ConfigException(message);
           }
           else
@@ -1010,7 +1010,7 @@
           {
             // This is illegal -- the attribute is single-valued.
             LocalizableMessage message =
-                ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName());
+                ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getAttributeDescription().getNameOrOID());
             throw new ConfigException(message);
           }
 
@@ -1025,7 +1025,7 @@
             catch (Exception e)
             {
               LocalizableMessage message = ERR_CONFIG_ATTR_INT_COULD_NOT_PARSE.get(
-                  v, a.getName(), e);
+                  v, a.getAttributeDescription().getNameOrOID(), e);
               throw new ConfigException(message, e);
             }
 
@@ -1033,14 +1033,14 @@
             if (hasLowerBound && longValue < lowerBound)
             {
               LocalizableMessage message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(
-                  a.getName(), longValue, lowerBound);
+                  a.getAttributeDescription().getNameOrOID(), longValue, lowerBound);
               throw new ConfigException(message);
             }
 
             if (hasUpperBound && longValue > upperBound)
             {
               LocalizableMessage message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(
-                  a.getName(), longValue, upperBound);
+                  a.getAttributeDescription().getNameOrOID(), longValue, upperBound);
               throw new ConfigException(message);
             }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
index 7b75d7a..545022d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
@@ -874,12 +874,12 @@
         if (!attrDesc.hasOption(OPTION_PENDING_VALUES))
         {
           // This is illegal -- only the pending option is allowed for configuration attributes.
-          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc.getNameOrOID()));
         }
         if (pendingUnit != null)
         {
           // We cannot have multiple pending value sets.
-          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc.getNameOrOID()));
         }
 
         String valueString = getValue(a);
@@ -891,7 +891,8 @@
         }
         catch (Exception e)
         {
-          throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(valueString, a.getName(), e));
+          throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(
+              valueString, attrDesc.getNameOrOID(), e));
         }
 
         pendingCalculatedValue = calculateValue(pendingIntValue, activeUnit, pendingUnit, a);
@@ -902,7 +903,7 @@
         if (activeUnit != null)
         {
           // We cannot have multiple active value sets.
-          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc.getNameOrOID()));
         }
 
         String valueString = getValue(a);
@@ -914,7 +915,8 @@
         }
         catch (Exception e)
         {
-          throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(valueString, a.getName(), e));
+          throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(
+              valueString, attrDesc.getNameOrOID(), e));
         }
 
         activeCalculatedValue = calculateValue(activeIntValue, activeUnit, activeUnit, a);
@@ -945,10 +947,11 @@
 
   private String getValue(Attribute a) throws ConfigException
   {
+    AttributeDescription attrDesc = a.getAttributeDescription();
     if (a.isEmpty())
     {
       // This is illegal -- it must have a value.
-      throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+      throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
     }
 
     Iterator<ByteString> iterator = a.iterator();
@@ -956,7 +959,7 @@
     if (iterator.hasNext())
     {
       // This is illegal -- the attribute is single-valued.
-      throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName()));
+      throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID()));
     }
     return valueString;
   }
@@ -964,9 +967,10 @@
   private long calculateValue(long intValue, String activeUnit, String pendingUnit, Attribute a) throws ConfigException
   {
     // Get the unit and use it to determine the corresponding multiplier.
+    AttributeDescription attrDesc = a.getAttributeDescription();
     if (!units.containsKey(pendingUnit))
     {
-      throw new ConfigException(ERR_CONFIG_ATTR_INVALID_UNIT.get(pendingUnit, a.getName()));
+      throw new ConfigException(ERR_CONFIG_ATTR_INVALID_UNIT.get(pendingUnit, attrDesc.getNameOrOID()));
     }
 
     double multiplier = units.get(activeUnit);
@@ -975,11 +979,11 @@
     // Check the bounds set for this attribute.
     if (hasLowerBound && result < lowerBound)
     {
-      throw new ConfigException(ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(a.getName(), result, lowerBound));
+      throw new ConfigException(ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(attrDesc.getNameOrOID(), result, lowerBound));
     }
     if (hasUpperBound && result > upperBound)
     {
-      throw new ConfigException(ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(a.getName(), result, upperBound));
+      throw new ConfigException(ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(attrDesc.getNameOrOID(), result, upperBound));
     }
     return result;
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
index d407297..29fb25a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -588,7 +588,7 @@
     {
       for (org.opends.server.types.Attribute a : monitor.getMonitorData())
       {
-        attrs.add(new MBeanAttributeInfo(a.getName(), String.class.getName(),
+        attrs.add(new MBeanAttributeInfo(a.getAttributeDescription().getNameOrOID(), String.class.getName(),
                                          null, true, false, false));
       }
     }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
index 4d64a78..afc0c8b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
@@ -705,7 +705,7 @@
           {
             // We cannot have multiple pending value sets.
             LocalizableMessage message =
-                ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName());
+                ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc.getNameOrOID());
             throw new ConfigException(message);
           }
 
@@ -715,7 +715,7 @@
             if (isRequired())
             {
               // This is illegal -- it must have a value.
-              throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+              throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
             }
             // This is fine. The pending value set can be empty.
             pendingValues = new ArrayList<>(0);
@@ -727,7 +727,7 @@
             {
               // This is illegal -- the attribute is single-valued.
               LocalizableMessage message =
-                  ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName());
+                  ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID());
               throw new ConfigException(message);
             }
 
@@ -738,7 +738,7 @@
               if (! allowedValues.contains(lowerValue))
               {
                 // This is illegal -- the value is not allowed.
-                throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(v, a.getName()));
+                throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(v, attrDesc.getNameOrOID()));
               }
 
               pendingValues.add(v.toString());
@@ -750,7 +750,7 @@
           // This is illegal -- only the pending option is allowed for
           // configuration attributes.
           LocalizableMessage message =
-              ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(a.getName());
+              ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc.getNameOrOID());
           throw new ConfigException(message);
         }
       }
@@ -761,7 +761,7 @@
         {
           // We cannot have multiple active value sets.
           LocalizableMessage message =
-              ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName());
+              ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc.getNameOrOID());
           throw new ConfigException(message);
         }
 
@@ -771,7 +771,7 @@
           if (isRequired())
           {
             // This is illegal -- it must have a value.
-            LocalizableMessage message = ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName());
+            LocalizableMessage message = ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID());
             throw new ConfigException(message);
           }
           // This is fine. The active value set can be empty.
@@ -784,7 +784,7 @@
           {
             // This is illegal -- the attribute is single-valued.
             LocalizableMessage message =
-                ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName());
+                ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID());
             throw new ConfigException(message);
           }
 
@@ -795,7 +795,7 @@
             if (! allowedValues.contains(lowerValue))
             {
               // This is illegal -- the value is not allowed.
-              throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(v, a.getName()));
+              throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(v, attrDesc.getNameOrOID()));
             }
 
             activeValues.add(v.toString());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
index 9c194ea..d3d791e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
@@ -634,7 +634,7 @@
           if (pendingValues != null)
           {
             // We cannot have multiple pending value sets.
-            throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc.getNameOrOID()));
           }
 
 
@@ -643,7 +643,7 @@
             if (isRequired())
             {
               // This is illegal -- it must have a value.
-              throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+              throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
             }
             // This is fine. The pending value set can be empty.
             pendingValues = new ArrayList<>(0);
@@ -655,7 +655,7 @@
             {
               // This is illegal -- the attribute is single-valued.
               LocalizableMessage message =
-                  ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName());
+                  ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID());
               throw new ConfigException(message);
             }
 
@@ -670,7 +670,7 @@
         {
           // This is illegal -- only the pending option is allowed for
           // configuration attributes.
-          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc.getNameOrOID()));
         }
       }
       else
@@ -679,7 +679,7 @@
         if (activeValues!= null)
         {
           // We cannot have multiple active value sets.
-          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(a.getName()));
+          throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc.getNameOrOID()));
         }
 
 
@@ -688,7 +688,7 @@
           if (isRequired())
           {
             // This is illegal -- it must have a value.
-            throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(a.getName()));
+            throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
           }
           // This is fine. The active value set can be empty.
           activeValues = new ArrayList<>(0);
@@ -700,7 +700,7 @@
           {
             // This is illegal -- the attribute is single-valued.
             LocalizableMessage message =
-                ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(a.getName());
+                ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID());
             throw new ConfigException(message);
           }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java b/opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java
index 7c65789..2cd077b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java
@@ -299,7 +299,7 @@
               && !isSynchronizationOperation())
           {
             throw new LDAPException(LDAPResultCode.UNWILLING_TO_PERFORM,
-                ERR_ADD_ATTR_IS_NO_USER_MOD.get(entryDN, attr.getName()));
+                ERR_ADD_ATTR_IS_NO_USER_MOD.get(entryDN, attr.getAttributeDescription().getNameOrOID()));
           }
 
           boolean hasBinaryOption = attr.getAttributeDescription().hasOption("binary");
@@ -317,7 +317,7 @@
           {
             // binary option is not honored for non-BER-encodable attributes.
             throw new LDAPException(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
-                ERR_ADD_ATTR_IS_INVALID_OPTION.get(entryDN, attr.getName()));
+                ERR_ADD_ATTR_IS_INVALID_OPTION.get(entryDN, attr.getAttributeDescription().getNameOrOID()));
           }
 
           if (attrType.isObjectClass())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java b/opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java
index ab252eb..5e16d4c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java
@@ -215,7 +215,7 @@
            {
              // binary option is not honored for non-BER-encodable attributes.
              throw new LDAPException(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
-                 ERR_ADD_ATTR_IS_INVALID_OPTION.get(entryDN, attr.getName()));
+                 ERR_ADD_ATTR_IS_INVALID_OPTION.get(entryDN, attr.getAttributeDescription().getNameOrOID()));
            }
 
            modifications.add(mod);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java
index e705964..9676b9e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/SchemaConfigManager.java
@@ -471,7 +471,7 @@
     {
       if (!isSchemaAttribute(attribute))
       {
-        schema.addExtraAttribute(attribute.getName(), attribute);
+        schema.addExtraAttribute(attribute.getAttributeDescription().getNameOrOID(), attribute);
       }
     }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
index 9a296fc..b6f8638 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
@@ -415,7 +415,7 @@
       }
 
       Attribute a = mod.getAttribute();
-      buffer.append(a.getName());
+      buffer.append(a.getAttributeDescription().getNameOrOID());
       buffer.append(EOL);
 
       append(buffer, a);
@@ -428,7 +428,7 @@
   {
     for (ByteString v : a)
     {
-      buffer.append(a.getName());
+      buffer.append(a.getAttributeDescription().getNameOrOID());
       buffer.append(":");
       encodeValue(v, buffer);
       buffer.append(EOL);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
index b854e2b..a08bd4b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -43,7 +43,9 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.config.server.ConfigChangeResult;
 import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.ModificationType;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.SearchScope;
@@ -67,7 +69,6 @@
 import org.opends.server.protocols.internal.SearchRequest;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.Attributes;
-import org.forgerock.opendj.ldap.DN;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.IndexType;
@@ -1149,6 +1150,7 @@
   {
     try
     {
+      AttributeDescription attrDesc = attr.getAttributeDescription();
       for (ByteString attrVal : attr)
       {
         DN valueEntryDN = DN.valueOf(attrVal);
@@ -1158,7 +1160,7 @@
             && valueEntryDN.isInScopeOf(entryBaseDN, SearchScope.SUBORDINATES))
         {
           return PluginResult.PreOperation.stopProcessing(ResultCode.CONSTRAINT_VIOLATION,
-              ERR_PLUGIN_REFERENT_NAMINGCONTEXT_MISMATCH.get(valueEntryDN, attr.getName(), entryDN));
+              ERR_PLUGIN_REFERENT_NAMINGCONTEXT_MISMATCH.get(valueEntryDN, attrDesc.getNameOrOID(), entryDN));
         }
         valueEntry = DirectoryServer.getEntry(valueEntryDN);
 
@@ -1166,15 +1168,15 @@
         if (valueEntry == null)
         {
           return PluginResult.PreOperation.stopProcessing(ResultCode.CONSTRAINT_VIOLATION,
-            ERR_PLUGIN_REFERENT_ENTRY_MISSING.get(valueEntryDN, attr.getName(), entryDN));
+            ERR_PLUGIN_REFERENT_ENTRY_MISSING.get(valueEntryDN, attrDesc.getNameOrOID(), entryDN));
         }
 
         // Verify that the value entry conforms to the filter.
-        SearchFilter filter = attrFiltMap.get(attr.getAttributeDescription().getAttributeType());
+        SearchFilter filter = attrFiltMap.get(attrDesc.getAttributeType());
         if (filter != null && !filter.matchesEntry(valueEntry))
         {
           return PluginResult.PreOperation.stopProcessing(ResultCode.CONSTRAINT_VIOLATION,
-            ERR_PLUGIN_REFERENT_FILTER_MISMATCH.get(valueEntry.getName(), attr.getName(), entryDN, filter));
+            ERR_PLUGIN_REFERENT_FILTER_MISMATCH.get(valueEntry.getName(), attrDesc.getNameOrOID(), entryDN, filter));
         }
       }
     }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
index c1f5fbc..002cc14 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
@@ -887,7 +887,7 @@
       ListIterator<Modification> modIter = modifications.listIterator();
       while (modIter.hasNext())
       {
-        String name = modIter.next().getAttribute().getName().toLowerCase();
+        String name = modIter.next().getAttribute().getAttributeDescription().getNameOrOID().toLowerCase();
         if (ignoreAttrs.contains(name))
         {
             modIter.remove();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java
index 1c103a9..bdfe74a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java
@@ -83,19 +83,6 @@
     return true;
   }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * This implementation returns the primary name associated with this
-   * attribute's attribute type or, if there is no primary name, the
-   * attribute type's OID.
-   */
-  @Override
-  public String getName()
-  {
-    return getAttributeDescription().getNameOrOID();
-  }
-
   @Override
   public int hashCode()
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java
index 2f9a52b..8160f1f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java
@@ -119,13 +119,6 @@
   AttributeDescription getAttributeDescription();
 
   /**
-   * Retrieves the user-provided name for this attribute.
-   *
-   * @return The user-provided name for this attribute.
-   */
-  String getName();
-
-  /**
    * Indicates whether this attribute has any value(s) that are
    * greater than or equal to the provided value.
    *
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
index b73320d..e7b63b9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -1054,7 +1054,7 @@
     if (a == null)
     {
       LocalizableMessage message = ERR_ENTRY_INCREMENT_NO_SUCH_ATTRIBUTE.get(
-            attribute.getName());
+            attribute.getAttributeDescription().getNameOrOID());
       throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, message);
     }
 
@@ -1063,7 +1063,7 @@
     if (!i.hasNext())
     {
       LocalizableMessage message = ERR_ENTRY_INCREMENT_INVALID_VALUE_COUNT.get(
-          attribute.getName());
+          attribute.getAttributeDescription().getNameOrOID());
       throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
     }
 
@@ -1076,14 +1076,14 @@
     catch (NumberFormatException e)
     {
       LocalizableMessage message = ERR_ENTRY_INCREMENT_CANNOT_PARSE_AS_INT.get(
-          attribute.getName());
+          attribute.getAttributeDescription().getNameOrOID());
       throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
     }
 
     if (i.hasNext())
     {
       LocalizableMessage message = ERR_ENTRY_INCREMENT_INVALID_VALUE_COUNT.get(
-          attribute.getName());
+          attribute.getAttributeDescription().getNameOrOID());
       throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
     }
 
@@ -1100,7 +1100,7 @@
       catch (NumberFormatException e)
       {
         LocalizableMessage message = ERR_ENTRY_INCREMENT_CANNOT_PARSE_AS_INT.get(
-            attribute.getName());
+            attribute.getAttributeDescription().getNameOrOID());
         throw new DirectoryException(
             ResultCode.CONSTRAINT_VIOLATION, message);
       }
@@ -1377,7 +1377,7 @@
         {
           if (!relaxConstraints)
           {
-            LocalizableMessage message = ERR_ENTRY_DUPLICATE_VALUES.get(a.getName());
+            LocalizableMessage message = ERR_ENTRY_DUPLICATE_VALUES.get(a.getAttributeDescription().getNameOrOID());
             throw new DirectoryException(ATTRIBUTE_OR_VALUE_EXISTS, message);
           }
         }
@@ -1394,7 +1394,7 @@
       {
         if (objectClasses.remove(oc) == null && !relaxConstraints)
         {
-          LocalizableMessage message = ERR_ENTRY_NO_SUCH_VALUE.get(a.getName());
+          LocalizableMessage message = ERR_ENTRY_NO_SUCH_VALUE.get(a.getAttributeDescription().getNameOrOID());
           throw new DirectoryException(NO_SUCH_ATTRIBUTE, message);
         }
       }
@@ -1426,7 +1426,7 @@
       addAttribute(a, duplicateValues);
       if (!duplicateValues.isEmpty() && !relaxConstraints)
       {
-        LocalizableMessage message = ERR_ENTRY_DUPLICATE_VALUES.get(a.getName());
+        LocalizableMessage message = ERR_ENTRY_DUPLICATE_VALUES.get(a.getAttributeDescription().getNameOrOID());
         throw new DirectoryException(ATTRIBUTE_OR_VALUE_EXISTS, message);
       }
       break;
@@ -1436,7 +1436,7 @@
       removeAttribute(a, missingValues);
       if (!missingValues.isEmpty() && !relaxConstraints)
       {
-        LocalizableMessage message = ERR_ENTRY_NO_SUCH_VALUE.get(a.getName());
+        LocalizableMessage message = ERR_ENTRY_NO_SUCH_VALUE.get(a.getAttributeDescription().getNameOrOID());
         throw new DirectoryException(NO_SUCH_ATTRIBUTE, message);
       }
       break;
@@ -4480,7 +4480,7 @@
                 Attribute ocAttr = getObjectClassAttribute();
                 if (ocAttr != null)
                 {
-                  if (!attrName.equals(ocAttr.getName()))
+                  if (!attrName.equals(ocAttr.getAttributeDescription().getNameOrOID()))
                   {
                     // User requested non-default object class type name.
                     AttributeBuilder builder = new AttributeBuilder(ocAttr);
@@ -4546,7 +4546,7 @@
         AttributeDescription subAttrDesc = attribute.getAttributeDescription();
         AttributeType subAttrType = subAttrDesc.getAttributeType();
 
-        if ((attrName != null && !attrName.equals(attribute.getName()))
+        if ((attrName != null && !attrName.equals(attribute.getAttributeDescription().getNameOrOID()))
             || attrDesc.hasOptions())
         {
           AttributeBuilder builder = new AttributeBuilder();
@@ -4557,7 +4557,7 @@
           // want to rename "name" to "cn".
           if (attrName == null || !subAttrType.equals(attrDesc.getAttributeType()))
           {
-            builder.setAttributeType(subAttrType, attribute.getName());
+            builder.setAttributeType(subAttrType, attribute.getAttributeDescription().getNameOrOID());
           }
           else
           {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java
index 9688da4..0a29e11 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java
@@ -116,7 +116,7 @@
     Iterator<Attribute> iterator = attributes.iterator();
     while (iterator.hasNext())
     {
-      buffer.append(iterator.next().getName());
+      buffer.append(iterator.next().getAttributeDescription().getNameOrOID());
       if (iterator.hasNext())
       {
         buffer.append(", ");
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
index 162752b..a2ac347 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -933,7 +933,7 @@
     int colonPos = parseColonPosition(lines, line);
     String attrDescr = line.substring(0, colonPos);
     Attribute attribute = parseAttrDescription(attrDescr);
-    String attrName = attribute.getName();
+    String attrName = attribute.getAttributeDescription().getNameOrOID();
 
     if (attributeName != null)
     {
@@ -1299,7 +1299,7 @@
     {
       StringBuilder line = lines.remove();
       Attribute attr = readSingleValueAttribute(lines, line, entryDN, null);
-      String name = attr.getName();
+      String name = attr.getAttributeDescription().getNameOrOID();
 
       // Get the attribute description
       String attrDescr = attr.iterator().next().toString();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
index 6293aa7..fc26459 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -904,12 +904,12 @@
               {
                 // Value is not human-readable
                 message = WARN_ADD_OP_INVALID_SYNTAX_NO_VALUE.
-                    get(entryDN, a.getName(), invalidReason);
+                    get(entryDN, a.getAttributeDescription().getNameOrOID(), invalidReason);
               }
               else
               {
                 message = WARN_ADD_OP_INVALID_SYNTAX.
-                    get(entryDN, v, a.getName(), invalidReason);
+                    get(entryDN, v, a.getAttributeDescription().getNameOrOID(), invalidReason);
               }
 
               switch (DirectoryServer.getSyntaxEnforcementPolicy())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
index b5326be..7f54715 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -614,7 +614,7 @@
             && !isSynchronizationOperation())
         {
           throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
-              ERR_MODDN_OLD_RDN_ATTR_IS_NO_USER_MOD.get(entryDN, a.getName()));
+              ERR_MODDN_OLD_RDN_ATTR_IS_NO_USER_MOD.get(entryDN, a.getAttributeDescription().getNameOrOID()));
         }
 
         List<ByteString> missingValues = new LinkedList<>();
@@ -648,7 +648,7 @@
           if (!isInternalOperation() && !isSynchronizationOperation())
           {
             throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
-                ERR_MODDN_NEW_RDN_ATTR_IS_NO_USER_MOD.get(entryDN, a.getName()));
+                ERR_MODDN_NEW_RDN_ATTR_IS_NO_USER_MOD.get(entryDN, a.getAttributeDescription().getNameOrOID()));
           }
         }
         else
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
index f083665..31d4637 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -26,6 +26,7 @@
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg3;
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg4;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.ModificationType;
@@ -695,7 +696,8 @@
     for (Modification m : modifications)
     {
       Attribute     a = m.getAttribute();
-      AttributeType t = a.getAttributeDescription().getAttributeType();
+      AttributeDescription attrDesc = a.getAttributeDescription();
+      AttributeType t = attrDesc.getAttributeType();
 
 
       // If the attribute type is marked "NO-USER-MODIFICATION" then fail unless
@@ -705,7 +707,7 @@
       {
         throw newDirectoryException(currentEntry,
             ResultCode.CONSTRAINT_VIOLATION,
-            ERR_MODIFY_ATTR_IS_NO_USER_MOD.get(entryDN, a.getName()));
+            ERR_MODIFY_ATTR_IS_NO_USER_MOD.get(entryDN, attrDesc.getNameOrOID()));
       }
 
       // If the attribute type is marked "OBSOLETE" and the modification is
@@ -718,7 +720,7 @@
       {
         throw newDirectoryException(currentEntry,
             ResultCode.CONSTRAINT_VIOLATION,
-            ERR_MODIFY_ATTR_IS_OBSOLETE.get(entryDN, a.getName()));
+            ERR_MODIFY_ATTR_IS_OBSOLETE.get(entryDN, attrDesc.getNameOrOID()));
       }
 
 
@@ -822,9 +824,9 @@
 
     // case INCREMENT does not make any sense for passwords
     default:
-      Attribute a = m.getAttribute();
+      AttributeDescription attrDesc = m.getAttribute().getAttributeDescription();
       throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
-          ERR_MODIFY_INVALID_MOD_TYPE_FOR_PASSWORD.get(m.getModificationType(), a.getName()));
+          ERR_MODIFY_INVALID_MOD_TYPE_FOR_PASSWORD.get(m.getModificationType(), attrDesc.getNameOrOID()));
     }
   }
 
@@ -1136,10 +1138,11 @@
   private void processAddModification(Attribute attr) throws DirectoryException
   {
     // Make sure that one or more values have been provided for the attribute.
+    AttributeDescription attrDesc = attr.getAttributeDescription();
     if (attr.isEmpty())
     {
       throw newDirectoryException(currentEntry, ResultCode.PROTOCOL_ERROR,
-          ERR_MODIFY_ADD_NO_VALUES.get(entryDN, attr.getName()));
+          ERR_MODIFY_ADD_NO_VALUES.get(entryDN, attrDesc.getNameOrOID()));
     }
 
     if (mustCheckSchema())
@@ -1150,7 +1153,7 @@
 
     // If the attribute to be added is the object class attribute
     // then make sure that all the object classes are known and not obsoleted.
-    if (attr.getAttributeDescription().getAttributeType().isObjectClass())
+    if (attrDesc.getAttributeType().isObjectClass())
     {
       validateObjectClasses(attr);
     }
@@ -1165,7 +1168,7 @@
 
       throw newDirectoryException(currentEntry,
           ResultCode.ATTRIBUTE_OR_VALUE_EXISTS,
-          ERR_MODIFY_ADD_DUPLICATE_VALUE.get(entryDN, attr.getName(), duplicateValuesStr));
+          ERR_MODIFY_ADD_DUPLICATE_VALUE.get(entryDN, attrDesc.getNameOrOID(), duplicateValuesStr));
     }
   }
 
@@ -1186,7 +1189,8 @@
       Arg3<Object, Object, Object> invalidSyntaxNoValueErrorMsg) throws DirectoryException
   {
     AcceptRejectWarn syntaxPolicy = DirectoryServer.getSyntaxEnforcementPolicy();
-    Syntax syntax = attr.getAttributeDescription().getAttributeType().getSyntax();
+    AttributeDescription attrDesc = attr.getAttributeDescription();
+    Syntax syntax = attrDesc.getAttributeType().getSyntax();
 
     LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
     for (ByteString v : attr)
@@ -1194,8 +1198,8 @@
       if (!syntax.valueIsAcceptable(v, invalidReason))
       {
         LocalizableMessage msg = isHumanReadable(syntax)
-            ? invalidSyntaxErrorMsg.get(entryDN, attr.getName(), v, invalidReason)
-            : invalidSyntaxNoValueErrorMsg.get(entryDN, attr.getName(), invalidReason);
+            ? invalidSyntaxErrorMsg.get(entryDN, attrDesc.getNameOrOID(), v, invalidReason)
+            : invalidSyntaxNoValueErrorMsg.get(entryDN, attrDesc.getNameOrOID(), invalidReason);
 
         switch (syntaxPolicy)
         {
@@ -1285,20 +1289,21 @@
     List<ByteString> missingValues = new LinkedList<>();
     boolean attrExists = modifiedEntry.removeAttribute(attr, missingValues);
 
+    AttributeDescription attrDesc = attr.getAttributeDescription();
     if (attrExists)
     {
       if (missingValues.isEmpty())
       {
-        AttributeType t = attr.getAttributeDescription().getAttributeType();
+        AttributeType t = attrDesc.getAttributeType();
 
         RDN rdn = modifiedEntry.getName().rdn();
         if (rdn != null
             && rdn.hasAttributeType(t)
-            && !modifiedEntry.hasValue(attr.getAttributeDescription(), rdn.getAttributeValue(t)))
+            && !modifiedEntry.hasValue(attrDesc, rdn.getAttributeValue(t)))
         {
           throw newDirectoryException(currentEntry,
               ResultCode.NOT_ALLOWED_ON_RDN,
-              ERR_MODIFY_DELETE_RDN_ATTR.get(entryDN, attr.getName()));
+              ERR_MODIFY_DELETE_RDN_ATTR.get(entryDN, attrDesc.getNameOrOID()));
         }
       }
       else if (!permissiveModify)
@@ -1306,13 +1311,13 @@
         String missingValuesStr = Utils.joinAsString(", ", missingValues);
 
         throw newDirectoryException(currentEntry, ResultCode.NO_SUCH_ATTRIBUTE,
-            ERR_MODIFY_DELETE_MISSING_VALUES.get(entryDN, attr.getName(), missingValuesStr));
+            ERR_MODIFY_DELETE_MISSING_VALUES.get(entryDN, attrDesc.getNameOrOID(), missingValuesStr));
       }
     }
     else if (!permissiveModify)
     {
       throw newDirectoryException(currentEntry, ResultCode.NO_SUCH_ATTRIBUTE,
-          ERR_MODIFY_DELETE_NO_SUCH_ATTR.get(entryDN, attr.getName()));
+          ERR_MODIFY_DELETE_NO_SUCH_ATTR.get(entryDN, attrDesc.getNameOrOID()));
     }
   }
 
@@ -1352,7 +1357,7 @@
         && !modifiedEntry.hasValue(attr.getAttributeDescription(), rdn.getAttributeValue(t)))
     {
       throw newDirectoryException(modifiedEntry, ResultCode.NOT_ALLOWED_ON_RDN,
-          ERR_MODIFY_DELETE_RDN_ATTR.get(entryDN, attr.getName()));
+          ERR_MODIFY_DELETE_RDN_ATTR.get(entryDN, attr.getAttributeDescription().getNameOrOID()));
     }
   }
 
@@ -1367,27 +1372,28 @@
   private void processIncrementModification(Attribute attr) throws DirectoryException
   {
     // The specified attribute type must not be an RDN attribute.
-    AttributeType t = attr.getAttributeDescription().getAttributeType();
+    AttributeDescription attrDesc = attr.getAttributeDescription();
+    AttributeType t = attrDesc.getAttributeType();
     RDN rdn = modifiedEntry.getName().rdn();
     if (rdn != null && rdn.hasAttributeType(t))
     {
       throw newDirectoryException(modifiedEntry, ResultCode.NOT_ALLOWED_ON_RDN,
-          ERR_MODIFY_INCREMENT_RDN.get(entryDN, attr.getName()));
+          ERR_MODIFY_INCREMENT_RDN.get(entryDN, attrDesc.getNameOrOID()));
     }
 
     // The provided attribute must have a single value, and it must be an integer
     if (attr.isEmpty())
     {
       throw newDirectoryException(modifiedEntry, ResultCode.PROTOCOL_ERROR,
-          ERR_MODIFY_INCREMENT_REQUIRES_VALUE.get(entryDN, attr.getName()));
+          ERR_MODIFY_INCREMENT_REQUIRES_VALUE.get(entryDN, attrDesc.getNameOrOID()));
     }
     else if (attr.size() > 1)
     {
       throw newDirectoryException(modifiedEntry, ResultCode.PROTOCOL_ERROR,
-          ERR_MODIFY_INCREMENT_REQUIRES_SINGLE_VALUE.get(entryDN, attr.getName()));
+          ERR_MODIFY_INCREMENT_REQUIRES_SINGLE_VALUE.get(entryDN, attrDesc.getNameOrOID()));
     }
 
-    MatchingRule eqRule = attr.getAttributeDescription().getAttributeType().getEqualityMatchingRule();
+    MatchingRule eqRule = t.getEqualityMatchingRule();
     ByteString v = attr.iterator().next();
 
     long incrementValue;
@@ -1401,21 +1407,22 @@
       logger.traceException(e);
 
       throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
-          ERR_MODIFY_INCREMENT_PROVIDED_VALUE_NOT_INTEGER.get(entryDN, attr.getName(), v), e);
+          ERR_MODIFY_INCREMENT_PROVIDED_VALUE_NOT_INTEGER.get(entryDN, attrDesc.getNameOrOID(), v), e);
     }
 
     // Get the attribute that is to be incremented.
-    Attribute a = modifiedEntry.getExactAttribute(attr.getAttributeDescription());
-    if (a == null)
+    Attribute modifiedAttr = modifiedEntry.getExactAttribute(attrDesc);
+    if (modifiedAttr == null)
     {
       throw newDirectoryException(modifiedEntry,
           ResultCode.CONSTRAINT_VIOLATION,
-          ERR_MODIFY_INCREMENT_REQUIRES_EXISTING_VALUE.get(entryDN, attr.getName()));
+          ERR_MODIFY_INCREMENT_REQUIRES_EXISTING_VALUE.get(entryDN, attrDesc.getNameOrOID()));
     }
 
     // Increment each attribute value by the specified amount.
-    AttributeBuilder builder = new AttributeBuilder(a.getAttributeDescription());
-    for (ByteString existingValue : a)
+    AttributeDescription modifiedAttrDesc = modifiedAttr.getAttributeDescription();
+    AttributeBuilder builder = new AttributeBuilder(modifiedAttrDesc);
+    for (ByteString existingValue : modifiedAttr)
     {
       long currentValue;
       try
@@ -1428,7 +1435,7 @@
 
         throw new DirectoryException(
             ResultCode.INVALID_ATTRIBUTE_SYNTAX,
-            ERR_MODIFY_INCREMENT_REQUIRES_INTEGER_VALUE.get(entryDN, a.getName(), existingValue),
+            ERR_MODIFY_INCREMENT_REQUIRES_INTEGER_VALUE.get(entryDN, modifiedAttrDesc.getNameOrOID(), existingValue),
             e);
       }
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java
index 53ceb6c..b7b9709 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/MockLDAPConnection.java
@@ -290,7 +290,7 @@
     // We now have the parent entry - so construct the new entry.
     Attributes attributes = new BasicAttributes();
     for (org.opends.server.types.Attribute attribute : entry.getAttributes()) {
-      BasicAttribute ba = new BasicAttribute(attribute.getName());
+      BasicAttribute ba = new BasicAttribute(attribute.getAttributeDescription().getNameOrOID());
       for (ByteString value : attribute) {
         ba.add(value.toString());
       }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
index 410f13e..b4b3ce1 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -316,7 +316,7 @@
         final Attribute expectedAttr = expectedAttrs.get(i);
         final Attribute actualAttr = actualAttrs.get(i).toAttribute();
 
-        assertTrue(expectedAttr.getName().equalsIgnoreCase(actualAttr.getName()));
+        assertTrue(expectedAttr.getAttributeDescription().getNameOrOID().equalsIgnoreCase(actualAttr.getAttributeDescription().getNameOrOID()));
         assertTrue(expectedAttr.toString().equalsIgnoreCase(actualAttr.toString()),
             "Comparing: " + expectedAttr + " and " + actualAttr);
       }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
index 23c6c00..602b626 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -555,7 +555,7 @@
       final Attribute expectedAttr = expectedAttrs.get(i);
       final Attribute actualAttr = actualAttrs.get(i).toAttribute();
 
-      assertTrue(expectedAttr.getName().equalsIgnoreCase(actualAttr.getName()));
+      assertTrue(expectedAttr.getAttributeDescription().getNameOrOID().equalsIgnoreCase(actualAttr.getAttributeDescription().getNameOrOID()));
       assertTrue(expectedAttr.toString().equalsIgnoreCase(actualAttr.toString()),
           "Comparing: " + expectedAttr + " and " + actualAttr);
     }
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
index fbd1c4a..521d8e0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
@@ -1041,7 +1041,7 @@
 
     Attribute a = builder.toAttribute();
     Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType);
-    Assert.assertEquals(a.getName(), "cn");
+    Assert.assertEquals(a.getAttributeDescription().getNameOrOID(), "cn");
   }
 
 
@@ -1061,7 +1061,7 @@
 
     Attribute a = builder.toAttribute();
     Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType);
-    Assert.assertEquals(a.getName(), "cn");
+    Assert.assertEquals(a.getAttributeDescription().getNameOrOID(), "cn");
   }
 
 
@@ -1081,7 +1081,7 @@
 
     Attribute a = builder.toAttribute();
     Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType);
-    Assert.assertEquals(a.getName(), "CN");
+    Assert.assertEquals(a.getAttributeDescription().getNameOrOID(), "CN");
   }
 
 
@@ -1102,7 +1102,7 @@
 
     Attribute a = builder.toAttribute();
     Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType);
-    Assert.assertEquals(a.getName(), "CN");
+    Assert.assertEquals(a.getAttributeDescription().getNameOrOID(), "CN");
   }
 
 
@@ -1301,7 +1301,7 @@
       AttributeType type, String name, String[] options, String[] values)
       throws Exception
   {
-    Assert.assertEquals(a.getName(), name);
+    Assert.assertEquals(a.getAttributeDescription().getNameOrOID(), name);
   }
 
 

--
Gitblit v1.10.0