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

Jean-Noel Rouvignac
25.00.2015 6b5f26722aa60b3f428a930e9d7eebce8f514c9d
Use Collection.contains()
5 files modified
68 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java 19 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java 19 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
@@ -3265,30 +3265,21 @@
  private boolean isAttributeModified(AttributeIndex index,
                                      List<Modification> mods)
  {
    boolean attributeModified = false;
    AttributeType indexAttributeType = index.getAttributeType();
    Iterable<AttributeType> subTypes =
    List<AttributeType> subTypes =
            DirectoryServer.getSchema().getSubTypes(indexAttributeType);
    for (Modification mod : mods)
    {
      Attribute modAttr = mod.getAttribute();
      AttributeType modAttrType = modAttr.getAttributeType();
      if (modAttrType.equals(indexAttributeType))
      if (modAttrType.equals(indexAttributeType)
          || subTypes.contains(modAttrType))
      {
        attributeModified = true;
        break;
      }
      for(AttributeType subType : subTypes)
      {
        if(modAttrType.equals(subType))
        {
          attributeModified = true;
          break;
        return true;
        }
      }
    }
    return attributeModified;
    return false;
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java
@@ -377,21 +377,15 @@
    for (SortKey sortKey : sortOrder.getSortKeys())
    {
      AttributeType attributeType = sortKey.getAttributeType();
      Iterable<AttributeType> subTypes = DirectoryServer.getSchema().getSubTypes(attributeType);
      List<AttributeType> subTypes = DirectoryServer.getSchema().getSubTypes(attributeType);
      for (Modification mod : mods)
      {
        AttributeType modAttrType = mod.getAttribute().getAttributeType();
        if (modAttrType.equals(attributeType))
        if (modAttrType.equals(attributeType)
            || subTypes.contains(modAttrType))
        {
          return true;
        }
        for (AttributeType subType : subTypes)
        {
          if (modAttrType.equals(subType))
          {
            return true;
          }
        }
      }
    }
    return false;
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -2865,30 +2865,21 @@
   */
  private static boolean isAttributeModified(AttributeIndex index, List<Modification> mods)
  {
    boolean attributeModified = false;
    AttributeType indexAttributeType = index.getAttributeType();
    Iterable<AttributeType> subTypes =
    List<AttributeType> subTypes =
            DirectoryServer.getSchema().getSubTypes(indexAttributeType);
    for (Modification mod : mods)
    {
      Attribute modAttr = mod.getAttribute();
      AttributeType modAttrType = modAttr.getAttributeType();
      if (modAttrType.equals(indexAttributeType))
      if (modAttrType.equals(indexAttributeType)
          || subTypes.contains(modAttrType))
      {
        attributeModified = true;
        break;
      }
      for(AttributeType subType : subTypes)
      {
        if(modAttrType.equals(subType))
        {
          attributeModified = true;
          break;
        return true;
        }
      }
    }
    return attributeModified;
    return false;
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -400,21 +400,15 @@
    for (final SortKey sortKey : sortOrder.getSortKeys())
    {
      final AttributeType attributeType = sortKey.getAttributeType();
      final Iterable<AttributeType> subTypes = DirectoryServer.getSchema().getSubTypes(attributeType);
      final List<AttributeType> subTypes = DirectoryServer.getSchema().getSubTypes(attributeType);
      for (final Modification mod : mods)
      {
        final AttributeType modAttrType = mod.getAttribute().getAttributeType();
        if (modAttrType.equals(attributeType))
        if (modAttrType.equals(attributeType)
            || subTypes.contains(modAttrType))
        {
          return true;
        }
        for (final AttributeType subType : subTypes)
        {
          if (modAttrType.equals(subType))
          {
            return true;
          }
        }
      }
    }
    return false;
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -439,11 +439,9 @@
   *          type, or an empty set if there are no subtypes
   *          registered for the attribute type.
   */
  public Iterable<AttributeType>
              getSubTypes(AttributeType attributeType)
  public List<AttributeType> getSubTypes(AttributeType attributeType)
  {
    List<AttributeType> subTypes =
         subordinateTypes.get(attributeType);
    List<AttributeType> subTypes = subordinateTypes.get(attributeType);
    if (subTypes == null)
    {
      return Collections.emptyList();