mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
04.53.2016 cd737457af3d812b90fedfcef2769407a58e1a8d
Replace CustomSearchResult by SDK's Entry
5 files modified
58 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java 24 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java 5 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -18,14 +18,12 @@
import javax.naming.NamingException;
import org.forgerock.opendj.adapter.server3x.Converters;
import org.forgerock.opendj.ldap.Attribute;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
import org.opends.server.types.OpenDsException;
/**
 * This is a commodity class used to wrap the SearchResult class of JNDI.
@@ -119,26 +117,4 @@
  public int hashCode() {
    return entry.hashCode();
  }
  /**
   * Sets the given attribute.
   * @param attr the attribute.
   */
  public void set(final Attribute attr)
  {
    entry.removeAttribute(attr.getAttributeDescription());
    entry.addAttribute(attr);
  }
  /**
   * Gets the Entry object equivalent to this CustomSearchResult.
   * The method assumes that the schema in DirectoryServer has been initialized.
   * @return the Entry object equivalent to this CustomSearchResult.
   * @throws OpenDsException if there is an error parsing the DN or retrieving
   * the attributes definition and objectclasses in the schema of the server.
   */
  public org.opends.server.types.Entry getEntry() throws OpenDsException
  {
    return Converters.to(entry);
  }
}
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -50,7 +50,9 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.adapter.server3x.Converters;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.LinkedAttribute;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
@@ -497,11 +499,13 @@
      {
        final LinkedAttribute attr = new LinkedAttribute(attrNames[j]);
        attr.add(values[j] + r.nextInt());
        csr.set(attr);
        Entry entry = csr.getSdkEntry();
        entry.removeAttribute(attr.getAttributeDescription());
        entry.addAttribute(attr);
      }
      try
      {
        list.add(new TaskEntry(csr.getEntry()));
        list.add(new TaskEntry(Converters.to(csr.getSdkEntry())));
      }
      catch (Throwable t)
      {
@@ -561,11 +565,13 @@
      {
        final LinkedAttribute attr = new LinkedAttribute(attrNames[j]);
        attr.add(values[j]);
        csr.set(attr);
        Entry entry = csr.getSdkEntry();
        entry.removeAttribute(attr.getAttributeDescription());
        entry.addAttribute(attr);
      }
      try
      {
        list.add(new TaskEntry(csr.getEntry()));
        list.add(new TaskEntry(Converters.to(csr.getSdkEntry())));
      }
      catch (Throwable t)
      {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -1599,7 +1599,10 @@
      Attribute attr = searchResult.getAttribute(attrName);
      if (attr != null && !attr.isEmpty())
      {
        newResult.set(new LinkedAttribute(attr));
        final Attribute newAttr = new LinkedAttribute(attr);
        org.forgerock.opendj.ldap.Entry entry = newResult.getSdkEntry();
        entry.removeAttribute(newAttr.getAttributeDescription());
        entry.addAttribute(newAttr);
      }
    }
    ignoreEntryChangeEvents = true;
@@ -1649,7 +1652,11 @@
          if (newPwds.equals(lastUserPasswords.get(attrName)))
          {
            Attribute oldValues = searchResult.getAttribute(attrName);
            newResult.set(oldValues != null ? new LinkedAttribute(oldValues) : new LinkedAttribute(attrName));
            final Attribute newAttr =
                oldValues != null ? new LinkedAttribute(oldValues) : new LinkedAttribute(attrName);
            org.forgerock.opendj.ldap.Entry entry = newResult.getSdkEntry();
            entry.removeAttribute(newAttr.getAttributeDescription());
            entry.addAttribute(newAttr);
          }
          else
          {
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -725,7 +725,10 @@
        Attribute attr = searchResult.getAttribute(attrName);
        if (attr != null && !attr.isEmpty())
        {
          newResult.set(new LinkedAttribute(attr));
          final Attribute newAttr = new LinkedAttribute(attr);
          org.forgerock.opendj.ldap.Entry entry = newResult.getSdkEntry();
          entry.removeAttribute(newAttr.getAttributeDescription());
          entry.addAttribute(newAttr);
        }
      }
      ignoreEntryChangeEvents = true;
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -486,7 +486,9 @@
    }
    if (!attr.isEmpty())
    {
      sr.set(attr);
      org.forgerock.opendj.ldap.Entry entry = sr.getSdkEntry();
      entry.removeAttribute(attr.getAttributeDescription());
      entry.addAttribute(attr);
    }
  }