From 7a573aef4c0df5e52534320f8b911e54349f7921 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 04 Aug 2016 15:02:41 +0000
Subject: [PATCH] Make CustomSearchResult closer to SDK's Entry

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java |   16 ++++
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java         |   41 ++++-----
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java       |   19 ++--
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java  |   19 ++++
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java        |   11 +-
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java       |   71 ++++++++---------
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java            |   22 ++--
 7 files changed, 111 insertions(+), 88 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 eb2502a..280284a 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
@@ -26,6 +26,7 @@
 
 import org.forgerock.opendj.adapter.server3x.Converters;
 import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.Entry;
@@ -96,6 +97,21 @@
     return results;
   }
 
+  public Attribute getAttribute(AttributeDescription attributeDescription)
+  {
+    return entry.getAttribute(attributeDescription);
+  }
+
+  public Attribute getAttribute(String attributeDescription)
+  {
+    return entry.getAttribute(attributeDescription);
+  }
+
+  public Iterable<Attribute> getAllAttributes()
+  {
+    return entry.getAllAttributes();
+  }
+
   /**
    * Returns all the attribute names of the entry.
    * @return the attribute names of the entry.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
index e196685..a46bab4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -22,7 +22,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -480,18 +479,17 @@
     for (org.opends.server.types.Attribute attr : newAttrs)
     {
       AttributeDescription attrDesc = attr.getAttributeDescription();
-      String attrName = attrDesc.toString();
-      if (!ViewEntryPanel.isEditable(attrName, schema))
+      final String attrName = attrDesc.toString();
+      if (!ViewEntryPanel.isEditable(attrDesc, schema))
       {
         continue;
       }
       List<ByteString> newValues = new ArrayList<>();
-      Iterator<ByteString> it = attr.iterator();
-      while (it.hasNext())
+      for (ByteString v : attr)
       {
-        newValues.add(it.next());
+        newValues.add(v);
       }
-      List<ByteString> oldValues = oldEntry.getAttributeValues(attrName);
+      org.forgerock.opendj.ldap.Attribute oldAttr = oldEntry.getAttribute(attrDesc);
 
       ByteString rdnValue = null;
       for (AVA ava : newEntry.getName().rdn())
@@ -534,7 +532,7 @@
           break;
         }
       }
-      if (oldValues == null)
+      if (oldAttr == null)
       {
         Set<ByteString> vs = new HashSet<>(newValues);
         if (rdnValue != null)
@@ -548,6 +546,7 @@
               createAttribute(attrName, newValues)));
         }
       } else {
+        final List<ByteString> oldValues = toList(oldAttr);
         List<ByteString> toDelete = disjunction(newValues, oldValues);
         if (oldRdnValueDeleted != null)
         {
@@ -592,37 +591,33 @@
     }
 
     /* Check if there are attributes to delete */
-    for (String attrName : oldEntry.getAttributeNames())
+    for (org.forgerock.opendj.ldap.Attribute attr : oldEntry.getAllAttributes())
     {
-      if (!ViewEntryPanel.isEditable(attrName, schema))
+      AttributeDescription attrDesc = attr.getAttributeDescription();
+      if (!ViewEntryPanel.isEditable(attrDesc, schema))
       {
         continue;
       }
-      List<ByteString> oldValues = oldEntry.getAttributeValues(attrName);
-      AttributeDescription attrDesc = AttributeDescription.valueOf(attrName);
+      org.forgerock.opendj.ldap.Attribute oldAttr = oldEntry.getAttribute(attrDesc);
 
-      List<org.opends.server.types.Attribute> attrs = newEntry.getAttribute(attrDesc.getNameOrOID());
-      if (!find(attrs, attrName) && !oldValues.isEmpty())
+      if (!newEntry.hasAttribute(AttributeDescription.valueOf(attrDesc.getNameOrOID())) && !oldAttr.isEmpty())
       {
         modifications.add(new ModificationItem(
             DirContext.REMOVE_ATTRIBUTE,
-            new BasicAttribute(attrName)));
+            new BasicAttribute(attrDesc.toString())));
       }
     }
     return modifications;
   }
 
-  private static boolean find(List<org.opends.server.types.Attribute> attrs, String attrName)
+  private static List<ByteString> toList(org.forgerock.opendj.ldap.Attribute oldAttr)
   {
-    // TODO JNR use Entry.hasAttribute(AttributeDescription) instead?
-    for (org.opends.server.types.Attribute attr : attrs)
+    List<ByteString> results = new ArrayList<>();
+    for (ByteString v : oldAttr)
     {
-      if (attr.getAttributeDescription().toString().equalsIgnoreCase(attrName))
-      {
-        return true;
-      }
+      results.add(v);
     }
-    return false;
+    return results;
   }
 
   /**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
index 62d8b31..aebb0fb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
@@ -19,6 +19,7 @@
 
 import static com.forgerock.opendj.cli.Utils.*;
 
+import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
 import static org.opends.messages.AdminToolMessages.*;
 import static org.opends.server.util.ServerConstants.*;
 
@@ -28,7 +29,6 @@
 import java.awt.event.ActionListener;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.List;
 
 import javax.swing.JButton;
 import javax.swing.JLabel;
@@ -39,6 +39,8 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
 import org.opends.admin.ads.util.ConnectionWrapper;
@@ -344,10 +346,11 @@
     String dn = this.dn.getText();
     StringBuilder sb = new StringBuilder();
     sb.append("dn: ").append(dn);
-    for (String attrName : entryToDuplicate.getAttributeNames())
+    for (Attribute attr : entryToDuplicate.getAllAttributes())
     {
-      List<ByteString> values = entryToDuplicate.getAttributeValues(attrName);
-      if (attrName.equalsIgnoreCase(ATTR_USER_PASSWORD))
+      AttributeDescription attrDesc = attr.getAttributeDescription();
+      String attrName = attr.getAttributeDescriptionAsString();
+      if (attrDesc.equals(getUserPasswordAttributeType()))
       {
         sb.append("\n");
         String pwd = new String(password.getPassword());
@@ -358,12 +361,12 @@
       }
       else if (!attrName.equalsIgnoreCase(rdnAttribute))
       {
-        if (!ViewEntryPanel.isEditable(attrName,
+        if (!ViewEntryPanel.isEditable(attrDesc,
             getInfo().getServerDescriptor().getSchema()))
         {
           continue;
         }
-        for (ByteString value : values)
+        for (ByteString value : attr)
         {
           sb.append("\n");
           if (isBinary(attrName))
@@ -380,7 +383,7 @@
       else
       {
         String newValue = getFirstValue(DN.valueOf(dn));
-        if (values.size() == 1)
+        if (attr.size() == 1)
         {
           sb.append("\n");
           sb.append(attrName).append(": ").append(newValue);
@@ -388,7 +391,7 @@
         else
         {
           String oldValue = getFirstValue(entryToDuplicate.getName());
-          for (ByteString value : values)
+          for (ByteString value : attr)
           {
             sb.append("\n");
             if (oldValue.equals(value))
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
index 6d289a2..ad2ccbb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
@@ -34,6 +34,7 @@
 import javax.swing.tree.TreePath;
 
 import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.Attribute;
 import org.forgerock.opendj.ldap.ByteString;
 import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
 import org.opends.guitools.controlpanel.task.OfflineUpdateException;
@@ -167,9 +168,10 @@
     if (isReadOnly)
     {
       editableScroll.setVisible(false);
-      for (String attrName : sr.getAttributeNames())
+      for (Attribute attr : sr.getAllAttributes())
       {
-        for (ByteString v : sr.getAttributeValues(attrName))
+        final String attrName = attr.getAttributeDescriptionAsString();
+        for (ByteString v : attr)
         {
           sb.append("\n").append(getLDIFLine(attrName, v));
         }
@@ -183,11 +185,12 @@
     {
       editableScroll.setVisible(true);
 
-      for (String attrName : sr.getAttributeNames())
+      for (Attribute attr : sr.getAllAttributes())
       {
+        String attrName = attr.getAttributeDescriptionAsString();
         if (!schemaReadOnlyAttributesLowerCase.contains(attrName.toLowerCase()))
         {
-          for (ByteString v : sr.getAttributeValues(attrName))
+          for (ByteString v : attr)
           {
             sb.append("\n").append(getLDIFLine(attrName, v));
           }
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
index 271c7b9..45548a3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -442,7 +442,7 @@
       for (String attrName : sortedAttributes)
       {
         JLabel label = getLabelForAttribute(attrName, sr);
-        List<ByteString> values = sr.getAttributeValues(attrName);
+        List<ByteString> values = toList(sr.getAttribute(attrName));
         JComponent comp = getReadOnlyComponent(attrName, values);
         gbc.weightx = 0.0;
         gbc.anchor = anchor1(values);
@@ -467,7 +467,7 @@
           Utilities.setRequiredIcon(label);
           requiredAttrs.add(lcAttr);
         }
-        List<ByteString> values = sr.getAttributeValues(attrName);
+        List<ByteString> values = toList(sr.getAttribute(attrName));
         if (values.isEmpty())
         {
           values = newArrayList(ByteString.empty());
@@ -551,6 +551,19 @@
     });
   }
 
+  private List<ByteString> toList(Iterable<ByteString> values)
+  {
+    final List<ByteString> results = new ArrayList<>();
+    if (values != null)
+    {
+      for (ByteString v : values)
+      {
+        results.add(v);
+      }
+    }
+    return results;
+  }
+
   private int anchor2(final String attr, List<ByteString> values)
   {
     if (OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attr))
@@ -739,7 +752,7 @@
 
       for (String attr : attributes)
       {
-        boolean canAdd = isEditable(attr, schema);
+        boolean canAdd = isEditable(AttributeDescription.valueOf(attr), schema);
         if (canAdd && !find(attrNames, attr))
         {
           attrNames.add(attr);
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 43a1609..874f987 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
@@ -16,6 +16,7 @@
  */
 package org.opends.guitools.controlpanel.ui;
 
+import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
 import static org.opends.messages.AdminToolMessages.*;
 
 import java.awt.Component;
@@ -46,6 +47,7 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.AVA;
+import org.forgerock.opendj.ldap.Attribute;
 import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
@@ -421,7 +423,7 @@
     {
       int result;
       int[] possibleResults = {
-          desc1.attrName.compareTo(desc2.attrName),
+          desc1.attrDesc.compareTo(desc2.attrDesc),
           compareValues(desc1.value, desc2.value)};
       result = possibleResults[sortColumn];
       if (result == 0)
@@ -512,7 +514,7 @@
     public Object getValueAt(int row, int col)
     {
       AttributeValuePair attrValuePair = dataArray.get(row);
-      return col == 0 ? attrValuePair.attrName : attrValuePair.value;
+      return col == 0 ? attrValuePair.attrDesc.toString() : attrValuePair.value;
     }
 
     @Override
@@ -565,7 +567,7 @@
     public boolean isCellEditable(int row, int col) {
       return col != 0
           && !isReadOnly
-          && !schemaReadOnlyAttributesLowerCase.contains(dataArray.get(row).attrName.toLowerCase());
+          && !schemaReadOnlyAttributesLowerCase.contains(dataArray.get(row).attrDesc.toString().toLowerCase());
     }
 
     @Override
@@ -590,26 +592,26 @@
       requiredAttrs.clear();
       List<String> addedAttrs = new ArrayList<>();
       Schema schema = getInfo().getServerDescriptor().getSchema();
-      List<ByteString> ocs = null;
-      for (String attrName : searchResult.getAttributeNames())
+      Attribute ocs = null;
+      for (Attribute attr : searchResult.getAllAttributes())
       {
-        if (ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName))
+        AttributeDescription attrDesc = attr.getAttributeDescription();
+        if (attrDesc.equals(getObjectClassAttributeType()))
         {
           if (schema != null)
           {
-            ocs = searchResult.getAttributeValues(attrName);
+            ocs = attr;
             ObjectClassValue ocValue = getObjectClassDescriptor(ocs, schema);
-            allSortedValues.add(new AttributeValuePair(attrName, ocValue));
+            allSortedValues.add(new AttributeValuePair(attrDesc, ocValue));
           }
         }
         else
         {
-          for (Object v : searchResult.getAttributeValues(attrName))
+          for (Object v : attr)
           {
-            allSortedValues.add(new AttributeValuePair(attrName, v));
+            allSortedValues.add(new AttributeValuePair(attrDesc, v));
           }
         }
-        AttributeDescription attrDesc = AttributeDescription.valueOf(attrName);
         addedAttrs.add(attrDesc.getNameOrOID().toLowerCase());
       }
       if (ocs != null && schema != null)
@@ -619,22 +621,20 @@
           ObjectClass objectClass = schema.getObjectClass(oc.toString());
           if (!objectClass.isPlaceHolder())
           {
-            for (AttributeType attr : objectClass.getRequiredAttributes())
+            for (AttributeType attrType : objectClass.getRequiredAttributes())
             {
-              String attrName = attr.getNameOrOID();
-              String lowerCase = attrName.toLowerCase();
+              String lowerCase = attrType.getNameOrOID().toLowerCase();
               if (!addedAttrs.contains(lowerCase))
               {
-                allSortedValues.add(newAttributeValuePair(attrName));
+                allSortedValues.add(newAttributeValuePair(AttributeDescription.create(attrType)));
               }
               requiredAttrs.add(lowerCase);
             }
-            for (AttributeType attr : objectClass.getOptionalAttributes())
+            for (AttributeType attrType : objectClass.getOptionalAttributes())
             {
-              String attrName = attr.getNameOrOID();
-              if (!addedAttrs.contains(attrName.toLowerCase()))
+              if (!addedAttrs.contains(attrType.getNameOrOID().toLowerCase()))
               {
-                allSortedValues.add(newAttributeValuePair(attrName));
+                allSortedValues.add(newAttributeValuePair(AttributeDescription.create(attrType)));
               }
             }
           }
@@ -652,15 +652,16 @@
       renderer.setRequiredAttrs(requiredAttrs);
     }
 
-    private AttributeValuePair newAttributeValuePair(String attrName)
+    private AttributeValuePair newAttributeValuePair(AttributeDescription attrDesc)
     {
+      String attrName = attrDesc.toString();
       if (isBinary(attrName) || isPassword(attrName))
       {
-        return new AttributeValuePair(attrName, new byte[] {});
+        return new AttributeValuePair(attrDesc, new byte[] {});
       }
       else
       {
-        return new AttributeValuePair(attrName, "");
+        return new AttributeValuePair(attrDesc, "");
       }
     }
 
@@ -697,7 +698,7 @@
       List<Object> values = new ArrayList<>();
       for (AttributeValuePair valuePair : dataArray)
       {
-        if (valuePair.attrName.equalsIgnoreCase(attrName)
+        if (valuePair.attrDesc.equals(AttributeDescription.valueOf(attrName))
             && hasValue(valuePair))
         {
           if (valuePair.value instanceof Collection<?>)
@@ -762,12 +763,11 @@
         }
         for (AttributeValuePair currValue : allSortedValues)
         {
-          AttributeDescription attrDesc = AttributeDescription.valueOf(currValue.attrName);
-          String attrNoOptions = attrDesc.getNameOrOID().toLowerCase();
+          String attrNoOptions = currValue.attrDesc.getNameOrOID().toLowerCase();
           if (attributes.contains(attrNoOptions)
-              && !schemaReadOnlyAttributesLowerCase.contains(currValue.attrName.toLowerCase()))
+              && !schemaReadOnlyAttributesLowerCase.contains(currValue.attrDesc.toString().toLowerCase()))
           {
-            setValues(newResult, currValue.attrName);
+            setValues(newResult, currValue.attrDesc.toString());
           }
         }
       }
@@ -779,8 +779,7 @@
 
     private boolean isRequired(AttributeValuePair value)
     {
-      AttributeDescription attrDesc = AttributeDescription.valueOf(value.attrName.toLowerCase());
-      return requiredAttrs.contains(attrDesc.getNameOrOID());
+      return requiredAttrs.contains(value.attrDesc.getNameOrOID());
     }
 
     private boolean hasValue(AttributeValuePair value)
@@ -808,18 +807,12 @@
    */
   private static class AttributeValuePair
   {
-    /** The attribute name. */
-    private final String attrName;
-    /** The value. */
+    private final AttributeDescription attrDesc;
     private Object value;
-    /**
-     * Constructor.
-     * @param attrName the attribute name.
-     * @param value the value.
-     */
-    private AttributeValuePair(String attrName, Object value)
+
+    private AttributeValuePair(AttributeDescription attrDesc, Object value)
     {
-      this.attrName = attrName;
+      this.attrDesc = attrDesc;
       this.value = value;
     }
   }
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
index 65cc089..3908639 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -36,6 +36,7 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.AVA;
+import org.forgerock.opendj.ldap.Attribute;
 import org.forgerock.opendj.ldap.AttributeDescription;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DN;
@@ -203,7 +204,7 @@
       title.setIcon(null);
     }
 
-    List<ByteString> ocs = sr.getAttributeValues(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
+    Attribute ocs = sr.getAttribute(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
     Schema schema = getInfo().getServerDescriptor().getSchema();
     if (!ocs.isEmpty() && schema != null)
     {
@@ -234,16 +235,16 @@
   /**
    * Returns an object class value representing all the object class values of
    * the entry.
-   * @param ocValues the list of object class values.
+   * @param ocAttr the list of object class values.
    * @param schema the schema.
    * @return an object class value representing all the object class values of
    * the entry.
    */
-  protected ObjectClassValue getObjectClassDescriptor(List<ByteString> ocValues, Schema schema)
+  protected ObjectClassValue getObjectClassDescriptor(Iterable<ByteString> ocAttr, Schema schema)
   {
     ObjectClass structuralObjectClass = null;
     SortedSet<String> auxiliaryClasses = new TreeSet<>();
-    for (ByteString oc : ocValues)
+    for (ByteString oc : ocAttr)
     {
       ObjectClass objectClass = schema.getObjectClass(oc.toString());
       if (!objectClass.isPlaceHolder())
@@ -489,16 +490,15 @@
   }
 
   /**
-   * Returns <CODE>true</CODE> if the provided attribute name is an editable
-   * attribute and <CODE>false</CODE> otherwise.
-   * @param attrName the attribute name.
+   * Returns whether the provided attribute name is an editable attribute.
+   * @param attrDesc the attribute description.
    * @param schema the schema.
-   * @return <CODE>true</CODE> if the provided attribute name is an editable
-   * attribute and <CODE>false</CODE> otherwise.
+   * @return {@code true} if the provided attribute name is an editable
+   * attribute, {@code false} otherwise.
    */
-  public static boolean isEditable(String attrName, Schema schema)
+  public static boolean isEditable(AttributeDescription attrDesc, Schema schema)
   {
-    attrName = AttributeDescription.valueOf(attrName).getNameOrOID();
+    String attrName = attrDesc.getNameOrOID();
     if (schema != null && schema.hasAttributeType(attrName))
     {
       AttributeType attrType = schema.getAttributeType(attrName);

--
Gitblit v1.10.0