From 3610cc2b7bc4fa3228f18e361823035064d5aa0b Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 05 Feb 2016 08:10:31 +0000
Subject: [PATCH] Align Attribute with SDK APIs: containsAll(Collection<ByteString>) => containsAll(Collection<?>)

---
 opendj-server-legacy/src/main/java/org/opends/server/api/VirtualAttributeProvider.java |    5 ++---
 opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java       |   12 ++++--------
 opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java              |    2 +-
 opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java      |   13 +++----------
 opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java       |    2 +-
 5 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/VirtualAttributeProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/api/VirtualAttributeProvider.java
index 2b97dd8..f247d16 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/VirtualAttributeProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/VirtualAttributeProvider.java
@@ -22,7 +22,7 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2012-2014 ForgeRock AS
+ *      Portions Copyright 2012-2016 ForgeRock AS
  */
 package org.opends.server.api;
 
@@ -227,8 +227,7 @@
    *          {@code false} if it will not generate at least one of
    *          them.
    */
-  public boolean hasAllValues(Entry entry, VirtualAttributeRule rule,
-                              Collection<ByteString> values)
+  public boolean hasAllValues(Entry entry, VirtualAttributeRule rule, Collection<?> values)
   {
     return getValues(entry, rule).containsAll(values);
   }
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 0396866..33a1e8d 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
@@ -47,19 +47,12 @@
     // No implementation required.
   }
 
-  /**
-   * {@inheritDoc}
-   * <p>
-   * This implementation iterates through each attribute value in the
-   * provided collection, checking to see if this attribute contains
-   * the value using {@link #contains(ByteString)}.
-   */
   @Override
-  public boolean containsAll(Collection<ByteString> values)
+  public boolean containsAll(Collection<?> values)
   {
-    for (ByteString value : values)
+    for (Object value : values)
     {
-      if (!contains(value))
+      if (!contains(ByteString.valueOfObject(value)))
       {
         return false;
       }
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 9c69305..50ff144 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
@@ -88,7 +88,7 @@
    *         values in the provided collection, or {@code false}
    *         if it does not contain at least one of them.
    */
-  boolean containsAll(Collection<ByteString> values);
+  boolean containsAll(Collection<?> values);
 
   /**
    * Indicates whether this attribute matches the specified assertion value.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
index 2ceb6fa..4baf19a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -112,9 +112,7 @@
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  /**
-   * A real attribute - options handled by sub-classes.
-   */
+  /** A real attribute */
   private static class RealAttribute extends AbstractAttribute
   {
     private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -1060,8 +1058,6 @@
     return values.contains(createAttributeValue(attributeType, value));
   }
 
-
-
   /**
    * Indicates whether this attribute builder contains all the values
    * in the collection.
@@ -1073,11 +1069,11 @@
    *         <CODE>false</CODE> if it does not contain at least one
    *         of them.
    */
-  public boolean containsAll(Collection<ByteString> values)
+  public boolean containsAll(Collection<?> values)
   {
-    for (ByteString v : values)
+    for (Object v : values)
     {
-      if (!contains(v))
+      if (!contains(ByteString.valueOfObject(v)))
       {
         return false;
       }
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
index 2ded510..6a3fa38 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
@@ -94,7 +94,7 @@
   }
 
   @Override
-  public boolean containsAll(Collection<ByteString> values)
+  public boolean containsAll(Collection<?> values)
   {
     return provider.hasAllValues(entry, rule, values);
   }

--
Gitblit v1.10.0