From a29c1c0cdab34386c2da80032ebfca19b0c4763d Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 07 Apr 2016 08:47:04 +0000
Subject: [PATCH] Replace uses of Utilities.getAttributeNameWithoutOptions()

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
index c513db6..e5af34d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -46,6 +46,7 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.AVA;
+import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.RDN;
@@ -308,10 +309,11 @@
               Object o = table.getValueAt(i, 1);
               if (o instanceof String)
               {
-                String aName = Utilities.getAttributeNameWithoutOptions(attrName);
-                if (schema.hasAttributeType(aName))
+                AttributeDescription attrDesc = AttributeDescription.valueOf(attrName, schema.getSchemaNG());
+                AttributeType attrType = attrDesc.getAttributeType();
+                if (!attrType.isPlaceHolder())
                 {
-                  avas.add(new AVA(schema.getAttributeType(aName), attrName, o));
+                  avas.add(new AVA(attrType, attrDesc.getNameOrOID(), o));
                 }
                 break;
               }
@@ -608,8 +610,8 @@
             allSortedValues.add(new AttributeValuePair(attrName, v));
           }
         }
-        addedAttrs.add(
-            Utilities.getAttributeNameWithoutOptions(attrName).toLowerCase());
+        AttributeDescription attrDesc = AttributeDescription.valueOf(attrName);
+        addedAttrs.add(attrDesc.getNameOrOID().toLowerCase());
       }
       if (ocs != null && schema != null)
       {
@@ -763,14 +765,10 @@
         }
         for (AttributeValuePair currValue : allSortedValues)
         {
-          String attrNoOptions = Utilities.getAttributeNameWithoutOptions(
-              currValue.attrName).toLowerCase();
-          if (!attributes.contains(attrNoOptions))
-          {
-            continue;
-          }
-          else if (!schemaReadOnlyAttributesLowerCase.contains(
-              currValue.attrName.toLowerCase()))
+          AttributeDescription attrDesc = AttributeDescription.valueOf(currValue.attrName);
+          String attrNoOptions = attrDesc.getNameOrOID().toLowerCase();
+          if (attributes.contains(attrNoOptions)
+              && !schemaReadOnlyAttributesLowerCase.contains(currValue.attrName.toLowerCase()))
           {
             setValues(newResult, currValue.attrName);
           }
@@ -784,9 +782,8 @@
 
     private boolean isRequired(AttributeValuePair value)
     {
-      return requiredAttrs.contains(
-          Utilities.getAttributeNameWithoutOptions(
-              value.attrName.toLowerCase()));
+      AttributeDescription attrDesc = AttributeDescription.valueOf(value.attrName.toLowerCase());
+      return requiredAttrs.contains(attrDesc.getNameOrOID());
     }
 
     private boolean hasValue(AttributeValuePair value)

--
Gitblit v1.10.0