From 699c601799a26cb2a3e24171e4af4e90c2f93481 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 14 Mar 2014 16:51:27 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1308 Migrate schema support

---
 opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java b/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java
index f0caed3..4eb518e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java
@@ -34,6 +34,7 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ConditionResult;
@@ -539,23 +540,20 @@
                               VirtualAttributeRule rule,
                               AttributeValue value)
   {
-    ApproximateMatchingRule matchingRule =
-         rule.getAttributeType().getApproximateMatchingRule();
+    ApproximateMatchingRule matchingRule = rule.getAttributeType().getApproximateMatchingRule();
     if (matchingRule == null)
     {
       return ConditionResult.UNDEFINED;
     }
 
-    ByteString normalizedValue;
+    Assertion assertion = null;
     try
     {
-      normalizedValue = matchingRule.normalizeAttributeValue(value.getValue());
+      assertion = matchingRule.getAssertion(value.getValue());
     }
     catch (Exception e)
     {
       logger.traceException(e);
-
-      // We couldn't normalize the provided value => return "undefined".
       return ConditionResult.UNDEFINED;
     }
 
@@ -565,21 +563,16 @@
       try
       {
         ByteString nv = matchingRule.normalizeAttributeValue(v.getValue());
-        if (matchingRule.approximatelyMatch(nv, normalizedValue))
-        {
-          return ConditionResult.TRUE;
-        }
+        result = assertion.matches(nv);
       }
       catch (Exception e)
       {
         logger.traceException(e);
-
         // We couldn't normalize one of the attribute values.
         // We will return "undefined" if we can't find a definite match
         result = ConditionResult.UNDEFINED;
       }
     }
-
     return result;
   }
 

--
Gitblit v1.10.0